I want to model a problem with a variable x[i][j][k].
No where in the reference manual is there mention of how to create a variable with size greater than 1 dimension.
http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r4/index.jsp?topic=%2Filog.odms.cplex.help%2Frefjavacplex%2Fhtml%2Filog%2Fcplex%2FIloCplex.html
This snippet shows an example of creating three indexed continuous variable x, x[i][j][t] in [0,1]:
IloNumVar[][][] x = new IloNumVar[numNodes][numNodes][numDays];
for(int i = 0; i < numNodes; i++)
{
for(int j = 0; j < numNodes; j++)
{
//cplex is an instance of class IloCplex
x[i][j] = cplex.numVarArray(numDays, 0, 1);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With