Decision Optimization

Decision Optimization

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

 View Only
  • 1.  [C++] Retrieve the actual values of the expressions

    Posted Sun April 17, 2011 10:16 AM

    Originally posted by: nomiz


    Dear all,

    In what way should I extract the actual values of the expressions of a solved problem?

    Thank you in advance,

    Simon
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: [C++] Retrieve the actual values of the expressions

    Posted Sun April 17, 2011 10:40 AM

    Originally posted by: nomiz


    (With this I mean the values of each IloExpr and IloExprArray element)
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: [C++] Retrieve the actual values of the expressions

    Posted Sun April 17, 2011 05:36 PM

    Originally posted by: SystemAdmin


    To get the values of variables, use IloCplex::getValue or IloCplex::getValues.

    To get the value of the expression in a constraint, I would probably use IloCplex::getSlack or IloCplex::getSlacks (and then use the difference between the slack and the upper limit of the constraint to get the value.

    Although I've never tried it, I think you can use IloCplex::getValue to get the value of any IloNumExpr instance (including the expression in a constraint), since IloNumExpr is a subclass of IloNumExprArg and there's a version of getValue that takes an IloNumExprArg argument. There does not seem to be an array version (getValues), though, so to get values for an array of expressions you'd presumably have to loop through the array.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: [C++] Retrieve the actual values of the expressions

    Posted Wed April 20, 2011 08:43 AM

    Originally posted by: nomiz


    Ha thx!

    There is just no getValues() for the whole array of expressions. I'm now using your tip about getValue() in a for-loop.

    Regards,

    Simon
    #CPLEXOptimizers
    #DecisionOptimization