IBM ILOG Scheduler User's Manual > Advanced Concepts > Scheduling with Unary Resources: the Bridge Problem > Solving the Problem > Minimizing the Makespan

The default version of IloRankForward uses IloSelResMinGlobalSlack to select the next resource and IloSelFirstRCMinStartMax to select the next resource constraint. Using the defaults with the variable makespan set as the objective to minimize will generate an optimal solution to the problem.

    IloNumVar makespan;
    IloModel model = DefineModel(env, makespan);
    model.add(IloMinimize(env, makespan));
 
    IloSolver solver(model);
    IloGoal goal = IloRankForward(env, makespan);
 
    if (solver.solve(goal)) {
      PrintSolution(solver);
      solver.printInformation();
      
#if defined(ILO_SDXLOUTPUT)
      IloSDXLOutput output(env);
      ofstream outFile("bridge.xml");
      output.write(IlcScheduler(solver), outFile);
      outFile.close();
#endif
    }
    else
      solver.out() << "No solution!" << endl;