Decision Optimization

Decision Optimization

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

 View Only
  • 1.  how to initialize iloint variables?

    Posted Mon March 11, 2013 10:08 PM

    Originally posted by: SystemAdmin


    I defined an IloIntVarArray x and added an instance of IloIntVar with the following code:

    x.add(IloIntVar(env, 1, 5, "x1"));
    


    executing the statement would set the upper and lower bounds the IloIntVar 'x1', but how to assign a specific integer value to "x1"?

    I used the following code
    x[0] = 2;
    

    but comes with a compiling error 'error C2679: binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)'
    any ideas? thanks;)
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: how to initialize iloint variables?

    Posted Tue March 12, 2013 02:49 AM

    Originally posted by: SystemAdmin


    You cannot assign a value to an instance of IloIntVar.
    If you want to fix a variable to a particular value then you need to set the lower and upper bound of that variable to that value. You can use the setLB and setUB member functions to do that.
    #CPLEXOptimizers
    #DecisionOptimization