Representing the data

Describes populating the model with data.

As in other examples, the template class IloArray appears in a type definition to create matrices for this problem, like this:


typedef IloArray<IloNumArray>    NumMatrix;
typedef IloArray<IloNumVarArray> NumVarMatrix;

Those two-dimensional arrays (that is, arrays of arrays) are now available in the application to represent the demands from the showrooms and the supplies available from the factories.


    IloInt nbDemand = 4;
    IloInt nbSupply = 3;
    IloNumArray supply(env, nbSupply, 1000., 850., 1250.);
    IloNumArray demand(env, nbDemand, 900., 1200., 600., 400.);

    NumVarMatrix x(env, nbSupply);
    NumVarMatrix y(env, nbSupply);
    for(i = 0; i < nbSupply; i++){
      x[i] = IloNumVarArray(env, nbDemand, 0, IloInfinity, ILOFLOAT);
      y[i] = IloNumVarArray(env, nbDemand, 0, IloInfinity, ILOFLOAT);
    }