Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

paint company schedule

  • 1.  paint company schedule

    Posted Sat November 07, 2015 03:52 PM

    Originally posted by: errors100


    For a task I have to make a schedule for a paint company and determine which color to paint on which machine. There are 2 machines with different setup times. The schedule is based on TSP, where we have to make each color and the 'distance' between colors is equal to the setuptime. We have to produce enough such that production plus inventory is larger or equal than demand. The schedule is for 20 days (but we created 1 dummy start and 1 dummy end event) so that's the last constraint. The code is in Dutch, but I think it is also understandable in English. If something is not clear, please ask. As result, I receive 'no value' for the decision variables and I really don't see what the problem is. Can somebody help me please? Thanks in advance!


     *********************************************/
    int NR_Producten=...;
    int NR_Vorige=...;
    int NR_Dagen=...;

    range producten=1..NR_Producten;
    range vorige=1..NR_Vorige;
    //range dagen=1..NR_Dagen;

    float vraag[producten]=...;
    float voorraadkost[producten]=...;
    float beginvoorraad[producten]=...;
    float productie1[producten]=...;
    float productiekost1[producten]=...;
    float setup1[vorige,producten]=...;
    float productie2[producten]=...;
    float productiekost2[producten]=...;
    float setup2[vorige,producten]=...;
    float setupkost1=...;
    float setupkost2=...;

    dvar float+ voorraad[producten];
    dvar boolean z1[vorige,producten];
    dvar boolean z2[vorige,producten];

    minimize
      sum(j in producten)
        sum(i in vorige)
          (productiekost1[j]*productie1[j]*z1[i,j]+productiekost2[j]*productie2[j]*z2[i,j]
          +setup1[i,j]*setupkost1*z1[i,j]+setup2[i,j]*setupkost2*z2[i,j]
          +voorraad[j]*voorraadkost[j]);
    subject to

      //voldoen aan de vraag//
      forall (j in producten) sum(i in vorige) (productie1[j]*z1[i,j]+productie2[j]*z2[i,j]+beginvoorraad[j])>=vraag[j];
      //voorraad//
      forall (j in producten) (voorraad[j]== sum(i in vorige)(beginvoorraad[j]+productie1[j]*z1[i,j]+productie2[j]*z2[i,j]-vraag[j])); //vorige van 1e product is dummy start, volgende van laatste product is dummy end//
      (z1[12,1]+z1[12,2]+z1[12,3]+z1[12,4]+z1[12,5]+z1[12,6]+z1[12,7]+z1[12,8]+z1[12,9]+z1[12,10]+z1[12,11])==1;//1volger vanuit dummy start//
      (z2[12,1]+z2[12,2]+z2[12,3]+z2[12,4]+z2[12,5]+z2[12,6]+z2[12,7]+z2[12,8]+z2[12,9]+z2[12,10]+z2[12,11])==1;
      //1voorganger voor dummy end//
      (z1[1,12]+z1[2,12]+z1[3,12]+z1[4,12]+z1[5,12]+z1[6,12]+z1[7,12]+z1[8,12]+z1[9,12]+z1[10,12]+z1[11,12])==1;
      (z2[1,12]+z2[2,12]+z2[3,12]+z2[4,12]+z2[5,12]+z2[6,12]+z2[7,12]+z2[8,12]+z2[9,12]+z2[10,12]+z2[11,12])==1;
      //iedere kleur heeft exact 1 voorganger en 1 volger//
      (z1[1,2]+z1[1,3]+z1[1,4]+z1[1,5]+z1[1,6]+z1[1,7]+z1[1,8]+z1[1,9]+z1[1,10]+z1[1,11])==1;
      (z2[1,2]+z2[1,3]+z2[1,4]+z2[1,5]+z2[1,6]+z2[1,7]+z2[1,8]+z2[1,9]+z2[1,10]+z2[1,11])==1;
      
      (z1[2,1]+z1[2,3]+z1[2,4]+z1[2,5]+z1[2,6]+z1[2,7]+z1[2,8]+z1[2,9]+z1[2,10]+z1[2,11])==1;
      (z2[2,1]+z2[2,3]+z2[2,4]+z2[2,5]+z2[2,6]+z2[2,7]+z2[2,8]+z2[2,9]+z2[2,10]+z2[2,11])==1;
      
      (z1[3,1]+z1[3,2]+z1[3,4]+z1[3,5]+z1[3,6]+z1[3,7]+z1[3,8]+z1[3,9]+z1[3,10]+z1[3,11])==1;
      (z2[3,1]+z2[3,2]+z2[3,4]+z2[3,5]+z2[3,6]+z2[3,7]+z2[3,8]+z2[3,9]+z2[3,10]+z2[3,11])==1;
        
      (z1[4,1]+z1[4,2]+z1[4,3]+z1[4,5]+z1[4,6]+z1[4,7]+z1[4,8]+z1[4,9]+z1[4,10]+z1[4,11])==1;
      (z2[4,1]+z2[4,2]+z2[4,3]+z2[4,5]+z2[4,6]+z2[4,7]+z2[4,8]+z2[4,9]+z2[4,10]+z2[4,11])==1;
        
      (z1[5,1]+z1[5,2]+z1[5,3]+z1[5,4]+z1[5,6]+z1[5,7]+z1[5,8]+z1[5,9]+z1[5,10]+z1[5,11])==1;
      (z2[5,1]+z2[5,2]+z2[5,3]+z2[5,4]+z2[5,6]+z2[5,7]+z2[5,8]+z2[5,9]+z2[5,10]+z2[5,11])==1;
        
      (z1[6,1]+z1[6,2]+z1[6,3]+z1[6,4]+z1[6,5]+z1[6,7]+z1[6,8]+z1[6,9]+z1[6,10]+z1[6,11])==1;
      (z2[6,1]+z2[6,2]+z2[6,3]+z2[6,4]+z2[6,5]+z2[6,7]+z2[6,8]+z2[6,9]+z2[6,10]+z2[6,11])==1;
        
      (z1[7,1]+z1[7,2]+z1[7,3]+z1[7,4]+z1[7,5]+z1[7,6]+z1[7,8]+z1[7,9]+z1[7,10]+z1[7,11])==1;
      (z2[7,1]+z2[7,2]+z2[7,3]+z2[7,4]+z2[7,5]+z2[7,6]+z2[7,8]+z2[7,9]+z2[7,10]+z2[7,11])==1;
        
      (z1[8,1]+z1[8,2]+z1[8,3]+z1[8,4]+z1[8,5]+z1[8,6]+z1[8,7]+z1[8,9]+z1[8,10]+z1[8,11])==1;
      (z2[8,1]+z2[8,2]+z2[8,3]+z2[8,4]+z2[8,5]+z2[8,6]+z2[8,7]+z2[8,9]+z2[8,10]+z2[8,11])==1;
        
      (z1[9,1]+z1[9,2]+z1[9,3]+z1[9,4]+z1[9,5]+z1[9,6]+z1[9,7]+z1[9,8]+z1[9,10]+z1[9,11])==1;
      (z2[9,1]+z2[9,2]+z2[9,3]+z2[9,4]+z2[9,5]+z2[9,6]+z2[9,7]+z2[9,8]+z2[9,10]+z2[9,11])==1;
        
      (z1[10,1]+z1[10,2]+z1[10,3]+z1[10,4]+z1[10,5]+z1[10,6]+z1[10,7]+z1[10,8]+z1[10,9]+z1[10,11])==1;
      (z2[10,1]+z2[10,2]+z2[10,3]+z2[10,4]+z2[10,5]+z2[10,6]+z2[10,7]+z2[10,8]+z2[10,9]+z2[10,11])==1;
        
      (z1[11,1]+z1[11,2]+z1[11,3]+z1[11,4]+z1[11,5]+z1[11,6]+z1[11,7]+z1[11,8]+z1[11,9]+z1[11,10])==1;
      (z2[11,1]+z2[11,2]+z2[11,3]+z2[11,4]+z2[11,5]+z2[11,6]+z2[11,7]+z2[11,8]+z2[11,9]+z2[11,10])==1;
      
      
      
      
      (z1[2,1]+z1[3,1]+z1[4,1]+z1[5,1]+z1[6,1]+z1[7,1]+z1[8,1]+z1[9,1]+z1[10,1]+z1[11,1])==1;
      (z2[2,1]+z2[3,1]+z2[4,1]+z2[5,1]+z2[6,1]+z2[7,1]+z2[8,1]+z2[9,1]+z2[10,1]+z2[11,1])==1;
      
      (z1[1,2]+z1[3,2]+z1[4,2]+z1[5,2]+z1[6,2]+z1[7,2]+z1[8,2]+z1[9,2]+z1[10,2]+z1[11,2])==1;
      (z2[1,2]+z2[3,2]+z2[4,2]+z2[5,2]+z2[6,2]+z2[7,2]+z2[8,2]+z2[9,2]+z2[10,2]+z2[11,2])==1;
      
      (z1[1,3]+z1[2,3]+z1[4,3]+z1[5,3]+z1[6,3]+z1[7,3]+z1[8,3]+z1[9,3]+z1[10,3]+z1[11,3])==1;
      (z2[1,3]+z2[2,3]+z2[4,3]+z2[5,3]+z2[6,3]+z2[7,3]+z2[8,3]+z2[9,3]+z2[10,3]+z2[11,3])==1;
      
      (z1[1,4]+z1[2,4]+z1[3,4]+z1[5,4]+z1[6,4]+z1[7,4]+z1[8,4]+z1[9,4]+z1[10,4]+z1[11,4])==1;
      (z2[1,4]+z2[2,4]+z2[3,4]+z2[5,4]+z2[6,4]+z2[7,4]+z2[8,4]+z2[9,4]+z2[10,4]+z2[11,4])==1;
      
      (z1[1,5]+z1[2,5]+z1[3,5]+z1[4,5]+z1[6,5]+z1[7,5]+z1[8,5]+z1[9,5]+z1[10,5]+z1[11,5])==1;
      (z2[1,5]+z2[2,5]+z2[3,5]+z2[4,5]+z2[6,5]+z2[7,5]+z2[8,5]+z2[9,5]+z2[10,5]+z2[11,5])==1;
      
      (z1[1,6]+z1[2,6]+z1[3,6]+z1[4,6]+z1[5,6]+z1[7,6]+z1[8,6]+z1[9,6]+z1[10,6]+z1[11,6])==1;
      (z2[1,6]+z2[2,6]+z2[3,6]+z2[4,6]+z2[5,6]+z2[7,6]+z2[8,6]+z2[9,6]+z2[10,6]+z2[11,6])==1;
      
      (z1[1,7]+z1[2,7]+z1[3,7]+z1[4,7]+z1[5,7]+z1[6,7]+z1[8,7]+z1[9,7]+z1[10,7]+z1[11,7])==1;
      (z2[1,7]+z2[2,7]+z2[3,7]+z2[4,7]+z2[5,7]+z2[6,7]+z2[8,7]+z2[9,7]+z2[10,7]+z2[11,7])==1;
      
      (z1[1,8]+z1[2,8]+z1[3,8]+z1[4,8]+z1[5,8]+z1[6,8]+z1[7,8]+z1[9,8]+z1[10,8]+z1[11,8])==1;
      (z2[1,8]+z2[2,8]+z2[3,8]+z2[4,8]+z2[5,8]+z2[6,8]+z2[7,8]+z2[9,8]+z2[10,8]+z2[11,8])==1;
      
      (z1[1,9]+z1[2,9]+z1[3,9]+z1[4,9]+z1[5,9]+z1[6,9]+z1[7,9]+z1[8,9]+z1[10,9]+z1[11,9])==1;
      (z2[1,9]+z2[2,9]+z2[3,9]+z2[4,9]+z2[5,9]+z2[6,9]+z2[7,9]+z2[8,9]+z2[10,9]+z2[11,9])==1;
      
      (z1[1,10]+z1[2,10]+z1[3,10]+z1[4,10]+z1[5,10]+z1[6,10]+z1[7,10]+z1[8,10]+z1[9,10]+z1[11,10])==1;
      (z2[1,10]+z2[2,10]+z2[3,10]+z2[4,10]+z2[5,10]+z2[6,10]+z2[7,10]+z2[8,10]+z2[9,10]+z2[11,10])==1;
      
      (z1[1,11]+z1[2,11]+z1[3,11]+z1[4,11]+z1[5,11]+z1[6,11]+z1[7,11]+z1[8,11]+z1[9,11]+z1[10,11])==1;
      (z2[1,11]+z2[2,11]+z2[3,11]+z2[4,11]+z2[5,11]+z2[6,11]+z2[7,11]+z2[8,11]+z2[9,11]+z2[10,11])==1;
      
      //setuptijd van voorganger en volger+1dag als product j geproduceerd wordt+1dag als j 2 keer na elkaar geproduceerd wordt<=20 dagen//
      sum(i in vorige) sum(j in producten)(setup1[i,j]*z1[i,j]+z1[i,j])<=22;
      sum(i in vorige) sum(j in producten) (setup2[i,j]*z2[i,j]+z2[i,j])<=22;
    }


    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: paint company schedule

    Posted Mon November 09, 2015 04:02 AM

    Originally posted by: PhilippeLaborie


    Hello,

    It seems that your model is a CPLEX model solved by the CPLEX engine so I suggest you post your question on a CPLEX forum: https://www.ibm.com/developerworks/community/forums/html/forum?id=11111111-0000-0000-0000-000000002053

    You probably should look at the log of the CPLEX search engine; maybe your model is infeasible and in this case, the conflict refiner functionality should help you to identify the conflicting constraints in your model.

    This being said, the description of your problem suggests that it could also be interesting to try a CP Optimizer model to solve it. You could model your painting activities as 'interval variables' and your sequence dependent setup times between colors as 'transition distance' between consecutive activities on your machines (machines would be modeled as 'sequence variables'). If you are interested in exploring this type of alternative model, you can have a look at the distributed OPL example 'sched_setup'.

    Philippe

     


    #ConstraintProgramming-General
    #DecisionOptimization