IBM ILOG Solver User's Manual > Local Search > Basic Local Search > Example: Using metaheuristics > Scanning the neighborhood

We then create a goal to scan the neighborhood. Information on the neighbor being scanned is stored in nid.

  IloNeighborIdentifier nid(env);
  IloGoal scan = IloScanNHood(env, nh, nid, soln);

The simulated annealing metaheuristic, like others supplied with Solver, operates by filtering the possible allowable neighbors generated by a goal that explores a neighborhood. For instance, the simulated annealing metaheuristic filters all neighbors for which lsuserat2.gif, where r is a random number in [0..1) and d is the degradation in cost of the proposed neighbor (both minimization and maximization are supported). A function, IloApplyMetaHeuristic, takes a neighborhood exploration goal and applies the filtering. We write:

  IloGoal scanSA = IloApplyMetaHeuristic(env, soln, simAnn, scan);