Originally posted by: SystemAdmin
[ChrisHane said:]
Hello,
The content of this email corresponds to the steel example in the CPLEX product distribution. In that example the two dimensions are products and time. One of the decision variables is how much product to make in each time period (Make[p][t]).
An IloNumVarArray2 is just a shortcut to define an array of arrays, like this:
IloNumVarArray2 Make(env);
for (p = 0; p < nProd; p++) {<br /> Make.add(IloNumVarArray(env, nTime, 0.0, IloInfinity));
}
Constraints using Make are posted using the add() method of the model:
for (p = 0; p < nProd; p++) {<br /> mod.add(Make[p][0] + inv0[p] == Sell[p][0] + Inv[p][0]);
for (t = 1; t < nTime; t++) {<br /> mod.add(Make[p][t] + Inv[p][t-1] == Sell[p][t] + Inv[p][t]);
}
}
Regards,
Chris
#CPLEXOptimizers#DecisionOptimization