Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  More condition to dvar variable

    Posted 01/16/17 05:42 AM

    Originally posted by: Rym


    Hi, my question is how to have a floa number ith just two number after the comma (,) in a decision variable

     

     

    Example : 

    int P=1..2;

    int D=1..3;

    dvar float R[P][D] in 0..1;

     

    The result:

    // R matrix

     [[0.95 0.95122 0.95]

     [0.95 0.95122 0.95]]

     

    I which to have : 

     

    // R matrix

     [[0.95 0.95 0.95]

     [0.95 0.95 0.95]]

     

    Thanks 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: More condition to dvar variable

    Posted 01/16/17 05:53 AM

    Hi,

    why not using integer decision variable ?

    range P=1..2;

    range D=1..3;

    int scale=100;

    float r[P][D]=[[0.95, 0.95122, 0.95],
     [0.95, 0.95122 ,0.95]] ;

    dvar int Rscale[P][D] in 0..scale;

    dexpr float R[p in P][d in D]=Rscale[p][d]/scale;

    minimize sum(p in P,d in D) abs(R[p][d]-r[p][d]) ;
    subject to
    {

    }

    execute
    {
    writeln(R);
    }
     

    gives

    [[0.95 0.95 0.95]
             [0.95 0.95 0.95]]

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer