Open access peer-reviewed chapter - ONLINE FIRST

Comparative Study of Algorithms Metaheuristics Based Applied to the Solution of the Capacitated Vehicle Routing Problem

By Fernando Francisco Sandoya Sánchez, Carmen Andrea Letamendi Lazo and Fanny Yamel Sanabria Quiñónez

Submitted: October 7th 2019Reviewed: March 3rd 2020Published: May 12th 2020

DOI: 10.5772/intechopen.91972

Downloaded: 21

Abstract

This chapter presents the best-known heuristics and metaheuristics that are applied to solve the capacitated vehicle routing problem (CVRP), which is the generalization of the TSP, in which the nodes are visited by more than one route. To find out which algorithm obtains better results, there are 30 test instances used, which are grouped into 3 sets of problems according to the position of the nodes. The study begins with an economic impact analysis of the transportation sector in companies, which represents up to 20% of the final cost of the product. This case study focuses on the CVRP for its acronym capacitated vehicle routing problem, analyzing the best-known heuristics such as Clarke & Wright and sweep, and the algorithms GRASP and simulated annealing metaheuristics based.

Keywords

  • vehicle routing problem
  • VRP
  • CVRP
  • heuristics
  • metaheuristics
  • Clarke & Wright
  • sweep heuristic
  • GRASP
  • simulated annealing

1. Introduction

Logistics as a science has its origins in the military area; the transportation of weapons, food, and men at the service was coordinated through it. With the passage of time, the concept began to be applied in the business field, and for a long period of time, the logistics function was considered as a habitual, operational, and necessary activity to take the products from the seller to the buyer (Ballou, 2004). A little later, starting in the 1950s, a cycle of growth and constant demand increase was experienced throughout the world, which caused the production and sales capacity to exceed the companies’ ability to distribute products. Thus, in those years, delivering orders on time became a problem due to poor compliance. Then, in 1980, the concept of response time was created, which is the union between the concept of physical distribution and material management; specialists realized that the faster the response time to the customer, the more the profitability of the company increased.

As the concepts were changing, the methods as well and the companies looked for ways to become efficient; in this way they expanded the activities related to logistics and determined that one of the heaviest items is transportation costs, representing on average, between 10% and 20% of the final cost of the product or service (Toth and Vigo, 2002).

Although transport decisions are expressed in a variety of ways, the main ones are mode selection, route design, vehicle programming, and shipment consolidation (Ballou, 2004). In relation to the route design problem, the problem is commonly known as vehicle routing problem (VRP). Both the companies that own the transport service as part of their processes and the companies that provide the service seek to optimize resources within the route selection, since a good selection brings savings in time, resources such as fuel, maintenance of the fleet, salaries, and improvements, among others, in service indicators as a promise of product delivery.

The VRP can be considered as the natural extension of the TSP, in the sense that unlike the TSP, in the VRP we consider that the vehicles, or the agents in charge of providing a service to the nodes, have a limited capacity; therefore, most likely the entire route cannot be made through a single route, with a single vehicle that leaves and returns to the storage, traveling all the nodes, but to respect the restriction of the limited capacity of the vehicles so. In general, several routes are required, or what is the same, the solution of the VRP will be a set of Hamiltonian cycles that start from the deposit and such that each node is traveled only once.

2. Vehicle routing problem

The vehicle routing problem (VRP) consists in determining a set of routes for a fleet of vehicles that depart from one or more warehouses to meet the demand of several geographically dispersed customers [1].

The VRP objective is to meet the demand of the customers, optimizing some objective, which is generally the total cost involved in the routes, which is affected by the vehicular congestion of large cities, the high-energy consumption of cargo vehicles, and other factors.

Since the VRP problem is a generalization of the TSP, and knowing that the TSP is of the NP-hard problem class [2], it is concluded that the VRP is also a difficult problem of the NP-hard class.

The VRP model has many classifications by the different characteristics that can be included or considered in it. The most basic version is reflected with the CVRP capability (for the acronym of capacitated vehicle routing problem). The CVRP has the following assumptions:

The fleet of vehicles is homogeneous, that is to say all cargo vehicles have the same characteristics:

  1. The demand is known in advance, that is, the quantity to be delivered for each client is known; this means that the demand is deterministic.

  2. Each vehicle will carry the entire delivery to customers, prohibiting the distribution of fractional or partial loads that would later be completed by another vehicle.

  3. All vehicles in the fleet have exactly the same load capacity.

  4. The starting point of the vehicles is only one and is considered a central warehouse.

  5. Vehicles have capacity restrictions that are known in advance.

3. Classic heuristics to solve VRP

Heuristics are simple processes that perform a limited space search and generate acceptable solutions in moderate calculation times; an important characteristic of these methods is that they are designed to solve a specific optimization problem, and in general they cannot be used to solve other optimization problems. A more advanced class are the so-called metaheuristics, which are considered more advanced methods than heuristics, in the sense that they guide their construction and, therefore, are general purpose [3].

There are many advantages, and also disadvantages, when using heuristic algorithm methods to solve optimization problems, as described [4] within the reasons to use heuristic methods which are as follows:

  1. The problem is that no exact method for its resolution is known.

  2. Although there is an exact method to solve the problem, its execution is computationally very expensive.

  3. A heuristic method is more flexible than an exact method, that is, difficult modeling conditions can be incorporated.

  4. The heuristic method is used as part of a global process that certifies an optimal solution. There are two possibilities:

    1. The heuristic method provides a good initial starting solution.

    2. The heuristic method participates in an intermediate step of the procedure, such as the selection rules of the variable to enter the base in the simplex method.

3.1 Savings based heuristics

There are several types of heuristic methods to solve the VRP, which are addressed extensively in Braekers et al. []4, trying to generate broad, nonexclusive categories, where the best-known heuristics are located to solve this problem; among them one of the most used and popular algorithms is the one of Clarke & Wright, and that has had contributions from different authors [5].

This algorithm is based on successively combining subtours until a Hamiltonian cycle is obtained, of which the subtours have a common node or vertex called base or initial.

The method can be described as follows:

  • Having a solution of two different routes 0i0and 0j0can be joined by creating a new route 0ij0.

  • The distance savings obtained by the union is

sij=ci0+c0jcijE1

In Eq. (1) sijis the savings on the total distance traveled if the two routes 0i0and 0j0are joined.

  • An initial solution is started in this algorithm, and the unions that give greater savings are made as long as they do not violate the restrictions of the problem.

  • When the maximum saving is negative, the combinations of the routes will increase the distance traveled, but the amount of routes in the solution will decrease; depending on the characteristics of each problem, this can generate circular or radial routes that can be avoided by placing a reference value λ, which penalizes the union routes with distant customers. Saving is proposed as

sij=ci0+c0jλcijE2

In Eq. (2) sijrepresents penalized savings with the weight λin the total distance traveled if the two routes 0i0and 0j0are joined, which prevents when possible, merging routes with nodes far apart.

3.1.1 Application of savings algorithm

  1. Step 1: With the coordinates of each client or city, prepare the distance matrix.

  2. Step 2: Calculate the sijsavings table for each pair of nodes.

  3. Step 3: For each client or city i, build the route 0i0.

  4. Step 4: Order savings from highest to lowest.

  5. Step 5: Starting with the greatest savings, join the corresponding nodes, so that

  6. sij=maxsij, where the maximum is taken between the savings that have not yet been considered; the route, rij, will be created, if iis the last customer of de ri; and jis the first customer of rj. Remove sijfrom future considerations. Repeat step 5 until there are no more combinations of savings (Olivera, 2004; Pacheco, 2005).

3.1.2 Example of application of the savings algorithm

A company wants to solve the problem of routing and design of the fleet of its product xto its 10 customers in the city and has a homogeneous fleet of trucks with capacity for 100 units of x product, with locations and demand shown in Table 1.

Table 1.

Cardinal coordinates of storage and customers with their demand.

There are details in the Cartesian coordinates of the warehouse and each customer with the demand, while in Figure 1, the position of each customer and the warehouse is shown.

Figure 1.

Customer and warehouse positioning.

  1. Step 1: The matrix of Euclidean distances between each pair of nodes is calculated: Table 2 shows the distance matrix between all customers along with the warehouse. This matrix is symmetrical, that is, it has the same distance to go from client ito client jand vice versa. Point 0 has been considered for the warehouse (whs).

Cijwhsc1c2c3c4c5c6c7c8c9c10
whs25.4619.8019.657.0725.0015.8123.6029.1524.1911.05
c125.465.6623.0226.4233.0640.2237.2254.206.7133.62
c219.805.6619.6521.0229.6134.6733.0048.607.2828.18
c319.6523.0219.6526.0042.2034.0014.8739.4517.1218.97
c47.0726.4221.0226.0018.0314.1430.6131.6226.9317.09
c525.0033.0629.6142.2018.0325.0048.6045.0036.8834.89
c615.8140.2234.6734.0014.1425.0032.2020.0039.8117.09
c723.6037.2233.0014.8730.6148.6032.2029.6131.7815.26
c829.1554.2048.6039.4531.6245.0020.0029.6151.6221.26
c924.196.717.2817.1226.9336.8839.8131.7851.6230.48
c1011.0533.6228.1818.9717.0934.8917.0915.2621.2630.48

Table 2.

Distance matrix.

  1. Step 2: Once the distance matrix is obtained, the savings are calculated. For the savings matrix, no row or column is placed for the warehouse.

For example, the savings between customer 1 and customer 2 is

s12=c1bdg+cbdg2c12E3
s12=25.46+19.805.66=39E4

In Table 3 all the savings are shown; in the same way the matrix is ​​symmetric.

Sijc1c2c3c4c5c6c7c8c9c10
c139.6022.086.1117.401.0411.840.4142.932.89
c219.805.8515.180.9410.400.3536.712.67
c30.722.441.4628.389.3626.7211.72
c414.048.740.064.604.331.03
c515.810.009.1512.311.16
c67.2124.970.199.77
c723.1416.0119.38
c81.7218.94
c94.75
c10

Table 3.

Savings matrix.

  1. Step 3: The route 0i0is built for each client. In Figure 2 each route is shown from the warehouse to each customer and back to the warehouse.

Figure 2.

Clarke & Wright heuristics step 1 route development 0 i 0 .

  1. Step 4: Savings are organized from the highest to lowest.

In the list of savings to choose, only the savings that can be chosen are considered.

When the list is prepared with all the savings, those savings that one or both clients have already considered in a previous route are discarded.

  1. Step 5: To assemble the routes, the restrictions are considered; for this example the only restriction is the capacity of the truck that does not exceed 100 units of the product x.

For the first route, the highest savings are chosen and placed in the form 0i0; in this case 0is the warehouse (whs), as the savings are chosen to add them to the existing route or create a new one; the demands of each client are added, and the route is closed when the sum of the demands is equal to or less than the capacity of the truck 100 units, but when adding one more client, the demand exceeds the capacity, and you can no longer choose that customer.

The composition of the routes is displayed step by step in Figure 3, and the complete route diagram is shown in Figure 4. Below is the composition of the routes with the demands.

Route 1: whs, c1, c9, whsRoute demand 1: 17 + 14 = 31
Route 1: whs, c2, c1, c9, whsRoute demand 1: 31 + 25 = 56
Route 2: whs, c3, c7, whsRoute demand 2: 10 + 28 = 38
Route 1: whs, c2, c1, c9, c3, c7, whsRoute demand 1: 56 + 38 = 94
Route 2: whs, c6, c8, whsRoute demand 2: 15 + 36 = 51
Route 2: whs, c6, c8, c10, whsRoute demand 2: 51 + 24 = 75
Route 2: whs, c5, c6, c8, c10, whsRoute demand 2: 75 + 20 = 95
Route 3: whs, c4, whsRoute demand 3: 29

Figure 3.

Step by step: routing of Clarke & Wright heuristics.

Figure 4.

Final routes by Clarke & Wright algorithm.

Consequently, Clarke & Wright algorithm determines a solution for the routing problem in which the distance traveled is 204.20 units in length.

3.2 Heuristic method of assigning first, routing after

Sweep heuristics are the best-known method of assigning first, routing later.

This method is solved in two phases. First, groups of customers called clusters are created considering the capacity constraints of the vehicles, and second for each cluster, a route is generated that visits all customers.

In sweep heuristic, clusters are created by turning a half-straight in the central tank from the horizontal counterclockwise; after that the customers are incorporated into the mentioned group until the maximum capacity restriction of the vehicles is met.

This heuristic is used to find solutions to geographical problems, that is to say in which the nodes or vertices correspond to a point in the plane. It is assumed that the location of each client ican be represented through its polar coordinates riθihaving a single central deposit. It defines

θi=arctanYiYwhsXiXwhswhereπ<ri<0siYiYwhs<0y0<ri<πsiYiY10,i=12nri=polar radio coordinate of theithpositioni=12nE5

3.2.1 Steps for sweep heuristics

  1. Step 1: Prepare the table of the location of the nodes in polar coordinates.

  2. Step 2: Customers or cities are sorted in ascending order by θ; if two clients or cities have the same θvalue, the one with the lowest rvalue is chosen first. Then a customer or city wis selected to start and makek=1yCk=w.

  3. Step 3: If all clients or cities are in a cluster, go to step 4. Otherwise, a client or city is selected; wiand wiare added to Ckif you do not exceed the capacity restrictions; if you exceed them, create a new cluster for which, k=k+1and Ck=wi. Repeat step 2 until there are no clients or cities without a cluster.

  4. Step 4: For each cluster Ckfor t=1,,k, solve traveling salesman problem (TSP) with its clients and a solution that can be a local optimum is obtained until not checking otherwise.

  5. Step 5: Return to step 2 to reorder customers where the first becomes the last, the second the first, and so on until the original sorting. For each change, steps 3 and 4 are performed again, and the best of the solutions obtained is taken (Olivera, 2004; Pacheco, 2005).

3.2.2 Example of sweep heuristics

We will take the example of the savings algorithm.

  1. Step 1: Formula (5) is used to obtain the polar coordinate table, where θiis expressed in radians and riis the directed distance. Table 4 shows the polar coordinates for each client i. The change of polar coordinates is displayed (Figure 5).

riθi
c125.46−2.36
c219.80−2.36
c319.652.88
c47.07−0.79
c525.00−0.93
c615.810.32
c723.602.21
c829.151.03
c924.19−2.62
c1011.051.66

Table 4.

Polar coordinates for each i.

Figure 5.

Node location.

  1. Step 2: It is sorted by θifrom least to greatest, as seen in Table 5.

riθi
c924.19−2.62
c219.80−2.36
c125.46−2.36
c525.00−0.93
c47.07−0.79
c615.810.32
c829.151.03
c1011.051.66
c723.602.21
c319.652.88

Table 5.

Ascending ordering of customers.

  1. Step 3: To elaborate the routes, it is done in two phases, the first one where the clients are grouped by the sweep method and the second one where a TSP is resolved (step 4).

For the sweep method, the angles from the smallest to the largest are chosen, and it moves counterclockwise.

As can be seen in Table 5, customers are already sorted in ascending order by their angular polar coordinate, and customers are chosen until they fail to comply with the capacity restriction of the truck that is 100 units of product x. Considering this the routes are as follows:

Route 1: whs, c9, c2, c1, c5, whsRoute demand 1: 14+25+17+20 = 76
Route 2: whs, c4, c6, c8, whsRoute demand 2: 29+15+36 = 80
Route 3: whs, c10, c7, c3, whsRoute demand 3: 24+28+10 = 62

In Figure 6, the sweeps are visualized starting with client 9 that has the greatest angle, thus grouping them in zones in this case by colors and within each one for their best distance. The sweep groups customers do not violate the restriction of the truck.

Figure 6.

First phase of sweep heuristics, grouping.

In Figure 7, the solution is shown with three routes before the TSP is applied.

Figure 7.

First phase of sweep heuristics, solution with three routes.

  1. Step 4: In the second phase to each route already generated in the first, it is resolved by TSP, for this case with the nearest node.

The routes are as follows:

Route 1: whs, c9, c1, c2, c5, whsRoute demand 1: 14+17+25+20 = 76
Route 2: whs, c4, c6, c8, whsRoute demand 2: 29+15+36 = 80
Route 3: whs, c10, c7, c3, whsRoute demand 3: 24+28+10 = 62

Thus, the sweep algorithm has a local solution for the routing problem in which the distance traveled is 222.36 units in length.

In Figure 8, the route diagram is displayed.

Figure 8.

Routes by sweep algorithm.

  1. Step 5: Repeat step 2 where the customers already ordered from Table 5, continue to rotate the position until the first returns to be first, and for each rotation, steps 3 and 4 are performed, and after all iterations, the best is selected.

Below is the iteration that had the best result. Table 6 shows the fifth iteration of nine where you start with client six (Figure 9).

riθi
c615.810.32
c829.151.03
c1011.051.66
c723.602.21
c319.652.88
c924.19−2.62
c125.46−2.36
c219.80−2.36
c525.00−0.93
c47.07−0.79

Table 6.

Customer ordering—fifth iteration.

Figure 9.

First phase of sweep heuristics, grouping—fifth iteration.

After performing step 3 in Figure 10, the grouping of customers is appreciated to not violate the restriction of the truck’s capacity.

Figure 10.

Routes by sweep algorithm—fifth iteration.

In step 4, each grouping is resolved with a TSP, and the following routes are obtained:

Route 1: whs, c6, c8, c10, whsRoute demand 1: 15+36+24 = 75
Route 2: whs, c7, c3, c9, c1, c2, whsRoute demand 2: 28+10+14+25+17 = 94
Route 3: whs, c5, c4, whsRoute demand 3: 20+29 = 49

In Figure 10, the diagram of the routes of the fifth iteration is displayed, which obtained the best response.

The sweep algorithm determines a solution for the routing problem in which the distance traveled is 205.96 units in length, that is, a solution of lower quality than that obtained by the Clarke & Wright algorithm with 204.20 units in length.

4. Metaheuristics

The term metaheuristics first appeared in the seminal article about taboo search (Glover, 1987). The term metaheuristics is obtained by putting the suffix “meta” before the word heuristic, which means “beyond” or “at a higher level.”

Metaheuristics are generic procedures that, through approximate algorithms, guide a subordinate heuristic by combining the exploration of the solution space for optimization problems, obtaining better results than classical heuristics in a longer period; however, this time is less than if the exact methods are used.

Metaheuristics that have been considered for this comparative study are shown below, which correspond to constructive and local search procedures [4].

4.1 GRASP

GRASP methods had their origins at the end of the 1980s in order to find a solution to problems of joint coverings, and in 1995 by Feo and Resende, this metaheuristic is of general purpose [6].

The word GRASP comes from the acronym of greedy randomized adaptive search procedures that would be something like search procedures based on voracious adaptive random functions.

GRASP has a multistart process in which each step has a construction and an improvement phase. In the construction phase, the constructive heuristic process obtains a good initial solution, which is improved in the second phase by a local search algorithm. The best of all solutions examined is saved as the final result.

There are many implementations of GRASP metaheuristics, including variants and hybridizations with other procedures such as variable neighborhood search or path relinking, with which this metaheuristic has proven to work very well in practice as demonstrated in Marti and Sandoya [7]. A simple scheme to represent the operation of this algorithm is as follows:

While (stop condition)

Construction phase:

  • Choose a list of candidate elements.

  • Have a restricted list with the best candidates.

  • Select an item randomly from the restricted list.

Improvement phase:

  • Perform a local search process based on the solution built until it can no longer be improved.

Update:

  • If the solution obtained improves to the best stored, update it.

In the construction phase, a possible solution is built iteratively, considering an element in each step. In each iteration the choice of the next element to be added to the partial solution is determined by a greedy function, which examines the benefit of adding each of the elements according to the objective function and choosing the best one.

This metaheuristic works with a restricted list of the best candidates, which makes the best candidate randomly selected for each iteration of the construction phase.

In the improvement phase, the results that are obtained from the construction phase are not usually local optimal; therefore, a local search procedure is applied as post-processing to perfect the solution obtained.

Performing several iterations is a way of sampling the solution space.

4.2 Simulated annealing

The simulated annealing metaheuristics was introduced in the 1950s by Metropolis Hastings to be used in the field of statistical thermodynamics simulating cooling processes of a material.

In 1983 the method was refocused to solve combinatorial optimization problems of great complexity by Scott Kirkpatrick, C. Daniel Gelatt and Mario P. Vecchi, and independently in 1985 by Vlado Cerny. For its implementation ease, this metaheuristic had a great boom in the 1980s.

Simulated annealing has its procedure based on local search by environments that is characterized by an acceptance criterion of neighboring solutions that are adapted throughout its execution.

A temperature variable is used, T, that determines the extent to which neighboring solutions, worse than the currentn,can be accepted. This variable is about starting it with a high value, which is called the initial temperature, T0, which generates a high probability of accepting a nonimprovement movement. In each iteration the temperature decreases through a temperature cooling mechanism, α, having a smaller probability until approaching the optimal solution and reaching a final temperature, Tf. Costs also decrease as the temperature decreases, making it increasingly difficult to accept bad movements in search of the solution.

In each iteration a specific number of neighbors is generated, which can be fixed for the entire execution or depend on each iteration.

Each time a neighbor is generated, the acceptance criterion is applied to see if it replaces the current solution:

  • If the neighboring solution is better than the current one, it is automatically accepted, as it would be done in the classic local search.

  • If the neighboring solution is worse than the current one, there is still a chance that the neighbor will replace the current solution. This allows the algorithm to exit from local optimum, in which the classic local search would be trapped.

This model is given by the following structure:

Take an initial solution x

Take an initial temperature T

While (not frozen)

Perform Ltimes

  1. Take xfrom Nx

  2. d = f(x′) – f(x)

  3. If d<0dox=x

  4. Ifd>0dox=xwith p=ed/T

  5. Take action of the cooling mechanism T=rT

The following parameters are determined:

  1. Initial temperature: it is established by doing a series of tests to reach a certain fraction of accepted movements.

  2. Cooling speed r.

  3. LengthLthat must be proportional to the expected size of Nx.

  4. When the cooling sequence ends, it is frozen cont=cont+1when a temperature is completed and the percentage of movements accepted is less than MinPercent.cont=0when the best stored solution is improved.

5. Implementation of heuristics and metaheuristics for the resolution of CVRP

5.1 Test instances

The cases to be evaluated are divided into three groups classified by the type of client with 10 examples each. Next, some tables will be presented, which have the name of instance, the truck’s capacity in columncap, the number of customers in column n, the number of vehicles to be used in columnk, and the optimal solution in column opt.

  1. Clustered clients, as shown in Table 7, belong to the Augerat B set in 1995 [8] and specify that the coordinates are points between [0,100] × [0,100] in the grid that are chosen to form neighborhood groups (NC) closest, where kNC1. The demands have a uniform distribution U130; however, n/10was multiplied by3.

  2. Random clients, as shown in Table 8, belong to the Augerat set A in 1995 and specify that the coordinates are points between [0,100] × [0,100] placed randomly. The demands have a uniform distribution U130; however, n/10was multiplied by 3.

  3. Clustered and random clients, as shown in Table 9, belong to the Augerat set X in 1995 and specify that the coordinates are points between [0,1000] x [0,1000] that are grouped and placed randomly, where kis the minimum feasible number of vehicles.

InstancesCapnkOpt
ClusteredB-n31-k5100305672
B-n34-k5100335788
B-n35-k5100345955
B-n38-k6100376805
B-n39-k5100385549
B-n41-k6100406829
B-n43-k6100426742
B-n44-k7100437909
B-n45-k5100445751
B-n45-k6100446678

Table 7.

Instances of set B.

InstancesCapnkOpt
RandomA-n32-k5100315784
A-n33-k6100326742
A-n34-k5100335778
A-n36-k5100355799
A-n37-k5100365669
A-n37-k6100366949
A-n38-k5100375730
A-n39-k5100385822
A-n39-k6100386831
A-n44-k6100436937

Table 8.

Instances of set A.

InstancesCapnkOpt
Clustered and randomX-n101-k252061002527,591
X-n106-k146001051426,362
X-n110-k13661091314,971
X-n115-k101691141012,747
X-n120-k621119613,332
X-n125-k301881243055,539
X-n129-k18391281828,940
X-n134-k136431331310,916
X-n139-k101061381013,590
X-n143-k71190142715,700

Table 9.

Instances of set X.

6. Results

The results for the 30 selected test cases are shown below, applying the heuristics and metaheuristics studied in Chapter 3 and 4 to know which one has a response that is closer or equal to the optimum by group of client positioning.

To define which has a better quality solution, the gap analysis or difference analysis is used, which consists in calculating the difference between the optimal solution and the solution obtained, divided for the solution obtained and expressed as a percentage.

The solution of the real case is also presented through the heuristics and metaheuristics that offer the best solution given the characteristic of the clients’ positions.

6.1 Test cases resolved by heuristics

Clarke & Wright heuristics have better quality solutions, solving problems where customers with a small nare grouped.

Table 10 shows that for the group of clients with gathered positions, the gap is 3.63%; for the positions of random clients, the gap is 5.18%; and in less effective way for customers with grouped and random positions, it has a gap of 6.55%.

DataClarke & Wright
InstancesCapnkOptkResultGap (%)
ClusteredB-n31-k51003056725681.201.37
B-n34-k51003357885794.300.80
B-n35-k51003459555978.302.44
B-n38-k61003768056832.103.37
B-n39-k51003855495566.703.22
B-n41-k61004068297898.108.34
B-n43-k61004267426782.005.39
B-n44-k71004379097937.703.16
B-n45-k51004457515757.200.83
B-n45-k61004466787727.807.35
Average3.63
RandomA-n32-k51003157845843.707.61
A-n33-k61003267427776.304.62
A-n34-k51003357786810.404.16
A-n36-k51003557995828.503.69
A-n37-k51003656695707.805.80
A-n37-k61003669496976.602.91
A-n38-k51003757306768.105.22
A-n39-k51003858225902.009.73
A-n39-k61003868316863.103.86
A-n44-k61004369377976.004.16
Average5.18
Clustered and randomX-n101-k252061002527,5912828940.004.89
X-n106-k146001051426,3621427280.003.48
X-n110-k13661091314,9711315870.006.00
X-n115-k101691141012,7471113490.005.83
X-n120-k621119613,332614540.009.06
X-n125-k301881243055,5393358830.005.93
X-n129-k18391281828,9401830300.004.70
X-n134-k136431331310,9161411520.005.53
X-n139-k101061381013,5901114530.006.92
X-n143-k71190142715,700717770.0013.18
Average6.55

Table 10.

Clarke & Wright heuristics results.

It also compares the number of vehicles kthat were obtained when solving each case against the optimal solution, and it was obtained that 12 cases had a vehicle more than the optimum B-n41-k6, B-n45-k6, A-n33-k6, A-n34-k5, A-n38-k5, A-n44-k6, X-n106-k14, X-n115-k10, X-n134-k13, and X-n139-k10, and two cases had three more than the optimal vehicles X-n101-k25 and X-n125-k30.

Sweep heuristics are more effective in solving problems where customers with a small nare grouped together. However, the difference in the average gap between random and grouped customers is short.

Table 11 shows that for the group of customers with grouped positions, the gap is 8.68%; for random customer positions; the gap is 8.85%; and in a less effective way for customers with grouped and random positions, it has a gap of 17.00%.

CustomersMinimum gap (%)Maximum gap (%)Average gap (%)
Clustered0.808.343.63
Random2.919.735.18
Clustered and random3.4813.186.55

Table 11.

Clarke & Wright heuristic gaps comparison.

It also compares the number of vehicle numbers kthat were obtained when solving each case against the optimal solution, and it was obtained that seven cases had a vehicle more than the optimal B-n45-k6, A-n38-k5, A-n39-k5, X-n115-k10, X-n129-k18, X-n134-k13, and X-n139-k10; one case had five more vehicles than the optimum X-n101-k25, and one case had six more vehicles than the optimal X-n125-k30.

In each group of clients, the sweep heuristic obtained better answers than the Clarke & Wright heuristics with 30% in the group of clients with a grouped position, 30% in the group of clients with a random position, and 20% in the group of clients with grouped and random position. In other words, Clarke & Wright heuristics are superior with 70% in the first two groups of clients and with 80% in the last group of clients.

A comparison among the values of the Distance traveled in the solution found by the heuristic, the optimal solution and the GAP for each one of the considered test instances is shown in Table 12.

DataSweep
InstancesCapnkOptkResultGap (%)
ClusteredB-n31-k51003056725696.693.67
B-n34-k51003357885889.5112.88
B-n35-k51003459555966.931.25
B-n38-k61003768056838.994.22
B-n39-k51003855495613.4511.74
B-n41-k61004068296884.536.70
B-n43-k61004267426750.921.20
B-n44-k710043790971137.4625.13
B-n45-k51004457515836.0811.33
B-n45-k61004466787736.628.65
Average8.68
RandomA-n32-k51003157845885.0412.89
A-n33-k61003267426751.651.30
A-n34-k51003357785786.441.08
A-n36-k51003557995862.717.97
A-n37-k51003656695736.3510.07
A-n37-k610036694971087.4614.59
A-n38-k51003757306818.4612.12
A-n39-k51003858225882.537.36
A-n39-k61003868316900.148.32
A-n44-k610043693761056.8412.79
Average8.85
Clustered and randomX-n101-k252061002527,5913034368.5024.56
X-n106-k146001051426,3621430035.9013.94
X-n110-k13661091314,9711315769.305.33
X-n115-k101691141012,7471114894.2016.84
X-n120-k621119613,332614495.408.73
X-n125-k301881243055,5393669342.4024.85
X-n129-k18391281828,9401936941.8027.65
X-n134-k136431331310,9161413835.9026.75
X-n139-k101061381013,5901114850.909.28
X-n143-k71190142715,700717593.5012.06
Average17.00

Table 12.

Sweep heuristic results.

On the other hand, Table 13 shows a summary of the minimum, maximum and average gap for each of the three classes of problems considered: Clustered, Random and Clustered, and Random.

CustomersMinimum gap (%)Maximum gap (%)Average gap (%)
Clustered1.2025.138.68
Random1.0814.598.85
Clustered and random5.3327.6517.00

Table 13.

Sweep heuristic gap comparison.

6.2 Test cases resolved through metaheuristics

The GRASP metaheuristics are based on a previous solution for which Clarke & Wright heuristic responses were selected since their responses are of better quality than the sweep heuristics.

The following parameters were considered for its implementation:

  • α = 0.5

  • Number of iterations = 10,000

GRASP’s metaheuristics are more effective in solving problems where customers with a small nare grouped together.

Table 14 shows that for the clients with grouped positions; the gap is 3.09%; for the positions of random clients, the gap is 4.38%; and less effectively for customers with grouped and random positions, it has a gap of 5.97%.

DataGrasp
InstancescapnkOptkResultGap (%)
ClusteredB-n31-k51003056725679.051.05
B-n34-k51003357885788.000.00
B-n35-k51003459555968.851.45
B-n38-k61003768056830.453.16
B-n39-k51003855495564.852.89
B-n41-k61004068297897.248.23
B-n43-k61004267426777.984.85
B-n44-k71004379097932.362.57
B-n45-k51004457515755.230.56
B-n45-k61004466787719.806.17
Average3.09
RandomA-n32-k51003157845830.675.95
A-n33-k61003267427776.024.58
A-n34-k51003357786809.384.03
A-n36-k51003557995823.203.03
A-n37-k51003656695695.423.95
A-n37-k61003669496976.612.91
A-n38-k51003757306765.874.91
A-n39-k51003858225901.999.73
A-n39-k61003868316856.933.12
A-n44-k61004369377951.731.57
Average4.38
Clustered and randomX-n101-k252061002527,5912828891.904.71
X-n106-k146001051426,3621427199.803.18
X-n110-k13661091314,9711315847.905.86
X-n115-k101691141012,7471113436.605.41
X-n120-k621119613,332614192.906.46
X-n125-k301881243055,5393358809.105.89
X-n129-k18391281828,9401830298.404.69
X-n134-k136431331310,9161411492.205.28
X-n139-k101061381013,5901114521.106.85
X-n143-k71190142715,700717491.8011.41
Average5.97

Table 14.

GRASP metaheuristic results.

On average metaheuristic GRASP based is better than Clarke & Wright heuristics by 0.53%, 0.77%, and 0.38% in the solutions of the positions of the grouped, random, and grouped and random clients, the group of clients with random positions being those that obtained a greater improvement in the quality of the solutions.

The simulated annealing metaheuristics start from a previous solution for which Clarke & Wright heuristic responses were selected since their responses are of better quality than the sweep heuristics.

The following parameters were considered for its implementation:

  • Current temperature = 250

  • Final temperature = 10

  • Cooling coefficient = 0.8

  • Number of iterations = 10,000

The simulated annealing metaheuristic is more effective in solving problems where customers with a small nare grouped together.

Table 15 and 17 shows that for clients with grouped positions, the gap is 3.13%; for the positions of random clients, the gap is 4.41%; and less effectively for clients with grouped and random positions, it has a gap of 6.26%.

DataSimulated annealing
InstancesCapnkOptkResultGap (%)
ClusteredB-n31-k51003056725681.201.37
B-n34-k51003357885793.200.66
B-n35-k51003459555959.500.47
B-n38-k61003768056819.501.80
B-n39-k51003855495565.002.91
B-n41-k61004068297897.008.20
B-n43-k61004267426778.604.93
B-n44-k71004379097937.303.11
B-n45-k51004457515756.200.69
B-n45-k61004466787726.167.10
Average3.13
RandomA-n32-k51003157845830.705.96
A-n33-k61003267427776.304.62
A-n34-k51003357786810.404.16
A-n36-k51003557995828.503.69
A-n37-k51003656695695.003.89
A-n37-k61003669496976.602.91
A-n38-k51003757306762.004.38
A-n39-k51003858225888.608.10
A-n39-k61003868316856.903.12
A-n44-k61004369377967.603.27
Average4.41
Clustered and randomX-n101-k252061002527,5912828850.004.56
X-n106-k146001051426,3621427240.003.33
X-n110-k13661091314,9711315790.005.47
X-n115-k101691141012,7471113480.005.75
X-n120-k621119613,332614420.008.16
X-n125-k301881243055,5393358790.005.85
X-n129-k18391281828,9401830300.004.70
X-n134-k136431331310,9161411500.005.35
X-n139-k101061381013,5901114530.006.92
X-n143-k71190142715,700717670.0012.55
Average6.26

Table 15.

Results of simulated annealing metaheuristics.

On average simulated annealing heuristics based is better than Clarke & Wright heuristics by 0.52%, 0.71%, and 0.21% in the solutions of grouped, random, and grouped and random clients’ positions, the group of clients with random positions being those that obtained a greater improvement in the solutions quality.

Within each group of clients, the simulated annealing metaheuristics obtained better answers than the GRASP metaheuristics with 30% in the group of clients with a grouped position, 50% in the group of clients with a random position, and 40% in the group of clients with grouped and random position. That is, the GRASP metaheuristic is superior with 70% in the first group and with 60% in the third group of clients and is equal with 50% in the second group of clients.

A comparison between the minimum and maximum gap within each group is established in Table 16 test results with clustered clients have better results. Therefore, obtaining a minimum gap of 0%, that is, in the case of B-n34-k5, the GRASP metaheuristic obtained the optimal solution (Table 17).

CustomersMinimum gap (%)Maximum gap (%)Average gap (%)
Clustered0.008.233.09
Random1.579.734.38
Clustered and random3.1811.415.97

Table 16.

GRASP metaheuristic gap comparison.

CustomersMinimum gap (%)Maximum gap (%)Average gap (%)
Clustered0.478.203.13
Random2.918.104.41
Clustered and random3.3312.556.26

Table 17.

Simulated annealing metaheuristics gap comparison.

7. Conclusions

The results obtained by solving the test cases by heuristics and metaheuristics show both generate better quality solutions when solving cases where customers are grouped together and had their worst result in the group of clients with a grouped and random position since they had largenwith reference to the other groups of clients. Between the heuristics, Clarke & Wright heuristics generated better quality results than sweep heuristics, having a big difference in the maximum gaps of each one for each group of clients. However, the numbers of vehicles obtained in the solutions of both heuristics were compared with the optimal solution, and the sweep heuristics had more solutions in which it reached the optimum. This is a very important contribution, since Clarke & Wright heuristics get solutions with shorter distances than the sweep heuristic, but this gets greater distances with fewer vehicle units. For some companies it will be more important to reduce the units to buy than the distance traveled.

Analyzing the metaheuristics, the GRASP metaheuristics generated better quality results than simulated annealing metaheuristics, with minimal differences in average gap for each group of clients, and both metaheuristics obtained greater improvements in relation to the initial solutions of Clarke & Wright heuristics in the test cases of randomized clients. Also GRASP algorithm with B-n34-k5 case of grouped customers reached the optimal solution, being the only test instance of the thirty that were done.

It is recommended that for future studies, each group of clients by positioning has a number of clientsnwith greater variability to be able to deduce exactly if heuristics and metaheuristics have better or worse solutions when nare larger or smaller.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Fernando Francisco Sandoya Sánchez, Carmen Andrea Letamendi Lazo and Fanny Yamel Sanabria Quiñónez (May 12th 2020). Comparative Study of Algorithms Metaheuristics Based Applied to the Solution of the Capacitated Vehicle Routing Problem [Online First], IntechOpen, DOI: 10.5772/intechopen.91972. Available from:

chapter statistics

21total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us