Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Create ranges

    Posted 03/11/16 12:45 AM

    Originally posted by: sandeepsinghchauhan


    range C = 1..100;

    range D = 1..60;

    int E[C][D];

    execute {
        for (var m in C) {
            for (var n in D) {

    E[m][d]= (doing some multiplication and division)

    }

    }

    }

    and getting

    E = [16,3,5,7,98,1,5,411,5,68];

    now with the help of E i want to create ranges

    range K = 1..E[C][D]

    showing error K is not in opl project

     

    Actually i want to make range

    range K = [1..E(1),

                      1..E(2),

                      1.E(3),

                       .

                       .

                       .];

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Create ranges

    Posted 03/11/16 01:30 AM

    Hi,

    do you want K to be a range or an array of range ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Create ranges

    Posted 03/11/16 01:38 AM

    Originally posted by: sandeepsinghchauhan


    K to be range

    when C= 1, D = 1

    range K = 1..E(1);

    when C = 1,D = 2

    range K = 1..E(2);

    .

    .

    This way it change in a loop


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Create ranges

    Posted 03/11/16 04:57 AM

    Hi,

    what about something like

    range C = 1..100;

    range D = 1..60;

    int E[c in C][d in D]=c*45+d;

    int KMin[c in C][d in D]=1;
    int KMax[c in C][d in D]=E[c][d];

    execute
    {
    writeln(KMin,KMax);
    }

    ?

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Create ranges

    Posted 03/11/16 06:58 AM

    Originally posted by: sandeepsinghchauhan


    I want to create ranges that each start with 1 and ends with E value like

    1..E(1)

    1..E(2)

    .

    .

    .

    .

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Create ranges

    Posted 03/11/16 07:05 AM

    Hi,

    but in OPL you cannot have array of ranges so that is why I suggested 2 arrays with the lower and upper bounds.

    Or you may try arrays of sets like:

    range C = 1..10;

    range D = 1..60;

    int E[c in C][d in D]=c*45+d;

    int KMin[c in C][d in D]=1;
    int KMax[c in C][d in D]=E[c][d];

    {int} K[c in C][d in D]=asSet(KMin[c][d]..KMax[c][d]);

    execute
    {
    writeln(KMin,KMax,K);
    }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Create ranges

    Posted 03/11/16 07:12 AM

    Originally posted by: sandeepsinghchauhan


    This error occurring :

    range C = 1..10;

    range D = 1..60    

    int E[c in C][d in D] = opl.floor(1000/[c]);
          

    ERROR ::     


    syntax error, unexpected '(', expecting ';'   ( in opl.floor(1000/[c]);)

     

    please help

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Create ranges

    Posted 03/11/16 08:09 AM

    Originally posted by: Stanko_86


    It seems that E needs to be float instead of int:

    float E[c in C][d in D] = floor(1000/c);
    

    Also, I used only floor without Opl.floor

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: Create ranges

    Posted 03/11/16 08:16 AM

    Originally posted by: sandeepsinghchauhan


    if i am using float then

    range C = 1..10;

    range D = 1..60;

    float E[c in C][d in D]=floor (1000/c);

    float KMin[c in C][d in D]=1;
    float KMax[c in C][d in D]=E[c][d];

    {float} K[c in C][d in D]=asSet(KMin[c][d]..KMax[c][d]);

    execute
    {
    writeln(KMin,KMax,K);
    }

    error THE FUNCTION asSet (range float) does not exist


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 10.  Re: Create ranges

    Posted 03/11/16 08:24 AM

    Originally posted by: Stanko_86


    Use ftoi then:
    
    range C = 1..10;
    range D = 1..60;
    float E[c in C][d in D]=floor (1000/c);
    int KMin[c in C][d in D]=1;
    int KMax[c in C][d in D]=ftoi(E[c][d]);
    {int} K[c in C][d in D]=asSet(KMin[c][d]..KMax[c][d]);
    

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 11.  Re: Create ranges

    Posted 03/11/16 08:34 AM

    Originally posted by: sandeepsinghchauhan


    Thanks a lot     Stanko_86 and   AlexFleischer SmileSmile


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 12.  Re: Create ranges

    Posted 03/11/16 10:15 AM

    Originally posted by: sandeepsinghchauhan


    How can i convert int to float means opposite of "ftoi"


    #DecisionOptimization
    #OPLusingCPLEXOptimizer