Decision Optimization

Decision Optimization

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


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

Decision variables with two decimal places

  • 1.  Decision variables with two decimal places

    Posted 07/26/17 01:58 AM

    Originally posted by: sandeepsinghchauhan


    Is it possible to get all decision variables with two decimal places only. Please help Its urgent


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Decision variables with two decimal places

    Posted 07/26/17 03:18 AM

    Hi,

    yes you may get decimal numbers by dividing integer variables.

    See

    float sqrt2=sqrt(2);

    dvar float f;
    dvar int i;

    execute
    {
    writeln("square root of 2 = ",sqrt2);
    }

    minimize abs(f-sqrt2);


    subject to
    {
    f==i/100;
    }

    execute
    {
    writeln("square root of 2 with 2 decimals only = ",f);
    }

    which gives

    square root of 2 = 1.414213562

    square root of 2 with 2 decimals only = 1.41

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer