I have to do a calculation with Parameter K_T(s,i,ii,t) in R and get the calculation results back to Aimms for the Optimization. I want to have the root of the matrix.
i and ii are Indices for the same SetIdentifier Sn.
code:
dl::DataTables+={'MyDataFrame'};
empty DataMap;
DataMap(dl::dt,dl::idn,dl::cn,dl::dn) += data {
!( table_name , identifier , col , dom ) : name_in_dataframe
( MyDataFrame , Sn , 2 , 1 ) : "i",
( MyDataFrame , Sn , 3 , 2 ) : "ii",
( MyDataFrame , P , 4 , 3 ) : "t",
( MyDataFrame , OL , 5 , 4 ) : "s" ,
( MyDataFrame , K_T , 1 , 0 ) : "K"
} ;
MapName:="MyMapName";
dl::RemoveDataSourceMapping(MapName);
dl::AddDataSourceMapping( MapName, DataMap,
dl::DependEmpty,dl::TableAttributesEmpty,dl::ColAttributeEmpty);
dl::ExecScript("source('test_rlink.r')",MapName,XA);
the R-Code in test_rlink.r
code:
# get data from AIMMS
dfin <- aimms::GetData("MyDataFrame")
# do the calculation
dec0 <- eigen(dfin$K)
ev0 <- dec0$vectors
ew0 <- diag(dec0$values)
root <- ev0 %*% ew0^{0.5} %*% t(ev0)
# give data to Aimms
MyDataFrame2 <- aimms::SetData("root")
These warnings appear at the moment:
code:
Domain columns are not declared adjacent in table mapping of table MyDataFrame (columns 1-3 are missing).
Domain columns are not declared adjacent in table mapping of table MyDataFrame (columns 1-4 are missing).
Table mapping of table MyDataFrame contains a 4-dimensional identifier K_T specified over a 1-dimensional domain.
The thread tried to read from or write to a virtual address for which it does not have the appropriate access
I´m not sure how to fix this - could you give me some advice?
Do I have to declare also a DataMap for getting the results in MyDataFrame2?
Many thanks in advance!
Tobi