IBM ILOG Scheduler User's Manual > Getting Started with Scheduler > Using Discrete Resources > Managing Consumable Resources > Define the Problem, Design a Model |
Define the Problem, Design a Model |
INDEX
![]() |
As indicated before, one of the most important methodological principles of constraint programming is to distinguish the definition and the resolution of the problem. We start from the problem definition used in Example 2. The activities, temporal constraints, worker resource, worker resource constraints, and objective are all created in the same way as in that example. So now we can tackle the representation of the budget and budget constraints.
In the context of this example, it is clear that money is a discrete resource, available in limited quantity, and consumed by the activities in the schedule--in other words, required to start each activity and not recovered when the activity ends.
The method consumes(resource, capacity)
constrains an activity to consume capacity
of resource
. The consumed capacity, which can be a non-negative number or a Solver non-negative number variable, is non-recoverable. Zero capacity is allowed, in which case the resource constraint does not change the availability of the resource.
The following lines create an instance of IloDiscreteResource
representing the budget. They set the overall capacity of this resource to $29,000. The member function setCapacityMax
of the class IloDiscreteResource
is used to specify that only $13,000 is available from day 0 up to day 15. As its arguments, this function takes three parameters: two points in time, timeMin
and timeMax
(defining an interval [timeMin timeMax)
, here [0 15)
), and a number specifying the maximal capacity available over this interval ($13,000).
/* CREATE THE CONSUMPTION RESOURCE. */ budget = IloDiscreteResource(env, 29000, "Budget"); budget.setCapacityMax(0, 15, 13000); |
To add the budget resource constraints to the model, we use the predefined member function consumes
. The durations of the activities are defined in the array dur
using IloNum
.
An instance of the class IloSchedulerSolution
(named solution
) is used to store activities, resources and other components of a solution. These components are retrieved later in this example for printing. See the IBM ILOG Scheduler Reference Manual for more information on IloSchedulerSolution
.
/* REGISTER VARIABLES TO BE STORED IN THE SOLUTION */ solution.add(makespan); solution.add(budget); solution.add(masonry); solution.add(carpentry); solution.add(plumbing); solution.add(ceiling); solution.add(roofing); solution.add(painting); solution.add(windows); solution.add(facade); solution.add(garden); solution.add(moving); return model; }
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |