IBM ILOG Dispatcher User's Manual > Developing Dispatcher Applications > Developing Your Own Neighborhoods |
Developing Your Own Neighborhoods |
INDEX
![]() |
In this lesson, you will learn how to:
The predefined neighborhoods that Dispatcher offers are sufficient for most first solution improvements. Occasionally, you may want to write your own neighborhood. This section provides an example of how to create your own neighborhood solely for the user who is comfortable with using the predefined neighborhoods and who encounters the need to create a neighborhood.
The predefined neighborhoods provided with Dispatcher may not perform well on certain routing problems. For example, in a routing problem where there are constraints stating that after a visit A, visits B, C, and D must follow directly, neighborhoods like IloRelocate
will not be able to move A, B, C, or D on its own to a new vehicle; the constraints forbid it. For problems with such tight constraints, you can write your own neighborhood to perform the movements you require. In the above example, you could create a neighborhood which was capable of moving A, B, C, and D as a single block to another location.
The following example uses a type of "restricted exchange." This is a neighborhood exactly like IloExchange
, except that only visits within a certain distance of each other are considered for exchange. The other pairs of visits are ignored. To write your own neighborhood in Dispatcher, you subclass the class IloNHoodI
. This is the exact same way you would create a neighborhood in Solver. A neighborhood is created through redefining virtual methods such as start
, getSize
, and define
. The only difference between the methods used in Solver and those used in Dispatcher is that in Dispatcher you deal with routing objects (visits) and their associated attributes (next visit, previous visit, and vehicle). However, the method is essentially the same.
The following example relies heavily on your knowledge of Solver's local search methods. So, if you have not already done so, you should read about local search in the IBM ILOG Solver User's Manual before creating your own neighborhood.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |