To see how the two different formulations mentioned in http://yetanothermathprogrammingconsultant.blogspot.com/2014/04/playing-with-job-shop-problem-ft10-2.html compare we use a real small example: ft06. Here are the models:
Original formulation with OR constraints: ft06.mzn
int: numjobs = 6; set of int: Jobs = 1..numjobs; array[Jobs,Stages] of int: ProcTimes = array[Jobs,Stages] of int: Machine = int: horizon = sum([ ProcTimes[j,s] | j in Jobs, s in Stages]); array[Jobs,Stages] of var 0..horizon: Start; % order % no overlap constraint solve minimize makespan; output ["makespan:",show(makespan),"\n",show(Start)] |
Formulation with cumulative constraint: ft06c.mzn
include "globals.mzn"; int: numjobs = 6; set of int: Jobs = 1..numjobs; array[Jobs,Stages] of int: ProcTimes = array[Jobs,Stages] of Machines: Machine = int: horizon = sum([ ProcTimes[j,s] | j in Jobs, s in Stages]); array[Jobs,Stages] of var 0..horizon: Start; % order % no overlap solve minimize makespan; output ["makespan:",show(makespan),"\n",show(Start)] |
Comparison
Solution time in seconds
Solver | or ft06.mzn | cumulative ft06c.mnz | Command line |
g12fd | 0.3 | 0.2 | mzn-g12fd –s ft06.mzn |
g12lazy | 0.2 | 6.5 | mzn-g12lazy -s ft06.mzn |
gecode | 0.1 | 0.1 | mzn-gecode -s ft06.mzn |
or-tools | 147 | 0.1 | minizinc -G or-tools -f \tmp\fz.exe ft06.mzn |
Gecode and or-tools show some statistics for these case:
No comments:
Post a Comment