IBM ILOG Dispatcher User's Manual > Developing Dispatcher Applications > Predefined First Solution Heuristics

Dispatcher offers a variety of predefined first solution heuristics for use in generating a first solution. Each predefined first solution heuristic is explained in this appendix. To show how the different predefined first solution heuristics work, their results on the same example problem are shown in each section of this appendix. The following predefined first solution heuristics are provided by Dispatcher: enumeration, savings, sweep, nearest-to-depot, nearest addition, and insertion.

Example data

The following example data is used in this appendix to demonstrate how each predefined first solution heuristic works. The goal of the example is to compute a route that starts and ends at the depot and visits each node exactly once. The length of the route is computed according to Euclidean distance.

In the following figure, the depot is represented as a black circle. The other circles represent visits to make at various locations. The coordinates of the depot are (30,40). The capacity of the truck is 50 and there are 11 visits to perform. The tuples (x,y,quantity) of the visits are (17,63,19), (31,62,23), (52,64,16), (21,47,15), (37,52,7), (49,49,30), (42,41,19), (20,26,9), (40,30,21), (52,33,11) and (51,21,5).

images/appendix_firstsolsad.gif

Figure A.1 Example data: depot and visits

Enumeration Heuristic

Dispatcher provides a basic, complete enumeration method for generating a first solution. The enumeration heuristic builds a solution to the problem using an algorithm that completely explores the search space using backtracking. This method should only be used for small problems.

This heuristic is implemented in Dispatcher as the goal IloDispatcherGenerate.

The following figure provides an example of the use of IloDispatcherGenerate on the example VRP with capacity constraints. The cost of this solution is 352.57.

images/appendix_firstsols2.gif

Figure A.2 Sample solution using enumeration heuristic

Savings Heuristic

For problems with multiple vehicles, it is very important to consider the trade-off between more vehicles with shorter routes and fewer vehicles with longer routes. For example, the following figure shows two ways of making visits a and b.

images/appendix_firstsols3.gif

Figure A.3 Principle of the savings heuristic

The savings of serving a and b in the same route, denoted savings (a, b), is defined as savings (a, b) = cost (a, Depot) + cost (Depot, b) - cost (a, b). The savings heuristic generates a solution based on this equation. It works like this:

  1. Choose an arbitrary visit O (usually the depot), and for all pairs of visits (i, j), compute the savings function: savings(i, j) = cost (i, O) + cost (O, j) - cost(i, j).
  2. Sort the arcs (i, j) according to savings(i, j) in descending order, and put them in a list L.
  3. If all visits are scheduled, the goal succeeds.
  4. If there are unscheduled visits, choose an untried vehicle v from the plan. If there are no untried vehicles, the unscheduled visits are constrained to be unperformed. If one of these visits must be performed, the goal fails.
  5. Scan L to find an arc that can be used to create an initial partial route for v. If no such legal arc can be found, go to step 4, otherwise remove the chosen arc from L.
  6. Scan L to find an arc that can be added to the start or end of the route. If no such arc can be found, go to step 3, otherwise remove the arc from L, and repeat step 6.

This heuristic is implemented in Dispatcher as the goal IloSavingsGenerate.

The following figure provides an example of the use of IloSavingsGenerate on the example VRP with capacity constraints. The cost of this solution is 280.947.

images/appendix_firstsols4.gif

Figure A.4 Sample solution using savings heuristic

Sweep Heuristic

The sweep heuristic builds routes by sweeping around the depot:

  1. Let O be a site from which vehicles leave (usually a depot), and let A (different from O) be another site which serves as a reference.
  2. Sort all the sites S in the routing plan by increasing angle AOS. Put the result in a list L.
  3. The visits corresponding to the sites in L will be allocated to the vehicles in that order as long as constraints are respected.
  4. If all vehicles have been used, the remaining visits are constrained to be unperformed. If one of these visits must be performed, the goal fails.

This heuristic is implemented in Dispatcher as the goal IloSweepGenerate.

The following figure provides an example of the use of IloSweepGenerate on the example VRP with capacity constraints. The cost of this solution is 270.403.

images/appendix_firstsols5.gif

Figure A.5 Sample solution using sweep heuristic

Nearest-to-Depot Heuristic

The nearest-to-depot heuristic builds routes by adding the visits close to the depot first.

For all vehicles:

  1. Denote the vehicle to be considered by w.
  2. Start with a partial route consisting of the departure from the depot.
  3. Find the visit v which is closest to the starting point of the current partial route of w. If it is not possible to find such a visit without violating constraints, close the current partial route of w, choose another empty vehicle and go to step 2. If no empty vehicles remain, the goal fails.
  4. Add v to the end of the partial route.
  5. Go to step 3.
  6. If all vehicles have been used, the remaining visits are constrained to be unperformed. If one of these visits must be performed, the goal fails.

This heuristic is implemented as the goal IloNearestDepotGenerate.

The following figure provides an example of the use of IloNearestDepotGenerate on the example VRP with capacity constraints. The cost of this solution is 369.297.

images/appendix_firstsols6.gif

Figure A.6 Sample solution using nearest-to-depot heuristic

Nearest Addition Heuristic

The nearest addition heuristic is very similar to the nearest-to-depot heuristic just described. It often gives better results because the visit added to the route is the one closer to the end of the route, not the one closer to the depot.

For all vehicles:

  1. Denote the vehicle to be considered by w.
  2. Start with a partial route consisting of the departure from the depot.
  3. Find the visit v which is closest (that is, least costly to get to) to the end of the current partial route of w. If it is not possible to find such a visit without violating constraints, close the current partial route w, choose another empty vehicle and go to step 2. If no empty vehicles exist, the goal fails.
  4. Add v to the end of the partial route.
  5. Go to step 3.
  6. If all vehicles have been used, the remaining visits are constrained to be unperformed. If one of these visits must be performed, the goal fails.

This heuristic is implemented in Dispatcher as the goal IloNearestAdditionGenerate.

The following figure provides an example of the use of IloNearestAdditionGenerate on the example VRP with capacity constraints.The cost of this solution is 285.232.

images/appendix_firstsols7.gif

Figure A.7 Sample solution using nearest addition heuristic

Insertion Heuristic

The insertion heuristic works by inserting each visit (in the order they were created) at the best possible place, in terms of cost.

  1. Let all vehicles have empty routes.
  2. Let L be the list of unassigned visits.
  3. Take a visit v in L.
  4. Insert v in a route at a feasible position where there will be the least increase in cost. If there is no feasible position, then the goal fails.
  5. Remove v from L.
  6. If L is not empty, go to 3.

This heuristic is implemented in Dispatcher as the goal IloInsertionGenerate.

The following figure provides an example of the use of IloInsertionGenerate on the example VRP with capacity constraints.The cost of this solution is 300.681.

images/appendix_firstsols8.gif

Figure A.8 Sample solution using insertion heuristic