IBM ILOG Solver User's Manual > Local Search > Writing a Neighborhood > Writing a new neighborhood |
Writing a new neighborhood |
INDEX
![]() |
It is possible to write your own local search neighborhoods using Solver by subclassing the IloNHoodI
class. This section shows you how to do this. The basic behavior of the neighborhood class is to generate possible moves from a current solution for local search procedures. Moves are described by the difference between the current solution and the new one. This difference is installed in a mini-solution or delta that contains just the variables that change and their new values.
Why would you want to write your own neighborhood? Solver provides certain standard neighborhoods which can be used for many common problems. However, challenging aspects of a problem may require some specialization, or integration of domain knowledge into the search procedure. One way of doing this is to write a neighborhood that generates neighbors dedicated to the problem at hand.
Here, we describe a small example that uses local search to sort a sequence of numbers, using a "Bubble Sort" type neighborhood. It should be noted that this is not an efficient way of sorting: the example is used here merely for its illustrative value.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |