Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

CPLEX: Model takes too much time to execute

  • 1.  CPLEX: Model takes too much time to execute

    Posted 10/05/17 08:33 AM

    Originally posted by: Catarina Anjos


    Hi everyone,

     

    I'm currently try to obtain some solutions from the model that i've create, but if i use dvar float+ the model takes 4 secs to run and give me the solutions. If i use dvar int+, it takes, at least, 11 hours, because i'm running it right now and that's how long he's working.

     

    Anyone can please let me know if there's a way to optimize the model with the integer solutions?

     

    I will paste my model in here.

    //ranges
    
    range S = 1..3;
    range T = 1..20;
    range K = 1..4;
    
    //parameters
    float Ce[S]= ...;
    float Ci[S]= ...;
    float Cj[S]= ...;
    
    float De[S][T]= ...;
    float D[S][T]= ...;
    
    float p = ...; //Rácio de trabalhadores internos (tipo i+e) para trabalhadores externos (tipo j)
    float g = ...; //Balanceamento entre os turnos s dos trabalhadores do tipo j
    
    
    //variables
    
    dvar int+ xe[S][T];
    dvar int+ xi[S][T];
    dvar int+ xj[S][T];
    dvar int+ Ae[S][K];
    dvar int+ A[S][K];
    dvar int+ Be[S][T];
    dvar int+ Bi[S][T];
    dvar int+ Bj[S][T];
    
    /*
    dvar float+ xe[S][T];
    dvar float+ xi[S][T];
    dvar float+ xj[S][T];
    dvar float+ Ae[S][K];
    dvar float+ A[S][K];
    dvar float+ Be[S][T];
    dvar float+ Bi[S][T];
    dvar float+ Bj[S][T];
    */
    //model
    
    minimize 
            sum(s in S, t in T)  (Ce[s] * xe[s][t] + Ci[s] * xi[s][t] + Cj[s] * xj[s][t]);
    subject to
            {
            //Constraint 1 - Garante que as necessidades são satisfeitas
    forall(s in S, t in T)
            xe[s][t] >= De[s][t];
    
            //Constraint 2 - Garante que as necessidades são satisfeitas
    forall(s in S, t in T)
            xe[s][t] + xi[s][t] + xj[s][t] >= De[s][t] + D[s][t];
            
            //Constraint 3 - Garante que o nº de trabalhadores contratados é constante em cada semana
    forall(s in S, t in T)  
            xe[s][t]+ Be[s][t] == sum( k in K :k == ftoi(round(t/5-0.51)+1))Ae[s][k];
            
            //Constraint 4 - Garante que o nº de trabalhadores contratados é constante em cada semana
    forall(s in S, t in T)
            xe[s][t] + xi[s][t] + xj[s][t] + Be[s][t] + Bi[s][t] + Bj[s][t] == sum( k in K :k == ftoi(round(t/5-0.51)+1))(Ae[s][k] + A[s][k]);
            
            //Constraint 5 - Garante que o nº de trabalhadres é pelo menos p% do total
    forall( t in T)
            sum(s in S) (xe[s][t]+xi[s][t]) >= p * sum(s in S) (xe[s][t] + xi[s][t] + xj[s][t]);
            
            //Constraint 6 - O nº de presenças em cada turno não difere mais do que g
    forall(s in S)
            sum(t in T) xi[s][t] >= (g * sum(s in S,t in T) xi[s][t]) / 3;
            
            //Constraint 7 - O nº de presenças em cada turno não difere mais do que g
    forall(s in S)
            sum(t in T) xj[s][t] >= (g * sum(s in S,t in T) xj[s][t]) / 3;
            
            //Constraint 8 - garante que o nº de férias não excede o permitido
            sum(s in S,t in T) Be[s][t] <= (sum(s in S,t in T) xe[s][t]) / 10;
            
            //Constraint 9 - garante que o nº de férias não excede o permitido
            sum(s in S,t in T) Bi[s][t] <= (sum(s in S,t in T) xi[s][t]) / 10;
              
            //Constraint 10 - garante que o nº de férias não excede o permitido
            sum(s in S,t in T) Bj[s][t] <= (sum(s in S,t in T) xj[s][t]) / 10;
    }
    

    Many thanks in advanace.

    Catarina. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: CPLEX: Model takes too much time to execute

    Posted 10/06/17 09:07 PM

    Originally posted by: EdKlotz


    Troubleshooting performance problems is difficult with just the model description.   Please post the CPLEX node log of the problematic run.   You also might want to export a SAV file of the model from OPL and post that as well.   Also, here are a couple of resources for improving MIP performance.

     

    http://www-01.ibm.com/support/docview.wss?uid=swg21400023

    https://www.slideshare.net/IBMOptimization/2013-11-informsminingthenodelog


    #CPLEXOptimizers
    #DecisionOptimization