IBM ILOG Solver User's Manual > Local Search > Basic Local Search > Example: Using metaheuristics > Making a single move

Finally, we can construct a goal to make a single move via:

  IloGoal scanSA = IloApplyMetaHeuristic(env, soln, simAnn, scan);
  IloGoal choose = IloSelectSearch(env, scanSA, IloFirstSolution(env));
  IloGoal notify = IloNotify(env, nh, nid) && IloNotify(env, simAnn, nid);
  IloGoal move = choose && notify && store;

The goal to make a move is made up of three phases: a choice stage, a notification stage, and a commitment stage. These are represented by the goals choose, notify, and store. The choose goal explores the neighborhood, with the simulated annealing metaheuristic filter applied, and then chooses the first legal neighbor. The notify goal notifies the neighborhood and the metaheuristic that a move is about to be taken. (Notice that now we also notify the metaheuristic as well as the neighborhood.) Finally, the new solution is stored by the store goal. It is important that the neighborhood and the metaheuristic are notified before the new solution is stored. For the simulated annealing metaheuristic, the temperature is reduced by the reduction factor when the metaheuristic is notified that a move is being taken.