IBM ILOG Scheduler User's Manual > Advanced Concepts > Scheduling with Unary Resources: the Bridge Problem > Defining the Problem, Designing a Model > Resource Constraints |
Resource Constraints |
INDEX
![]() |
The requires
member function of the class IloActivity
can be used to post the resource requirement constraints. Each resource is an instance of the class IloUnaryResource
.
The following MakeResource
function receives these arguments: the model
defining the problem, a name
to be given to the resource, and an array of activities
requiring the resource. The argument numberOfActivities
indicates the size of that array.
void MakeResource(IloModel model, const char* name, IloInt numberOfActivities, IloActivityArray activities) { IloEnv env = model.getEnv(); IloUnaryResource resource(env, name); for (IloInt i = 0; i < numberOfActivities; i++) model.add(activities[i].requires(resource)); }
This function is then called once for each resource of the problem. For example, the following code creates the CATERPILLAR
resource and the resource requirement constraints for the filling activities.
IloActivityArray V(env,2); V[0]=V1; V[1]=V2; MakeResource(model, "CATERPILLAR", 2, V);
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |