Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Coverting an IloExpr to IloNum

  • 1.  Coverting an IloExpr to IloNum

    Posted Fri October 31, 2014 04:02 AM

    Originally posted by: pareto


    Hello anyone,

    I have a question which may be trivial, but I need your help in topic.

    I have an IloExpr which contains some variables, and some constants. When I print it out, it is sth like:

    0.071*IloIntVar<13>[0..1]+1.23*IloNumVar<423>[0..1.#INF]+12.5 ...

    Now, I want to call each variable´s value (through getValue) from a model solution and replace variables in IloExpr with these values, and convert the mathematical result into an IloNum.

    Is that possible?

    Thank you

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Coverting an IloExpr to IloNum

    Posted Fri October 31, 2014 05:17 AM

    There is an overload IloCplex::getValue(IloExpr).

    So you can directly call cplex.getValue(expr) (assuming expr is your IloExpr instance). This will return the value of the expression given the current solution stored in the IloCplex instance.


    #CPLEXOptimizers
    #DecisionOptimization