Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

How to use sqrt in objective function

  • 1.  How to use sqrt in objective function

    Posted Thu January 14, 2016 07:25 PM

    Originally posted by: ThienNguyenVN


    hello everyone , i'am a new user cplex . I don't know how to use SQRT function in my objective function . I attach my mod file below , thanks for your help . 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to use sqrt in objective function

    Posted Fri January 15, 2016 01:36 AM

    Since your question is related to modeling in OPL you should ask it on the OPL Forum.

    In any case, the square root function is neither linear nor quadratic, hence it cannot be used. What you can try is to reformulate. For example,

    dexpr float d= sqrt(d1+d2+d3);
    minimize d;
    

    is equivalent to

    dvar float+ sqrtd;
    minimize sqrtd;
    subject to {
        sqrtd^2 >= d1 + d2 + d3;
        ...
    }
    

    However, this turns out to be a non-convex quadratic constraint in your case, which CPLEX cannot handle either.

    Maybe you can find another way to reformulate your model?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to use sqrt in objective function

    Posted Tue January 19, 2016 06:17 AM

    Originally posted by: ThienNguyenVN


    Thank you very much . 


    #CPLEXOptimizers
    #DecisionOptimization