IBM ILOG Dispatcher User's Manual > The Basics > Minimizing the Number of Vehicles > Solve > Define the improveWithNHood function |
Define the improveWithNHood function |
INDEX
![]() |
After you have found a first solution, you create the neighborhoods you will use in the solution improvement phase. As in Chapter 3, Solving a Vehicle Routing Problem, you use the predefined neighborhoods IloRelocate
, IloExchange
, IloCross
, IloTwoOpt
, and IloOrOpt
. Additionally, you use three other predefined neighborhoods: IloMakePerformed
, IloMakeUnperformed
, and IloSwapPerform
. The function IloMakePerformed
returns a neighborhood that modifies a solution by inserting an unperformed visit after a performed one. The function IloMakeUnperformed
returns a neighborhood that modifies a solution by causing a performed visit to be unperformed. The function IloSwapPerform
returns a neighborhood that modifies a solution by exchanging a performed visit with an unperformed one. These neighborhoods are used to improve a solution after emptying a vehicle and constraining the visits assigned to it to be performed by some other vehicle.
For more information about how predefined neighborhoods work, see ïtò^ B Predefined Neighborhoods.
Step 8 - | Create the neighborhoods |
Add the following code after the comment //Create the neighborhoods
The rest of the function is defined as in Chapter 3, Solving a Vehicle Routing Problem. You use the function IloSingleMove
to return a goal that makes a single local move as defined by a neighborhood and a search heuristic. The following code is provided for you:
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |