Decision Optimization

 View Only
  • 1.  Trying to solve bound tightening algorithm

    Posted Thu June 25, 2020 02:26 PM
    Attachment 1 is the algorithm that I am trying to solve.
    Attachment 2 and 3 contain the problem (McCormick relaxation is applied to linearized the product of continuous variables)
    4th is the initial feasible solution
    5th is the result of bounds improvement
    I am trying to reproduce the results.
    I am having issues.
    I don't know how to provide initial solution to cplex particularly in this case and also how to add a constraint that x has to be between bounds provided in the iteration.
    following is the code.
    I will be thankful if you can help


    float l1 = ...;
    float l2 = ...;
    float l3 = ...;

    float u1 = ...;
    float u2 = ...;
    float u3 =...;

    float zf = 967.5207101;

    dvar float x1;
    dvar float x2;
    dvar float x3;

    dvar float w11;
    dvar float w22;
    dvar float w33;
    dvar float w12;
    dvar float w13;


    minimize
    x1;



    subject to{

    1000- w11 - 2*w22 - w33 - w12 - w13 <= zf;

    8*x1 +14*x2 +7*x3 == 56;
    w11 + w22 + w33 == 25;

    w11 >= - u1*u1 + 2*u1*x1;
    w11 >= - l1*l1 + 2*l1*x1;
    w11 <= - u1*l1 + 5*x1 + l1*x1;

    w22 >= - u2*u2 + 2*u2*x2;
    w22 >= - l2*l2 + 2*l2*x2;
    w22 <= - u2*l2 + 4*x2 + l2*x2;

    w33 >= - u3*u3 + 2*u3*x3;
    w33 >= -l3*l3 + 2*l3*x3;
    w33 <= - u3*l3 + 5*x3 + l3*x3;

    w12 >= - u1*u2 + u2*x1 + u1*x2;
    w12 >= - l1*l2 + l2*x1 + l1*x2;
    w12 <= - u1*l2 + l2*x1 + u1*x2;
    w12 <= - l1*u2 + u2*x1 + l1*x2;

    w13 >= - u1*u3 + u3*x1 + u1*x3;
    w13 >= - l1*l3 + l3*x1 + l1*x3;
    w13 <= - u1*l3 + l3*x1 + u1*x3;
    w13 <= - l1*u3 + u3*x1 + l1*x3;

    x1 >= l1;
    x2 >= l2;
    x3 >= l3;

    x1 <= u1;
    x2 <= u2;
    x3 <= u3;


    }


    main {
    thisOplModel.generate();
    var produce = thisOplModel;

    var L1 = produce.l1;

    var tol = 0.0001;

    var xl1iter = 0;

    while (1){

    xl1iter = L1;
    writeln("Solve with L1 = ",L1);

    if ( cplex.solve() ) {


    xl1iter = cplex.getObjValue();
    writeln();

    writeln("OBJECTIVE: ",xl1iter);
    }
    else {
    writeln("No Sloution");
    break;

    }

    if ((Opl.abs(L1 - xl1iter)) < tol) break;

    L1 = xl1iter;

         }
    }

    ------------------------------
    Tooba Binte Asif
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Trying to solve bound tightening algorithm

    Posted Fri June 26, 2020 12:23 AM
    Did you look at the various examples that ship with CPLEX? There are examples for how to solve models iteratively and how to specify an initial solution. Look for example at the warmstart.mod example for starting solutions. For the other aspect look for .mod files that contain a 'main' block with a loop.

    ------------------------------
    Daniel Junglas
    ------------------------------



  • 3.  RE: Trying to solve bound tightening algorithm

    Posted Thu July 09, 2020 06:14 AM

    Yeah

    I have tried but not succeeded.

    Can you help me write the code for this algorithm?



    ------------------------------
    Tooba Binte Asif
    ------------------------------



  • 4.  RE: Trying to solve bound tightening algorithm

    Posted Thu July 09, 2020 07:25 AM
    Hi,

    you may also rely on 

    How to multiply two float decision variables ?

    in

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

    and then you can skip the flow control part

    regards

    ------------------------------
    ALEX FLEISCHER
    ------------------------------