Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Warm Start Cplex

    Posted Sun May 14, 2017 07:03 AM

    Originally posted by: belengarciamar


    Hello all,

    I am having some problems with my model. It's taking more than 9 hours to be solved, so I am trying to find out how to use the Warm Start in Cplex. I can only find the user manual but with no mathematical examples, only the code. This code uses arrays but my model doesn't have any array.

    Can someone help me?

     

    Thank you so much.

    -Belén


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Warm Start Cplex

    Posted Sun May 14, 2017 03:32 PM

    If you are using one of the programming APIs (you did not say which, if any), just create a vector of variables (IloNumVar[] in Java, for instance) with dimension big enough to hold all your variables, then use loops to stick all your variables into the vector (in any order you like). Create a double precision vector of the same length for the values, and load that with the variable values for your warm start (in the same order that you used when loading the variable vector).


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Warm Start Cplex

    Posted Mon May 15, 2017 11:25 AM

    Originally posted by: belengarciamar


    So, lets say this is my model with my data:

    {string} MP=...;
    {string} PT=...;
    {string} PT0= PT union {"0"};
    {string} MP0= MP union {"0"};

    // parameters

    int Composition[MP,PT]=...;
    int N=...;
    int M=...;

    //N and M same number of MP and PT

    // decission variables

    dvar boolean alpha[PT0,PT0];

    dvar boolean beta [MP0,MP0,PT0,PT0];

    dvar int u[PT0];
    dvar int v[MP0,PT0];


    // objective function

    minimize sum (i in MP, j in MP: j!=i, p in PT, t in PT) beta[i,j,p,t];

    // constraints

    subject to{
        c01:
        forall (t in PT)
          sum (p in PT0: p!=t) (alpha[p,t])<=1;
          
        c02:
        forall (p in PT, t in PT: t!=p)
          sum (i in MP:Composition[i,p]==1 , j in MP: Composition[j,t]==1) beta[i,j,p,t]==alpha[p,t];
          
        c03:
        forall (t in PT, j in MP: Composition[j,t]==1)
          beta["0",j,"0",t] + (sum (i in MP: Composition[i,t]==1) beta[i,j,t,t])+ (sum (p in PT: p!=t, i in MP: Composition[i,p]==1) beta[i,j,p,t])==1;
        
        c05:
        sum(p in PT)alpha["0",p]==1;
        
        c06:
        sum(t in PT, j in MP: Composition[j,t]==1) beta ["0",j,"0",t]==1;
        
        c07:
        forall ( p in PT, i in MP: Composition [i,p]==1)
         sum(t in PT, j in MP: Composition [j,t]==1) beta[i,j,p,t]<=1;
        
        c08:
        forall (t in PT)
          sum (j in MP: Composition[j,t]==1) beta ["0",j,"0",t] + sum (p in PT: p!=t, i in MP: Composition[i,p]==1, j in MP: Composition[j,t]==1) beta[i,j,p,t]==1;
          
        c09:
        forall (p in PT)
         sum ( i in MP: Composition [i,p]==1, t in PT: t!=p, j in MP: Composition [j,t]==1) beta [i,j,p,t]<=1;

        c10:
        forall (p in PT, t in PT, i in MP: Composition[i,p]==1, j in MP: Composition [j,t]==1)
          beta[i,j,p,t]+ beta [j,i,t,p]<=1;
          
        c11:
        u["0"]==0;
        v["0","0"]==0;
        
        c12:
        forall(t in PT)
          u[t]<=N;
         forall (j in MP, t in PT)
          v[j,t]<=M;
          
          
        c13:
        
        forall(p in PT0, t in PT: p!=t)
            u[t]>=u[p]+1-N*(1-alpha[p,t]);
          
        forall (p in PT0, t in PT,i in MP: Composition[i,p]==1, j in MP: Composition[j,t]==1)
          v[j,t]>=v[i,p]+1-M*(1-beta[i,j,p,t]);


    // data file

    MP={"A"    "B""E""M" "N" "O" "P" };
    PT={"1"    "2""3" "4" "5" "6" "7" "8" };
    N=15;
    M=8;

    Composition=[
                [0    0    0    0    1    1    1    1],
                [1    1    1    1    1    1    1    1],
                [0    0    0    0    1    1    1    1],
                [0    0    0    0    1    1    1    1],
                [1    1    1    1    1    1    1    1],
                [1    1    1    1    1    1    1    1],
                [1    1    1    1    0    0    0    0],
                 ];
               

    What do I have to do now? I am using CPLEX for 2 months and this is really high level for me... I really need to solve my model because it's a projetc forthe university...

     

    Thank you so much.

     

    Regards,

     

    Belén


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Warm Start Cplex

    Posted Thu May 18, 2017 02:39 AM

    There is an example that uses warmstart in OPL: opl/examples/opl/warmstart/warmstart.mod.

    Can you please take a look at this and see if it answers your questions? If not, please come back here.


    #CPLEXOptimizers
    #DecisionOptimization