As in the job-shop scheduling problem discussed in early chapters, each worker is represented as a unary resource (class IloUnaryResource
). We define two teams of workers; one member of the first team processes the first activity for product B, while the second activity for product B is processed by one member of the second team. The precedence enforcement level is set to IloMediumHigh
in order to create the precedence graph that is used later to analyze the partial schedule. The capacity enforcement level is left to its default value (IloBasic
). In particular, we do not use the edge finder as it can identify global inconsistencies that cannot easily be analyzed (see Analyzing a Fail Reason: Selecting the Guilty Activity).
/* DEFINING THE RESOURCES */
IloSchedulerEnv schedEnv(env);
schedEnv.getResourceParam().
setPrecedenceEnforcement(IloMediumHigh);
IloUnaryResource* workers = new (env) IloUnaryResource[4];
workers[0] = IloUnaryResource(env, "Jim");
workers[1] = IloUnaryResource(env, "Joe");
workers[2] = IloUnaryResource(env, "Jack");
workers[3] = IloUnaryResource(env, "John");
for(i=0; i<4; i++) {
solution.add(workers[i]);
}
/* DEFINING THE INITIAL OCCUPATION */
workers[0].setInitialOccupation(3,6,1);
workers[1].setInitialOccupation(22,23,1);
workers[2].setInitialOccupation(12,17,1);
workers[3].setInitialOccupation(7,11,1);
IloAltResSet* teams = new (env) IloAltResSet[2];
teams[0] = IloAltResSet(env, 2, workers[0], workers[1]);
teams[0].setName("Jim or Joe");
teams[1] = IloAltResSet(env, 2, workers[2], workers[3]);
teams[1].setName("Jack or John");