IBM ILOG Solver User's Manual > Local Search > Minimizing Talent Wait Cost Using LNS > Tips on using Large Neighborhood Search > Making the most of neighborhood search

LNS is implemented as a neighborhood search technique in Solver IIM. In this way, you can make the most of the facilities provided by neighborhood search to improve the way in which you use LNS. For example, LNS is a more computationally intensive technique than more traditional neighborhood searches, but does have the advantage that it is less likely to become stuck in local optima. One way to increase the efficiency of your search is to run a typical neighborhood search (using, depending on your problem, IloFlip, IloSwap, and so on) before switching to LNS. This can pay dividends on larger problem instances.

Another way in which neighborhood search can be used is via the application of metaheuristics. In this lesson, only greedy search was shown, but tabu search and simulated annealing apply equally well to LNS. You should, however, recognize that such searches will require longer running times.

Finally, some problems have a dual aspect, for instance multiple or hierarchical objectives, or strongly competing different constraint types. In this case, you might envisage two or more different types of large neighborhood search fragment that you can generate, each one dedicated to working on a different aspect of the problem. You could create one single fragment definition neighborhood which performs one of the fragment types at random, but a more modular approach is to use neighborhood addition as below. In this way, all types of fragment generation methods can be used which keeping their codes separate.

// Fragment generators
ILODEFINELNSFRAGMENT1(GenFrag1, solver, IloIntVarArray, x) {
  // ... code of generator 1 ...
}

ILODEFINELNSFRAGMENT1(GenFrag2, solver, IloIntVarArray, x) {
  // ... code of generator 2 ...
}

ILODEFINELNSFRAGMENT1(GenFrag3, solver, IloIntVarArray, x) {
  // ... code of generator 3 ...
}

int main() {
  // ...

  // Decision Variables.
  IloIntVarArray x(env, size);
  // ...

  // ...
  IloNHood nhood = GenFrag1(env, x) + GenFrag2(env, x) + GenFrag3(env, x);
  // ...
}