Previously, the makespan was set to the end of the last activity (moving). In this example, with three houses being built, the makespan is defined as an IloNumVar
equal to or greater than each moving activity, so that the house with the longest build time increments the makespan appropriately.
We are going to set a horizon in this example, or latest potential ending point in time. When calculating the horizon, we must guarantee that all activities will be completed by that time. We set the horizon in this example because it helps define the outward time boundary for building the three houses, thereby limiting the potential solution search space.
We have only one worker, so we can start calculating the horizon by adding the durations for all activities of all three houses: 29 + 47 + 47 = 123. We are defining the minimum transition time between differing activities to be three; therefore, if all activities follow activities of a different type, the total minimum transition time would be 87. The time required to build all three houses would then be 123 + 87 = 210. Since it's unlikely that all the transition time will be required, we can safely set the horizon to 200.
/* CREATE THE MAKESPAN VARIABLE. */
IloNum horizon = 200;
makespan = IloNumVar(env, 0, horizon, IloNumVar::Int);
/* ... */
model.add(moving.endsBefore(makespan));
|