# Decision Optimization

View Only

## setup time to this job shop scheduling model

• #### 1.  setup time to this job shop scheduling model

Posted Thu November 28, 2019 11:33 AM

Originally posted by: kcapt

Hello, a friend of mine asked me to create this post. He cannot acess this forum due to some problem related with cookies.

------------------------------------------------------------------------

using CP;

int nbMaq = ...;

range Maq = 1..nbMaq;

int nbEncomendas = ...;

range Encomendas = 1..nbEncomendas;

int Maquinas[j in Encomendas][m in Maq] = ...;

int Duracao[j in Encomendas][m in Maq] = ...;

int DataEntrega[Encomendas]=...;

int Setup[Maq][Encomendas][Encomendas]=...;

tuple triplet { int t1; int t2; int v; }

{triplet} tt[m in Maq] =   { <t1,t2,Setup[m][t1][t2]> | t1,t2 in Encomendas };

dvar interval itvs[j in Encomendas][o in Maq] size Duracao[j][o]; //criar intervalo de processamento

dvar sequence mchs[m in Maq] in all(j in Encomendas, o in Maq : Maquinas[j][o] == m && Duracao[j][o]!=0  ) itvs[j][o]; // criar sequencia de processamento

dexpr int atraso =sum(j in Encomendas) maxl(0, endOf(itvs[j][nbMaq]) - DataEntrega[j]);

minimize atraso;      // minimizar o atraso total

//minimize  (max(j in Jobs) endOf(itvs[j][nbMchs-1])); // minimizar o makespan

subject to {

forall (m in Maq) {

noOverlap(mchs[m],tt[m], 1); // garantir que a maquina só é usada por uma tarefa de cada vez

}

forall (j in Encomendas, o in 1..nbMaq-1){

endBeforeStart(itvs[j][o], itvs[j][o+1]); // garantir que a sequencia dos processos é respeitada

}  }

tuple resType { int trabalho; int maquina; int st; int end; }

{resType} res={ <j,o,startOf(itvs[j][o]), endOf(itvs[j][o]) > |j in Encomendas, o in Maq};

tuple final{ int fim ; }

{final} f={<endOf(itvs[j][nbMaq]) > |j in Encomendas};

---------------------------------------------------------------------------------------------------

Hi, i need to add the setup time to this job shop scheduling model, i follow the cp optimizer exemple, but when the problem is solved it doesn't have into acount the setup times.

Can anyone help ?

• #### 2.  Re: setup time to this job shop scheduling model

Posted Sat November 30, 2019 12:56 PM

Originally posted by: kcapt

He managed to create a post:

• #### 3.  Re: setup time to this job shop scheduling model

Posted Wed December 04, 2019 01:22 PM

Originally posted by: GGR

Hi

Cheers