Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

How to add constraints on the decision variables using two-dimension array?

  • 1.  How to add constraints on the decision variables using two-dimension array?

    Posted 12/02/07 06:33 AM

    Originally posted by: SystemAdmin


    [winterwinter said:]

    Suppose X is a m*n IloNumVarArray2(two-dimension array). Now we want to set the constraints on the decision varibles: 0=<x[i][j]<=1, 0=<i<m,0=<j<n. How to do it in Ilog Cplex using C++?<br />
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to add constraints on the decision variables using two-dimension array?

    Posted 12/04/07 08:51 PM

    Originally posted by: SystemAdmin


    [ChrisHane said:]

    Hello,

    The content of this email corresponds to the steel example in the CPLEX product distribution.  In that example the two dimensions are products and time. One of the decision variables is how much product to make in each time period (Make[p][t]).

    An IloNumVarArray2 is just a shortcut to define an array of arrays, like this:

          IloNumVarArray2 Make(env);
          for (p = 0; p < nProd; p++) {<br />        Make.add(IloNumVarArray(env, nTime, 0.0, IloInfinity));
          }

    Constraints using Make are posted using the add() method of the model:

          for (p = 0; p < nProd; p++) {<br />        mod.add(Make[p][0] + inv0[p] == Sell[p][0] + Inv[p][0]);
            for (t = 1; t < nTime; t++) {<br />            mod.add(Make[p][t] + Inv[p][t-1] == Sell[p][t] + Inv[p][t]);
            }
          }

    Regards,
    Chris
    #CPLEXOptimizers
    #DecisionOptimization