IBM ILOG Scheduler User's Manual > Local Search in Scheduler > Tabu Search for the Jobshop Problem > Solving the Problem > Tabu Search with the N1 Neighborhood

The hill-climbing phase continues until we are in a state such that all neighbors have a greater cost than that of the current solution. At that point, we transition to the tabu search phase. Using the same neighborhood, we simply create another IloSingleMove goal, this time including an instance of the MyTabu metaheuristic, described above.

  IloMetaHeuristic mh = MyTabu(env, makespan);
  IloGoal move = IloSingleMove(env, 
                               lsSolution,
                               nhood, 
                               mh, 
                               IloMinimizeVar(env, makespan),
                               IloInstantiate(env, makespan));
 
  for(IloInt i = movesDone; i < maxIter; ++i) {
    lsSolver.out() << "Move: " << i << ":\t";
    if (!lsSolver.solve(move)) {
      lsSolver.out() << "no solution" << endl;      
      if ((nhood.getSize(lsSolver) == 0) || mh.complete()) 
        break;
    }
    else {
      IloNum cost = lsSolution.getSolution().getObjectiveValue();
      lsSolver.out() << "solution at cost: " << cost;
      if (cost < best) {
        globalSolution.store(lsScheduler);
        best = cost;
        lsSolver.out() << " **";
      }
      lsSolver.out() << endl;
    }
  }
 

Whenever there are no feasible, non-tabu neighbors, we call the MyTabu::complete method. We arbitrarily choose to search until the total number of moves (or non-solutions) we have found in the hill-climbing and tabu search phase together total 100.