Originally posted by: jawadomari
Hello everyone,
I have a small question about creating arrays of variables. I have a 2D array of continuous variables representing the arrival times of each train at each station. I know that some trains do not arrive at some stations.
If I write something like this:
IloArray<IloNumVarArray> arrivalTimes(env, noOfTrains);
for(t = 0; t < noOfTrains; t++)
{
arrivalTimes[t] = IloNumVarArray(env, noOfStations);
if(t arrives at s)
{
arrivalTimes[t][s] = IloNumVar(env);
model.add(arrivalTimes[t][s]);
}
}
Would I have created noOfStations x noOfTrains variables, or just the ones that were added to the model? If it is the latter, would memory have been allocated to the parts of the array where a train does not arrive at a station?
Thank you.
#CPLEXOptimizers#DecisionOptimization