IBM ILOG Scheduler User's Manual > Getting Started with Scheduler > Adding Integral and Functional Constraints > Define the Problem, Design a Model > Worker's efficiency

We use a granular function in order to model the worker's efficiency. The granularity specified when constructing this IloGranularFunction is 100, so this is then the default initial value over the definition interval [0, horizon). We set the part-time efficiency for Wednesday and Saturday (50%), as well as the break on Sunday (0%), repeatedly over the time horizon using the setValue member function.

  /* MODEL WORKER'S EFFICIENCY */
  IloNum day;
  IloGranularFunction efficiency(env, 0, horizon, 100);
  for(day=0; day+7<=horizon; day+=7) {
    efficiency.setValue(day+2, day+3, 50);  // part-time wednesday
    efficiency.setValue(day+5, day+6, 50);  // saturdays
    efficiency.setValue(day+6, day+7, 0);   // sundays
  }
  efficiency.setValue( 8, 9, 0);  // Tuesday of week #2 is a day off
  efficiency.setValue(14,15, 0);  // Monday of week #3 is a day off


The exceptional days off are also modeled with a zero efficiency.

Note
We have chosen to express the efficiency with a percentage. Hence, the granularity of the IloGranularFunction is set to 100 at construction time. An alternative method of modeling would be to split the working days into mornings and afternoons, and use a granularity of 2 without loss of precision.

We must specify that the worker works at this reduced efficiency for every activity he might be asked to process. Hence we add to the model the following integral constraint.

  model.add( IloResourceIntegralConstraint(worker,
                                           IloProcessingTimeVariable,
                                           efficiency));

This constraint binds the processing time of every activity executed on the unary resource worker to be equal to the sum of the function over its duration interval [start,end].

By default, an activity is non-breakable. We use the IloActivity member function setBreakable to declare an activity breakable.