How would a Constraint Programming formulation do on this problem: http://yetanothermathprogrammingconsultant.blogspot.com/2014/04/playing-with-ft10-job-shop-1.html. A straightforward translation of the MIP formulation into Minizinc can look like:

int: numjobs = 10; set of int: Jobs = 1..numjobs; array[Jobs,Stages] of int: ProcTimes = array[Jobs,Stages] of int: MachineNumbers = int: horizon = sum([ ProcTimes[j,s] | j in Jobs, s in Stages]); array[Jobs,Stages] of var 0..horizon: Start; % positive variables % order % no overlap constraint solve minimize makespan; |

This looks actually quite nice. We can drop the binary variables that deal with the overlap, and the objective is more intuitive. As most CP solvers don’t deal very well or not at all with continuous variables, we used integer variables. This is ok here as we deal with integer valued processing times. In the real world you may need to rescale and/or approximate these numbers. Unfortunately this model does not solve. I am looking at the cursor and don’t see any feedback about any progress:

There is an alternative formulation that is often much better: replace the no overlap constraints by a global constraint called cumulative. Not totally intuitive but we can translate the model quite easily. In addition we added some bounds on all variables:

include "globals.mzn"; int: numjobs = 10; set of int: Jobs = 1..numjobs; array[Jobs,Stages] of int: ProcTimes = array[Jobs,Stages] of int: Machine = int: last_end = sum([ ProcTimes[j,s] | j in Jobs, s in Stages]); array[Jobs,Stages] of var 0..last_start: Start; % order % no overlap constraint % helper |

Unfortunately still just a blinking cursor…

Any better Minizinc formulation available? Here are some alternative formulations which I have not tried out:

- https://github.com/MiniZinc/minizinc-benchmarks/blob/master/jobshop/jobshop.mzn
- https://github.com/hakank/hakank/blob/master/minizinc/jobshop.mzn

Some questions:

- No log when solving the models? One would like to see some progress log.
- How to debug models? Something like a limrow/limcol in GAMS or expand in AMPL? One could look at the “flatzinc” output, but that is difficult to digest.
- Can we set a time limit and then get the best solution so far?