Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  methode "add" from IloNumVarArray

    Posted 12/15/08 05:11 PM

    Originally posted by: SystemAdmin


    [Katrin said:]

    Hi all,

    I'm trying to use cplex under C++ the first time and I have a problem with the method "add" from  IloNumVarArray. I would like to build up an Array of size 5 where the elements of the array are arrays of the IloNumVarArray. For example the first element should be an IloNumVarArray of all Flow Variables, and the second element should be an IloNumVarArray of all RessourceVariables.
    I tried this:

    IloArray<IloNumVarArray>  arrarrNumVar(env, 5);

    Afterwards I tried to add all Variables in loops to this arrarrNumVar. I did this like this:

    arrarrNumVar[0].add(IloNumVar(env,0,1,ILOBOOL,"FlowVariable1"));

    However this doesn't work. Certaintly that's a beginner's mistake. However I'm deeply grateful for any suggestion.

    Katrin
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: methode "add" from IloNumVarArray

    Posted 12/16/08 06:10 PM

    Originally posted by: SystemAdmin


    [prubin said:]

    (Disclaimer:  I gave up C++ for Java years ago, with no regrets, so I might be off here.)

    I think you have to declare the inner arrays before you add variables to them.  So try something like

    arrarrNumVar[i] = IloNumVarArray(env, maxSize);

    in a loop before using the add method.

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization