IBM ILOG Scheduler User's Manual > Local Search in Scheduler > Tabu Search for the Jobshop Problem with Alternatives > Solving the Problem > Modifying the SwapRC Move

As we did in the previous chapter, we define special move classes to organize the information about a single local search move. Instances of these classes are then created and manipulated by the neighborhood classes.

Since we have two types of moves and we want to treat them equivalently from the perspective of the metaheuristic, we implement an abstract class LSMove.

class LSMove {
public:
  LSMove() {}
  virtual ~LSMove() {}

  virtual IloBool isReverseMove(IloSolution delta) const = 0;
  virtual IloSolution createDelta(IloEnv, IloSchedulerSolution) = 0;
};

We redefine the SwapRC class from the previous chapter to inherit from LSMove. The only change to the SwapRC class is an additional test in the findSwapFromDelta method. For each resource constraint in the delta solution we ensure that it selects the same resource as in the current solution. If a resource selection has changed, we know that the delta solution does not represent a SwapRC move.

  for(IloSchedulerSolution::ResourceConstraintIterator preiter(solution);
      preiter.ok(); ++preiter) {
    IloResourceConstraint rc = *preiter;
    if (solution.getSelected(rc).getImpl() != 
        current.getSelected(rc).getImpl())
      return 0;
  }

The other components of the SwapRC move are identical to what was presented in the previous chapter.