Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

abs function not working

  • 1.  abs function not working

    Posted 08/18/17 02:32 AM

    Originally posted by: ShaCplex


    Dear sir,

    Here is a piece of code;

    execute {
    var d1=new Date("08/11/2017 15:25:00")
    var d2=new Date("08/12/2017 16:00:00")


    var d3=(d2.getDate()-d1.getDate())*24*60
    +(d2.getHours()-d1.getHours())*60+
    (d2.getMinutes()-d1.getMinutes())

     var d4=  abs((d1.getDate() - d2.getDate()))

    writeln(d3)
    writeln(d4)
    }

     

    I am getting an error in the highlighted part saying abs does not exist in OPL model. Here my intention is to find out the absalute difference..how to achieve that?

    Please help.

     

     

     

    Regards,

    shahul


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: abs function not working

    Posted 08/18/17 06:30 AM

    Hi

    you should try

    Opl.abs(

    instead of

    abs(

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: abs function not working

    Posted 08/18/17 06:47 AM

    Originally posted by: ShaCplex


    oh....I got it!

     

     

    Thank you very much...


    #DecisionOptimization
    #OPLusingCPLEXOptimizer