IBM ILOG Scheduler User's Manual > Integrated Applications > Scheduling with Alternative Resources: Interleaving Resource Allocation and Scheduling Decisions > Defining the Problem, Designing a Model > Declaring the Alternative Resource Sets and Processing Times

Given the alternative resource and processing time data generated above, the only difference in modeling between the standard job shop model and this problem is the declaration of the activities and the resource constraints.

Rather than having a constant processing time, the activities in this problem have an upper and lower bound. We, therefore, create each activity with a Solver variable representing its processing time.

      IloNum ptMin = IloMin(durations[k], altDurations[k]);
      IloNum ptMax = IloMax(durations[k], altDurations[k]);
      IloNumVar ptVar(env, ptMin, ptMax, ILOINT);

      IloActivity activity(env, ptVar);

We then declare that the activity requires one of the resources in an alternative resource set by creating an alternative resource constraint and adding it to the model. To specify the differing processing times depending on the resource selected, we use the setProcessingTimeMax and setProcessingTimeMin methods on the IloAltResConstraint.

      IloResourceConstraint rc =
        activity.requires(altResSets[resourceNumbers[k]]);
      
      // SET THE DIFFERENT DURATIONS DEPENDING ON 
      // RESOURCE SELECTION 
      rc.setProcessingTimeMax(resources[resourceNumbers[k]],
			      durations[k]);
      rc.setProcessingTimeMin(resources[resourceNumbers[k]],
			      durations[k]);
 
      rc.setProcessingTimeMax(
             resources[altResourceNumbers[resourceNumbers[k]]],
             altDurations[k]);
      rc.setProcessingTimeMin(
             resources[altResourceNumbers[resourceNumbers[k]]],
             altDurations[k]);
 
      model.add(rc);