I am trying to define a binary decision variable in java using cplex. That\'s a two dimensional variable. It means that if a path starts from a specific station it should be 1 o
You are trying to create a 2D array of binary decision variables. What errors are you getting?
Try looking at some of the sample code provided with CPLEX. See for example transport.java which includes some 2D arrays of variables declared and initialised like this:
IloNumVar[][] x = new IloNumVar[nbSupply][];
IloNumVar[][] y = new IloNumVar[nbSupply][];
for (int i = 0; i < nbSupply; i++) {
x[i] = cplex.numVarArray(nbDemand, 0., Double.MAX_VALUE);
y[i] = cplex.numVarArray(nbDemand, 0., Double.MAX_VALUE);
}