include "globals.mzn"; int: p; int: m; array[1..p,1..m] of int: time; array[1..p,1..m] of int: transition_time; var int: makespan; array[1..p,1..m] of var 0..sum(time) + sum(transition_time): start; array[1..p,1..m] of var 0..sum(time) + sum(transition_time): end; constraint forall(i in 1..p, j in 1..m)(start[i,j] >= 0); constraint forall(i in 1..p, j in 1..m)(end[i,j] = start[i,j] + time[i,j]); constraint forall(i in 1..p, j in 2..m)(start[i,j] >= end[i,j-1] + transition_time[i,j]); constraint forall(i in 1..p)(start[i,1] >= transition_time[i,1]); constraint end[3,3] <= end[5,3]; constraint forall(j in 1..m)(start[4,j] == end[8,j]); constraint makespan = max(i in 1..p, j in 1..m)(end[i,j]); %constraint forall(j in 1..m)(disjunctive([start[i,j] | i in 1..p], [time[i,j] | i in 1..p])); constraint forall(a,b in 1..p where a != b,j in 1..m)(start[a,j] >= end[b,j] \/ start[b,j] >= end[a,j]); solve minimize makespan; output [ "makespan: " ++ show(makespan) ++ "\n" ++ "[start-(dur)-end]:" ] ++ [ if j = 1 then "\n" else " " endif ++ "[" ++ show(start[i,j]) ++ "-(" ++ show(time[i,j]) ++ ")-" ++ show(end[i,j]) ++ "]" | i in 1..p, j in 1..m ];