IBM ILOG Scheduler User's Manual > Advanced Concepts > Using The Trace Facilities to Relax a Model > Solving the Problem: Analyzing a Fail > List Scheduling

The list scheduling algorithm is a deterministic greedy algorithm: it creates no choice points. The heuristic rule to build the schedule is very simple: the activity that can start the earliest time with the earliest maximum end time is selected and its start time is fixed to its minimum value. If the activity requires an alternative resource, one possible resource is arbitrarily selected.

ILCGOAL0(ListScheduling) {
  IloSolver solver = getSolver();
  IlcScheduler schedule(solver);
 
  IloSelector<IlcActivity,IlcSchedule> actSelector =
    IloBestSelector<IlcActivity,IlcSchedule>
    (!IlcActivityStartVarBoundPredicate(solver) || IsInUnselectedAltRCPredicate(solver),
     IloComposeLexical(IlcActivityStartMinEvaluator(solver).makeLessThanComparator(),
		       IlcActivityEndMaxEvaluator(solver).makeLessThanComparator()));
 
  IlcActivity act;
  if (actSelector.select(act, schedule)) {
    act.setStartTime(act.getStartMin());
    for(IlcAltResConstraintIterator ite(act); ite.ok(); ++ite) {
      IlcAltResConstraint altResCt = *ite;
      IlcAltResSet altResSet = altResCt.getAltResSet();
      IlcInt i;
      for(i=0; i<altResSet.getSize(); ++i) {
        IlcResource resource = altResSet[i];
        if (altResCt.isPossible(resource)) {
          altResCt.setSelected(resource);
          break;
        }
      }
    }
    return this;
  }
  else return 0;
}
 
ILOCPGOALWRAPPER0(IloListScheduling, solver) {
  return ListScheduling(solver);
}