Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Problem with absolute vlaue in optimization equation

  • 1.  Problem with absolute vlaue in optimization equation

    Posted Fri October 01, 2010 10:08 AM

    Originally posted by: SystemAdmin


    Hi,
    I have a code of form:
    IloCplex model = null;
    IloNumVar X[] = null;
    IloNumVar E[] = null;
    IloNumVar E_abs = model.numVarArray(noOfRev, 0, 10);
     X = model.numVarArray(noOfVar, -5, 5);
     E = model.numVarArray(noOfRev, -10, 10);
    


    After this I have numerous constraint for both X and E

    my optimization (minimization) expression should be of the form
    model.addMinimize(model.scalProd(E_abs, cost));
    


    where
    E_abs[i]=|E[i]| for all i,

    i.e the absolute value.

    For this i cannot apply the abs() method since it will make the equation linear num expression, which will make it impossible to add it to optimization equation.
    So, I need some constraints which ensures that E_abs[i]=Abs(E[i]).

    And also the value of E[i] should determine E_abs[i] not the other way around. i.e I need the value of E[i] first and then only get its absolute value to put in the optimization equation..

    Been stuck with this for quite a while, looked into some other post for absolute value but somehow could not implement it write......
    Any help will be highly appreciated.

    I am using the Java concert for CPLEX 12 academic edition

    Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Problem with absolute vlaue in optimization equation

    Posted Fri October 01, 2010 12:30 PM

    Originally posted by: SystemAdmin


    If cost[i] >= 0 for all i, then there is an easy trick to do what you want: just state the objective function in terms of E_abs, the constraints in terms of E, and then add the following inequalities for all i:
    E_abs[i] >= E[i]
    E_abs[i] >= -E[i]
    


    These inequalities ensure that E_abs[i] >= |E[i]|. Now, because cost[i] >= 0, there is no reason for E_abs[i] to get larger than |E[i]|. Hence, in every optimal solution you will have E_abs[i] == |E[i]|.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Problem with absolute vlaue in optimization equation

    Posted Thu October 07, 2010 05:36 AM

    Originally posted by: SystemAdmin


    Thanks a lot for the help...
    #CPLEXOptimizers
    #DecisionOptimization