Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  CPLEX OPL Error 5002 Error

    Posted 05/13/18 06:26 AM

    Originally posted by: AyberkOkten


    Hello everyone. I started writing this OPL code but I keep getting that 5002 error. I tried way to hard to solve it but nothing really worked for me. Are there anyone that can help me with this. I need to submit my project on Monday.

     

     

     

    range operation=1..8;

    range machine=1..2;
    range tool=1..10;


    dvar boolean y[operation,machine];
    dvar boolean x[operation,tool];
    dvar boolean w1;
    dvar boolean w2;
    dvar boolean w3;

    float coef1[operation,machine]=[[133,133],
                                    [71,71],
                                    [42,42],
                                    [83,83],
                                    [91,91],
                                    [63,63],
                                    [108,108],
                                    [125,125]];
    float coef2[operation,machine]=[[60,60],
                                    [252,252],
                                    [302,302],
                                    [79,79],
                                    [500,500],
                                    [440,440],
                                    [445,445],
                                    [151,151]];
    float coef3[operation,machine]=[[4,4],
                                    [4,4],
                                    [4,4],
                                    [6,6],
                                    [6,6],
                                    [6,6],
                                    [4,4],
                                    [6,6]];


    maximize sum(i in operation,j in machine) y[i,j]*coef1[i,j];

     

    subject to
    {
    sum(i in operation,j in machine) y[i,1]*coef2[i,1]<=384;
    sum(i in operation,j in machine) y[i,2]*coef2[i,2]<=492;

    y[1,1]+y[1,2]==x[1,1]*x[1,7];
    y[2,1]+y[2,2]==x[2,1]*x[2,4];
    y[3,1]+y[3,2]==x[3,5]*x[3,8];
    y[4,1]+y[4,2]==w1; //x[4,1]*x[4,2]*x[4,6]
    y[5,1]+y[5,2]==x[5,3]*x[5,8];
    y[6,1]+y[6,2]==w2; //x[6,3]*x[6,5]*x[6,8]
    y[7,1]+y[7,2]==x[7,2]*x[7,4];
    y[8,1]+y[8,2]==w3; //x[8,7]*x[8,8]*x[8,9]

    w1<=x[4,1];
    w1<=x[4,2];
    w1<=x[4,6];
    w1>=x[4,1]+x[4,2]+x[4,6]-2;

    w2<=x[6,3];
    w2<=x[6,5];
    w2<=x[6,8];
    w2>=x[6,3]+x[6,5]+x[6,8]-2;

    w3<=x[8,7];
    w3<=x[8,8];
    w3<=x[8,9];
    w3>=x[8,7]+x[8,8]+x[8,9]-2;


    x[1,1]+x[2,1]+x[4,1]<=2;
    x[4,2]+x[7,2]<=1;
    x[6,3]<=1;
    x[2,4]+x[7,4]<=2;
    x[3,5]+x[5,5]+x[6,5]<=2;
    x[4,6]<=2;
    x[1,7]+x[8,7]<=1;
    x[3,8]+x[6,8]+x[8,8]<=2;
    x[8,9]<=1;
    x[5,10]<=1;

    y[1,1]+y[1,2]<=1;
    y[2,1]+y[2,2]<=1;
    y[3,1]+y[3,2]<=1;
    y[4,1]+y[4,2]<=1;
    y[5,1]+y[5,2]<=1;
    y[6,1]+y[6,2]<=1;
    y[7,1]+y[7,2]<=1;
    y[8,1]+y[8,2]<=1;

    sum (i in operation,j in machine) y[i,1]*coef3[i,j]<=6;
    sum (i in operation,j in machine) y[i,2]*coef3[i,j]<=6;
    }


     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: CPLEX OPL Error 5002 Error

    Posted 05/13/18 06:57 AM

    Hi,

    you could write

    using CP;

    at the beginning and use CPO. This works fine.

    or you could linearize your quadratic expressions.

    regards

    https://www.linkedin.com/pulse/optimizasyon-nedir-ve-daha-az%25C4%25B1yla-fazla-%25C5%259Fey-yapman%25C4%25B1za-alex-fleischer/


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: CPLEX OPL Error 5002 Error

    Posted 05/13/18 07:12 AM

    Originally posted by: AyberkOkten


    I tried to write "using; CP" but it produced a 0E0 solution. Any other possibility ?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: CPLEX OPL Error 5002 Error

    Posted 05/13/18 12:42 PM

    Hi

    then if you want to use Linear Programming you could have a look at https://www.ibm.com/developerworks/community/forums/html/threadTopic?id=aa9aa3db-4fbc-4209-a767-5b5e54902cbd&ps=25

    within https://www.linkedin.com/pulse/how-opl-alex-fleischer/

    And then your model will look like

    range operation=1..8;

    range machine=1..2;
    range tool=1..10;


    dvar boolean y[operation,machine];
    dvar boolean x[operation,tool];
    dvar boolean w1;
    dvar boolean w2;
    dvar boolean w3;

    float coef1[operation,machine]=[[133,133],
                                    [71,71],
                                    [42,42],
                                    [83,83],
                                    [91,91],
                                    [63,63],
                                    [108,108],
                                    [125,125]];
    float coef2[operation,machine]=[[60,60],
                                    [252,252],
                                    [302,302],
                                    [79,79],
                                    [500,500],
                                    [440,440],
                                    [445,445],
                                    [151,151]];
    float coef3[operation,machine]=[[4,4],
                                    [4,4],
                                    [4,4],
                                    [6,6],
                                    [6,6],
                                    [6,6],
                                    [4,4],
                                    [6,6]];


    maximize sum(i in operation,j in machine) y[i,j]*coef1[i,j];

     

    subject to
    {
    sum(i in operation,j in machine) y[i,1]*coef2[i,1]<=384;
    sum(i in operation,j in machine) y[i,2]*coef2[i,2]<=492;

    y[1,1]+y[1,2]==(x[1,1]==1) && (x[1,7]==1);
    y[2,1]+y[2,2]==(x[2,1]==1) && (x[2,4]==1);
    y[3,1]+y[3,2]==(x[3,5]==1)&&(x[3,8]==1);
    y[4,1]+y[4,2]==w1; //x[4,1]*x[4,2]*x[4,6]
    y[5,1]+y[5,2]==(x[5,3]==1) && (x[5,8]==1);
    y[6,1]+y[6,2]==w2; //x[6,3]*x[6,5]*x[6,8]
    y[7,1]+y[7,2]==(x[7,2]==1) && (x[7,4]==1);
    y[8,1]+y[8,2]==w3; //x[8,7]*x[8,8]*x[8,9]

    w1<=x[4,1];
    w1<=x[4,2];
    w1<=x[4,6];
    w1>=x[4,1]+x[4,2]+x[4,6]-2;

    w2<=x[6,3];
    w2<=x[6,5];
    w2<=x[6,8];
    w2>=x[6,3]+x[6,5]+x[6,8]-2;

    w3<=x[8,7];
    w3<=x[8,8];
    w3<=x[8,9];
    w3>=x[8,7]+x[8,8]+x[8,9]-2;


    x[1,1]+x[2,1]+x[4,1]<=2;
    x[4,2]+x[7,2]<=1;
    x[6,3]<=1;
    x[2,4]+x[7,4]<=2;
    x[3,5]+x[5,5]+x[6,5]<=2;
    x[4,6]<=2;
    x[1,7]+x[8,7]<=1;
    x[3,8]+x[6,8]+x[8,8]<=2;
    x[8,9]<=1;
    x[5,10]<=1;

    y[1,1]+y[1,2]<=1;
    y[2,1]+y[2,2]<=1;
    y[3,1]+y[3,2]<=1;
    y[4,1]+y[4,2]<=1;
    y[5,1]+y[5,2]<=1;
    y[6,1]+y[6,2]<=1;
    y[7,1]+y[7,2]<=1;
    y[8,1]+y[8,2]<=1;

    sum (i in operation,j in machine) y[i,1]*coef3[i,j]<=6;
    sum (i in operation,j in machine) y[i,2]*coef3[i,j]<=6;
    }

     

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer