IBM ILOG Scheduler User's Manual > Local Search in Scheduler > Shuffling as Local Search in Scheduler > Solving the Problem > Creating an IloSchedulerSolution

In the local search infrastructure provided by IBM® ILOG® Solver, the IloSolution objects plays a key role as a data structure. The IloSchedulerSolution object plays the same role for local search in IBM ILOG Scheduler. In particular, it represents the Scheduler objects that define a solution as well as the changes to those objects that represent a neighbor.

Scheduler objects are richer than the variables that are the main elements of local search in Solver. For example, a resource constraint in a solution specifies the resource to which it is assigned, the set of successor resource constraints, the set of next resource constraints, etc. Because of this richer representation, it is necessary to specify precisely what is restored when an IloSchedulerSolution is restored by the local search protocol (or by the IloRestoreSolution goal). In this case, we want to store the activities in the solution (because we need to access the start times for the critical path calculation) but we do not want to restore any of the information contained in the activities as we want our neighborhood to be based on the edges in the critical path, that is, on the next relations between resource constraints. We also want to store and restore those next relations between resource constraints. To do all this, we first add the activities to the solution in the DefineModel function.

      solution.add(activity, IloRestoreNothing);

Note the second argument of the add function. This argument defines what is restored. All the information about the object will be stored in the solution, so it is still possible to inquire about the start times of activities but, because the second argument is IloRestoreNothing, no information about activities will be restored.

Rather than explicitly adding each activity to the local search solution, we simply create the local search solution by cloning the main solution object. Then we add each resource constraint, specifying that only the next relations should be restored. See the IBM ILOG Scheduler Reference Manual for full details about the parameterization of the restoration of IloSchedulerSolution instances.

  /* CREATE LOCAL SEARCH SOLUTION */
  IloSchedulerSolution lsSolution = globalSolution.makeClone(env);

  for (IloIterator <IloResourceConstraint> iter(env); iter.ok(); ++iter)
    lsSolution.add(*iter, IloRestoreRCNext);