Originally posted by: RuiFig
Hi,
I am developing a model to schedule a job shop. I am now trying to add the setups. I followed the cp optimizer example however when I run the model it doesn't consider the setups. I added a matrix with the setup times, created a tuple with the machines and the setups and used the noOverlap function with the tuple and the sequence type variable of the machines, as in the exemples, but it doesnt work.
Can anyone help ?
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] intensity Calendar[Maquinas[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 Encomendas) endOf(itvs[j][nbMaq-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
}
}
#CPOptimizer#DecisionOptimization