IBM ILOG Scheduler User's Manual > Getting Started with Scheduler > Adding Alternative Resources > Solve the Problem

A two-step approach is required to solve this problem, so we use && to link the two goals. In the first step, the goal IloAssignAlternative assigns a resource to all activities. In the second step, the goal IloRankForward ranks all resource constraints while minimizing makespan.

  /* SET THE OBJECTIVE */
  model.add(IloMinimize(env, makespan));  
  /* ... */
    IloEnv env;

    IloNumVar makespan;
    IloModel model = DefineModel(env, makespan);
 
    IloSolver solver(model);   

    IloGoal goal = IloAssignAlternative(env) && IloRankForward(env, makespan);