IBM ILOG Scheduler User's Manual > Getting Started with Scheduler > Using Reservoirs > Define the Problem, Design a Model > Add the Budget Resource Constraints

The method consumes(resource, capacity) constrains an activity to consume capacity of resource. The consumed capacity, which can be a non-negative number or an IloNumVar, is non-recoverable. Zero capacity is allowed, in which case the resource constraint does not change the availability of the resource. To model the activity cost, we add the consumes constraint to each activity and set the capacity consumed to be equal to the activity duration.

The method produces(reservoir, capacity) constrains an activity to produce capacity of reservoir. The produced capacity can be a non-negative number or an IloNumVar. Zero capacity is allowed, in which case the resource constraint does not change the availability of the resource. To model the activity profit, we add the produces constraint to each activity and set the capacity consumed to be equal to the activity duration plus 1.

  /* POST THE RESOURCE CONSTRAINTS ON THE BUDGET. */ 
  model.add(masonry.consumes(budget, dur[0]));
  model.add(carpentry.consumes(budget, dur[1]));
  model.add(plumbing.consumes(budget, dur[2]));
  model.add(ceiling.consumes(budget, dur[3]));
  model.add(roofing.consumes(budget, dur[4]));
  model.add(painting.consumes(budget, dur[5]));
  model.add(windows.consumes(budget, dur[6]));
  model.add(facade.consumes(budget, dur[7]));
  model.add(garden.consumes(budget, dur[8]));
  model.add(moving.consumes(budget, dur[9]));
 
  model.add(masonry.produces(budget, (dur[0] + 1)));
  model.add(carpentry.produces(budget, (dur[1] + 1)));
  model.add(plumbing.produces(budget, (dur[2] + 1)));
  model.add(ceiling.produces(budget, (dur[3] + 1)));
  model.add(roofing.produces(budget, (dur[4] + 1)));
  model.add(painting.produces(budget, (dur[5] + 1)));
  model.add(windows.produces(budget, (dur[6] + 1)));
  model.add(facade.produces(budget, (dur[7] + 1)));
  model.add(garden.produces(budget, (dur[8] + 1)));
  model.add(moving.produces(budget, (dur[9] + 1)));