Vous êtes sur la page 1sur 18

Rangkuman Clarke Wright Saving Heuristics

Sumber 1: http://web.mit.edu/urban_or_book/www/book/chapter6/6.4.12.html

Heuristics for the single-depot VRP. By far the best-known approach to the VRP problem is
the "savings" algorithm of Clarke and Wright. Its basic idea is very simple. Consider a depot D
and n demand points. Suppose that initially the solution to the VRP consists of using n vehides
and dispatching one vehicle to each one of the n demand points. The total tour length of this
solution is, obviously, 2 d(D, i).

If now we use a single vehicle to serve two points, say i and j, on a single trip, the total distance
traveled is reduced by the amount

The quantity s(i, j) is known as the "savings" resulting from combining points i and j into a
single tour. The larger s(i, j) is, the more desirable it becomes to combine i and j in a single
tour. However, i and j cannot be combined if in doing so the resulting tour violates one or more
of the constraints of the VRP.

Clark Wright Savings Algorithm (Algorithm 6.7)

Calculate the savings s(i, j) = d(D, i) + d(D, j) - d(i, j) for every pair (i, j) of demand
STEP 1:
points.
Rank the savings s(i, j) and list them in descending order of magnitude. This creates
STEP 2: the "savings list." Process the savings list beginning with the topmost entry in the list
(the largest s(i, j)).
For the savings s(i, j) under consideration, include link (i, j) in a route if no route
constraints will be violated through the inclusion of (i, j) in a route, and if:

a. Either, neither i nor j have already been assigned to a route, in which case a new
route is initiated including both i and j.

b. Or, exactly one of the two points (i or j) has already been included in an existing
STEP 3:
route and that point is not interior to that route (a point is interior to a route if it is not
adjacent to the depot D in the order of traversal of points), in which case the link (i,
j) is added to that same route.

c. Or, both i and j have already been included in two different existing routes and
neither point is interior to its route, in which case the two routes are merged.

If the savings list s(i, j) has not been exhausted, return to Step 3, processing the next
entry in the list; otherwise, stop: the solution to the VRP consists of the routes created
STEP 4: during Step 3. (Any points that have not been assigned to a route during Step 3 must
each be served by a vehicle route that begins at the depot D visits the unassigned
point and returns to D.)
Example 13: Refuse-Collection, Revisited

Consider once again the 1O-point refuse-collection problem examined earlier

(Example 9). The depot is node (point) 1 and the nine points to be visited are now
recognized to pose different requirements in terms of the expected quantity of refuse
to be collected on each daily tour. The pertinent distance and savings data are shown
in Table 6-4. Because the distance matrix is symmetric,

the distances d(i, j) and the savings s(i, j) can both be exhibited in a single 9 x 10
matrix (no savings are associated with the depot, i.e., node 1). In Table 64, the
savings s(i, j) are shown above the diagonal. For instance,
s(4, 6) = d(1, 4) + d(1, 6) - d(6, 4) = 57 + 61 - 71 = 47

Table 6-5 lists the quantities of refuse to be collected from each of the nine nodes 2
through 10. We assume that the capacity of each vehicle is equal to 23 units and
apply the third step of the Clarke-Wright algorithm to the savings list, as shown in
Table 6-6. No constraint other than the maximum capacity one is assumed to exist.
The processing of the savings list now proceeds as follows. The largest savings is
associated with link (6, 10), so a tour consisting of {1, 6, 10, 1} is created. The second
entry in the list is associated with link (9, 10). The initial route is therefore expanded
to {1, 6, 10, 9, 1} since the conditions under Step 3 are satisfied by such an
expansion. Next is the entry for link (8, 9) and expansion of the route to {1, 6, 10, 9,
8, 1} also turns out to be acceptable. However, expansion to {1, 5, 6, 10, 9, 8, 1}, as
suggested by the next entry for link (5, 6), is impossible since such a route would
imply a load of 24 units (> 23). Thus, link (5, 6) is rejected. So is link (8, lO)--both
8 and 10 are already in the tour; and (7, lO)--since 10 is interior to the tour. The
appearance of link (4, 5) as the next entry in the savings list leads to formation of
another tour {1, 4, 5, 1}. Next, the inclusion of point 7 in the first tour is acceptable
and that tour is expanded to {1, 7, 6, 10, 9, 8, 1} with a load of 23 (meaning that this
tour cannot be expanded further).

Proceeding in the sate way, points 3 and then 2 are successively added to the second
tour, ending up with the tour {1, 2, 3, 4, 5, 1}, with a load of 19 units. Since all points
have been included in a tour, that also means the completion of our procedure. The
two tours are shown in Figure 6.31 and their combined length (total distance
traveled) is 397 units.
As the reader may have already surmised, the Clarke-Wright algorithm can be
programmed to run very efficiently and, since it involves very simple manipulations
of the data set, it can be used with large problems. Because nodes are added to routes
one or two at a time, an additional advantage of the algorithm is that it is possible to
check whether each addition would violate any set of constraints, even when that set
is quite complicated. For instance, besides the constraints on maximum capacity and
maximum distance, other constraints might be included, such as a maximum number
of points that any vehicle may visit.

On the other hand, there is no guarantee that the solution provided by such a naive
algorithm will be anywhere close to the optimum. While experience has shown that
the algorithm performs quite well most of the time, it is possible to devise
"pathological" cases for which the Clarke-Wright solutions are very poor indeed.
However, it is often possible to improve considerably, by inspection, a set of VRP
tours produced by the savings algorithm. In fact, a powerful interactive "man-
machine" approach has been developed for that purpose [KROL 72. In this approach,
a computer "suggests" a solution using the savings algorithm and projects that
solution on a television screen. The human operator then attempts to improve on this
solution using his/her knowledge of the problem as well as such geometrical
properties of good tours as those we have already discussed for the Euclidean TSP
(Section 6.4.8). The operator, using a light pen, suggests these improvements to the
computer, which, in turn, comes up with a new solution to the VRP; and so on.

Example 13 (continued)
Consider again the nine-point refuse-collection problem of the previous example
and suppose that we make a single change in the earlier problem by setting vehicle
capacity to 16 units (instead of 23).
Solution

The reader may wish to verify that the solution produced through the savings
algorithm now becomes:

This solution is shown in Figure 6.32. By observing that tours are partially included
in each other and that they intersect three times, we are led to attempt some
modifications seeking an improvement on the earlier solution.

A natural modification to attempt, for instance, is the following:

This solution is both feasible and covers 11 percent less distance than the initial
Clark-Wright solution (Figure 6.33).

METHOD OF CLARKE AND WRIGHT

1. Starting solution: each of the n vehicles serves one customer.
2. For all pairs of nodes i,j, i…j, calculate the savings for joining the cycles using egde [i,j]:
sij = c0i + c0j - cij.
3. Sort the savings in decreasing order.
4. Take edge [i,j] from the top of the savings list. Join two separate cycles with edge [i,j], if
(i) the nodes belong to separate cycles
(ii) the maximum capacity of the vehicle is not exceeded
(iii) i and j are first or last customer on their cycles.
5. Repeat 4 until the savings list is handled or the capacities don't allow more merging.

The cycles if i and j are NOT united in sep 4, if the nodes belong to the same cycle OR the
capacity is exceeded OR either node is an interior node of the cycle.

Improvement: Optimize the tour of each vehicle with a TSP heuristic

Example 6.1. Given a complete graph with a central depot 0 and 9 customers. (The costs are
not directly proportional to the euclidean distances of the diagram.)
51

Symmetric costs:

c
ij 0 1 2 3 4 5 6 7 8 9
0 - 12 11 7 10 10 9 8 6 12

1 12 - 8 5 9 12 14 16 17 22

2 11 8 - 9 15 17 8 18 14 22

3 7 5 9 - 7 9 11 12 12 17

4 10 9 15 7 - 3 17 7 15 18

5 10 12 17 9 3 - 18 6 15 15

6 9 14 8 11 17 18 - 16 8 16

7 8 16 18 12 7 6 16 - 11 11

8 6 17 14 12 15 15 8 11 - 10

9 12 22 22 17 18 15 16 11 10 -

Demands:

i 1 2 3 4 5 6 7 8 9

di 10 15 18 17 3 5 9 4 6

Capacity of a vehicle: K = 40

Solution with Clarke & Wright:

Savings:
sij = c0i + c0j - cij

Symmetry: sij = sji

s
ij 1 2 3 4 5 6 7 8 9
1 15 14 13 10 7 4 1 2

2 9 6 4 12 1 3 1

3 10 8 5 3 1 2

4 17 2 11 1 4

5 1 12 1 7

6 1 7 5

7 3 9

8 8

Ordered savings: [4,5], [1,2], [1,3], [1,4], [2,6], [5,7], [4,7], [1,5], [3,4], [2,3], [7,9], [3,5], [8,9], [1,6],
[5,9], [6,8], [2,4], ...

Initial solution: cycles 0-1-0, 0-2-0, ... , 0-9-0.

Edge [4,5]: Join cycles 0-4-0 and 0-5-0: result 0-4-5-0, load d4 + d5 = 20 < K.
Edge [1,2]: Join 0-1-0 and 0-2-0: result 0-1-2-0, load d1 + d2 = 25 < K.
Edge [1,3]: Capacity limit: d1 +d2 +d3 = 43 > K.
Edge [1,4]: Capacity limit: d1 +d2 +d4 = 42 > K.
Edge [2,6]: Join cycles 0-1-2-0 and 0-6-0: result 0-1-2-6-0, load d1+d2+d6 = 30 < K.
Edge [5,7]: Join cycles 0-4-5-0 and 0-7-0: result 0-4-5-7-0, load d4+d5+d7 = 29 < K.

Edge [4,7]: Condition 4(i) doesn't hold: nodes belong to same cycle.

Edge [1,5]: Condition 4(iii) doesn't hold: node 5 is an interior node of its route.
Edge [3,4]: Capacity limit: d3 +d4 +d5 +d7 = 47 > K.
Edge [2,3]: Condition 4(iii) doesn't hold: node 2 is an interior node.

Edge [7,9]: Join cycles 0-4-5- 7- 0 and 0-9-0: result 0-4-5-7-9-0, load
d4+d5+d7+d9 = 35 < K.
Edge [3,5]: Condition 4(iii) doesn't hold: node 5 is an interior node.

Edge [8,9]: Join cycles 0-4-5-7-9-0 and 0-8-0: result 0-4-5-7-9-8-0, load
d4+d5+d7+d9+d8 = 39 < K.

Edge [1,6]: Condition 4(i) doesn't hold: nodes belong to same cycle.

Edge [5,9]: Condition 4(i) doesn't hold: nodes belong to same cycle.
Edge [6,8]: Capacity limit: (d1 +d2 +d6 )+(d4 +d5 +d7 +d9 +d8) = 69 > K.

Result: three routes that cannot be united because of capacity limit.

Solution:

0-3-0 18 14
0-1-2-6-0 30 37
0-4-5-7-9-8-0 39 46

Total cost f = 97

Sumber 3: http://courses.ieor.berkeley.edu/ieor151/lecture_notes/ieor151_lec18.pdf

Clarke and Wright's Savings Algorithm

Solving this problem exactly can be di difficult, and so a number of heuristics have been developed. One
of the conceptually simplest heuristics is Clarke and Wright's Savings Algorithm. The algorithm proceeds
as following:

1. Make n routes: v0 -> vi -> v0, for each i >= 1;

2. Compute the savings for merging delivery locations i and j, which is given by sij = di0 + d0j dij, for
all i; j >=1 and i != j;
3. Sort the savings in descending order;
4. Starting at the top of the (remaining) list of savings, merge the two routes associated with
the largest (remaining) savings, provided that:

(a) The two delivery locations are not already on the same route;

(b) Neither delivery location is interior to its route, meaning that both notes are still
directly connected to the depot on their respective routes;

(c) The demand G and distance constraints D are not violated by the merged route.

5. Repeat step (3) until no additional savings can be achieved.

3 Example
Consider the nodes described below, and note that the depot is located at node 0. Suppose we
would like to solve this vehicle routing problem (VRP) using the savings algorithm, for the
constraint that each vehicle has a capacity of 30 units (meaning it can carry less than or equal to
30 units).

Distance Node 0 Node 1 Node 2 Node 3 Node 4 Node 5 Node 6 Node 7 Demand

Node 0 0

Node 1 4 12

Node 2 4 5.66 12

We begin by computing the savings:

Node i Node j Savings

1 2 4 + 4 - 5.66 = 2.34
1 3 4 + 2.83 - 6.32 = 0.51
1 4 4+4-8= 0
1 5 4 + 5 - 8.54 = 0.46

1 6 4 + 2 - 4.47 = 1.53
1 7 4 + 4.24 - 3.16 = 5.08
2 3 4 + 2.83 - 2.83 = 4
2 4 4 + 4 - 5.66 = 2.34

2 5 4 + 5 - 8.06 = 0.94
2 6 4+2-6= 0
2 7 4 + 4.24 - 3.16 = 5.08
3 4 2.83 + 4 - 2.83 = 4

3 5 2.83 + 5 - 5.39 = 2.44

3 6 2.83 + 2 - 4.47 = 0.36
3 7 2.83 + 4.24 - 7.07 = 0
4 5 4+5-3= 6

4 6 4 + 2 - 4.47 = 1.53
4 7 4 + 4.24 - 7.62 = 0.62
5 6 5 + 2 - 4.12 = 2.88
5 7 5 + 4.24 - 7 = 2.24

6 7 2 + 4.24 - 3.16 = 3.08

Next, we merge routes using the savings sorted in descending order and taking into account
the capacity constraints of the vehicles gives:
Route Demand Length

0- 1 -0 12
0- 2 -0 12
0- 3 -0 6
0-4-0 16 4+4=8
0-5-0 15 5 + 5 = 10
0 -6 0 10
0 7 0 8
0 1 7 0 20
0 2 3 0 18 4 + 2.83 + 2.83 = 9.66
01 7 6 0 18 4 + 3.16 + 3.16 + 2 = 12.32

The nodes visited on each route, the demand associated with that route, and the route length
are given in the table above; note that routes in the solution are those that have not been crossed
out. Also note that depending on how duplicate values are sorted, it is possible to get the routes 0
1 7 6 0; 0 3 4 0; 0 2 5 0 as a solution which have lengths of 12.32, 9.66, 17.06, respectively.

The material in the rst section of these notes follows that of the journal paper G. Laporte, \The Vehicle
Routing Problem: An overview of exact and approximate algorithms," Euro-pean Journal of
Operational Research, vol. 59, pp. 234{358, 1992. The material in the last section of these notes follows
the course textbook \Service Systems" by Mark Daskin.

Sumber 4: A critical analysis of the “improved Clarke and Wright savings algorithm” –

The Clarke and Wright heuristic starts from a solution in which each of the n customers
is visited in a separate tour. The cost of this solution is equal to twice the sum of the travel
costs between the depot and all customers. For each customer pair, the algorithm then
determines the saving that would result from connecting these customers directly. The
algorithm then creates a savings list by sorting these savings in decreasing
order.

Two versions of the Clarke and Wright algorithm exist: a sequential version in which one
route at a time is built and a parallel version in which all routes are built simultaneously.
The parallel Clarke and Wright (PCW) heuristic is more common.
The PCW iteratively merges two routes by connecting a pair of customers. For two
customers to be connectable, they must be in different routes, they both need to be
connected directly to the depot, and the sum of the total demand of the two routes that
contain them must not be larger than the vehicle capacity. Each time a pair of customers
is connected, the cost of the solution is decreased with the saving incurred by this
customer pair. The algorithm proceeds down the savings list until no more customer pairs
can be connected.

The Clarke and Wright algorithm is a purely greedy algorithm: at each iteration it selects
the route merger that yields the largest saving. The deterministic nature of the Clarke and
Wright algorithm results in the algorithm producing the same solution every time it is run
on the same instance. A straightforward extension of such a greedy algorithm is to add a
controlled randomization in the greedy selection rule, to allow the algorithm to generate
a different solution at each iteration. This idea has been popularized in the GRASP
metaheuristic (greedy randomized adaptive search procedure; Feo and Resende 1995),
but is in fact older than that (Hart and Shogan, 1987). In most cases, the randomized
heuristic is executed several times and the best solution is reported. Solutions
constructed in this way may also be used as a starting point for a local search heuristic.

Sumber 5: An Improved Clarke and Wright Algorithm to Solve the Capacitated Vehicle
Routing Problem – Paper – Tapi yang diambil algoritma Clarke Wright biasanya.