I need help with this model of Flexible Job Shop in AMPL please, i know that “oper” its a subset of “trab”, and his original index it’s [J_i] and o it’s t_i, but i don’t know how to model it.

this params are used in R4 and R5.

#.mod

param t; #numero total de trabajos

param m; #numero total de maquinas

param o; #numero total de operaciones

param q; #numero total de posiciones

set trab := 1…t; #Conjunto de trabajos

set oper := 1…o; #subconjunto de operaciones

set maquin := 1…m; #Conjunto de Maquinas

set pos := 1…q; #posicion

param a{maquin,trab,oper} binary; #1 si la operacion del trabajo se hace en k

param p{trab,oper}; #tiempo de proceso de la operacion j del trabajo i

param M >= 0; #limitacion

param d{trab}; # fecha de entrega

var x{i in trab, j in oper, k in maquin, l in pos} binary;#si la op del trab se hace en la maquin, en la posicion

var v{i in trab, j in oper, k in maquin} binary; #1 si la op del trab se hace en la maquina

var TM{k in maquin, l in pos} >= 0;#tiempo de inicio de la maquina y la posicion

var ti{i in trab, j in oper} >= 0;#tiempo de inicio de la operacion en el trabajo

var C{i in trab} >= 0; #tiempo requerido para completar el trabajo

var T{i in trab} >=0; #tardanza del trabajo

var U {i in trab} binary; #if c{i in trab} - d{i in trab} > 0 then 1 else 0;

minimize z: sum{i in trab} U[i]; #funcion Objetivo

subj to r1{i in trab}: C[i] >= sum{j in oper}(ti[i,j] + p[i,j]);

subj to r2{i in trab}: T[i] >= C[i] - d[i];

subj to r3{i in trab}: T[i] <= U[i] * M;

subj to r4{i in trab, j in 1…o-1}: ti[i,o] + p[i,j] <= ti[i,j+1];

subj to r5{i in trab, j in oper, k in maquin, l in 1…q-1}: TM[k,l] + p[i,j] * x[i,j,k,l] <= TM[k,l+1];

subj to r6{i in trab, j in oper, k in maquin, l in pos}: TM[k,l] <= ti[i,j] + (1-x[i,j,k,l]) * M;

subj to r7{i in trab, j in oper, k in maquin, l in pos}: TM[k,l] + (1-x[i,j,k,l]) * M >= ti[i,j];

subj to r8{i in trab, j in oper, k in maquin}: v[i,j,k] <= a[k,i,j];

subj to r9{k in maquin, l in pos}: sum{i in trab, j in oper}x[i,j,k,l] = 1;

subj to r10{i in trab, j in oper}: sum{k in maquin}v[i,j,k] = 1;

subj to r11{i in trab, j in oper, k in maquin}: sum{l in pos}x[i,j,k,l] = v[i,j,k];

#.dat

param t := 3;

param m := 3;

param o := 3;

param q := 2;

param a :=

1 1 1 1

1 1 2 0

1 1 3 0

1 2 1 0

1 2 2 0

1 2 3 0

1 3 1 0

1 3 2 0

1 3 3 0

2 1 1 1

2 1 2 0

2 1 3 0

2 2 1 0

2 2 2 0

2 2 3 0

2 3 1 0

2 3 2 0

2 3 3 0

3 1 1 0

3 1 2 0

3 1 3 1

3 2 1 0

3 2 2 0

3 2 3 0

3 3 1 0

3 3 2 0

3 3 3 0

;

param p:

1 2 3 :=

1 16 16 16

2 40 20 36

3 30 30 24

;

param M := 100;

param d:=

1 160

2 240

3 130

;