Originally posted by: Bahman
Hello Everyone,
I have coded and ran my model in CPLEX OPL API, and It works fine. I am migrating to JAVA API. I had defined a tuple in CPLEX STUDIO (in OP:I) and I do not know if I need to define a tuple3 and List<Tuple>,, or a separate class to write the set of tuples (representing arcs).I do not know what is the best way to define the arcs that I had defined them in opl in tuples, and how to make use of that as a dimension of my decision variable X, in JAVA API. A MWE is presented as follows:
{int} Y=asSet(1..7);
{int} T=asSet(1..10);
{int} K=asSet(1..42);
int b[Y][K][G]=...;
{string} G=...;
tuple Sleg {
int i;
int j;
float l;
}
{Sleg} Slegs with i,j in Y=...;
Then one of the decision Variable:
dvar int+ X[Slegs][K][G][T];
and one of the constraints (flow conservation constraint in particular):
forall (i in Y, k in K, g in G)
CtFC:
sum(<i,j,l> in Slegs, t in T) X[<i,j,l>][k][g][t] - sum (<j,i,l> in Slegs, t in T) X[<j,i,l>][k][g][t]==b[i][k][g];
I would appreciate if you could help me out to define the tuple, decision variable and the the set set of constraint written above as flow conservation constraints.
Regards,
Bahman
#CPLEXOptimizers#DecisionOptimization