Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Aggregating expressions for objective function

    Posted 07/27/12 11:47 AM

    Originally posted by: SystemAdmin


    Hello :)

    I have a complex objective function where the final expression is created by aggregating snippet expressions in the model. That is, lets assume following simplified objective function:
    F = e1 + e2 +...en where

    IloLinearNumExpr e1,e2,e3
    e1.addTerm(5, X[0]);
    e1.addTerm(3, X[1]);
    e1.addTerm(7, X[2]);
    e1.setConstant(10);

    e2.addTerm(10, X[6]);
    ....
    e2.addTerm(n, X[9]);

    IloNumExpr e3 = model.min(e1,e2);
    ...
    ...
    en
    What is really needed to build up the final expression is casting IloNumExpr expressions (e.g., e3) to IloLinearNumExpr in the course of iteration to be able to create the final expression in a loop. However, the casting is not plausible. So I'm wondering how we can deal with
    Some parts of the objective function expression include min/max. I'm wondering if anybody can shed some lights for expression aggregation since there is no way for casting
    I'm grateful for some help on this topic.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Aggregating expressions for objective function

    Posted 07/27/12 04:54 PM

    Originally posted by: SystemAdmin


    Not sure if I understood correctly what you want to do. Can you just use operator+=?
    IloNumExpr e1 = x + y;
    IloNumExpr e2 = x - y;
    IloNumExpr agg(env);
    agg += e1;
    agg += e2;
    

    This allows you to add up instances of IloNumExpr.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Aggregating expressions for objective function

    Posted 07/28/12 01:21 AM

    Originally posted by: SystemAdmin


    Many thanks Daniel. I already solved it by following up Rubin's suggestion as well
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Aggregating expressions for objective function

    Posted 07/27/12 05:10 PM

    Originally posted by: SystemAdmin


    Following up on Daniel's response, if you're using the Java API, you can nest zillions of model.sum() and model.prod() calls to combine IloNumExprs.

    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


  • 5.  Re: Aggregating expressions for objective function

    Posted 07/28/12 01:28 AM

    Originally posted by: SystemAdmin


    Thanks a lot Paul :) It was helpful. Actually I was about thinking to cast IloNumExpr expressions to IloLinearNumExpr ones rather than generating in that way.
    #CPLEXOptimizers
    #DecisionOptimization