IBM ILOG Scheduler User's Manual > Advanced Concepts > Scheduling with Unary Resources: the Job-Shop Problem > Defining the Problem, Designing a Model > Resources and Activities |
Resources and Activities |
INDEX
![]() |
The following code creates the resources, creates the activities, posts the precedence constraints, posts the resource constraints, and constrains makespan
to be at least the end time of the last activity of each job.
An instance of the class IloUnaryResource
is used to represent each machine.
The capacity enforcement level of the resource parameter is set to IloMediumHigh
, stating that extra effort should be spent in enforcing the capacity constraints on each resource.
We'll give a name to each activity. The format of this name is JiSjRr
, to express the idea that the activity corresponding to the j
th step of the i
th job uses resource r
.
/* CREATE THE RESOURCES. */ IloSchedulerEnv schedEnv(env); schedEnv.getResourceParam().setCapacityEnforcement(IloMediumHigh); IloInt j; IloUnaryResource *resources = new IloUnaryResource[numberOfResources]; char buffer[128]; for (j = 0; j < numberOfResources; j++) { sprintf(buffer, "R%ld", j); resources[j] = IloUnaryResource(env, buffer); } /* CREATE THE ACTIVITIES. */ k = 0; IloInt i; jobs = IloAnyArray(env, numberOfJobs); for (i = 0; i < numberOfJobs; i++) { IlcInt j = i*numberOfResources; Job* job = new (env) Job(env, i, numberOfResources, &durations[j], &resourceNumbers[j], resources); job->addToModel(model, makespan); jobs[i] = job; }
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |