Minimizing the makespans

With a constraint, or a surrogate constraint.

In the distributed school time-tabling example, the makespan of the solution can be minimized so that everybody can leave the school early at the end of the week.

To minimize the makespan:

  1. Add the following constraint:
      makespan == max(r in InstanceSet) End[r];
    

    where the variable makespan is declared with:

    dvar int makespan in Time;                            // ending date of last course
    

    and the Time range corresponds to the time table period (that is, a week):

    int HalfDayDuration = DayDuration div 2;
    int MaxTime = DayDuration*NumberOfDaysPerPeriod;
    range Time = 0..MaxTime-1;
    
  2. Optionally, to help proving optimality, add a surrogate constraint.
      makespan >= max(c in Class) sum(r in InstanceSet : r.Class == c) r.Duration;