Originally posted by: CplexUser1453
sorry the formatting is not right. Here is the message with good formatting :
I am dealing with a problem where one of the decision variables looks like a fairly sparse 3D array. Thanks to tuples I was able to write a fairly elegant OPL model. However now I have trouble accessing my representation through the JAVA API.
Here is my OPL representation :
tuple TripleIndex
{
int t;
int u;
int g;
}
{TripleIndex
} Index =
{<t,u,g> | t in Time, u in Urange, g in 1..Garray[t][u]
}; dvar
boolean X[s in Index];
Accesing my X variable in OPL scripting is easy :
X[Index.find(t,u,g)] (
for a given t,u,g)
Using the Java API I am capable of getting X and TripleIndex :
IloTupleSchema Tindex = opl.getElement("TripleIndex").asTupleSchema();
IloNumMap Xmap = opl.getElement("X").asNumMap();
Here are my questions :
1) How do I get my "Index" tuple from opl?
2) Once I have all three elements, how do I do the equivalent of
X[Index.find(t,u,g)] (
for a given t,u,g)
Thanks a lot!
#DecisionOptimization#OPLusingCPLEXOptimizer