The time horizon for the schedule is computed using the assumptions that the jobs are executed one after another and that the trolley always needs the maximum duration to move from one place to another.
IloModel DefineModel(IloEnv env,
const char** jobNames,
IloNum* transitDurations,
IloInt* machines1,
IloNum* durations1,
IloInt* machines2,
IloNum* durations2,
IloAnyArray& jobs,
IloStateResource& trolley,
IloArray<IloUnaryResource>& machines,
IloNumVar& makespan)
{
IloInt i, j;
IloModel model(env);
/* CREATE THE MAKESPAN VARIABLE. */
IloNum horizon =
numberOfJobs * ((6 * loadDuration) +
(4 * getMaxTransitDuration(5, transitDurations)));
for (i = 0; i < numberOfJobs; i++)
horizon += durations1[i] + durations2[i];
makespan = IloNumVar(env,0,horizon,ILOINT);
/* ... */
/* RETURN THE CREATED MODEL */
return model;
}