## Background

One of the parameters that is always in mind in production and services is the reduction of the product’s expense since lower product costs yield increase in the company’s competitive advantage in terms of production and services, so the company’s profit is growth. Furthermore, minimizing the transportation cost is one of the cost reduction methods in which the goods are transported from one place to other places with minimum cost. Therefore, effectively resolving the vehicle routing problem (VRP) is incredibly important in a distribution network of a logistics system.

A lot of research has been carried out in the field of logistics, from the traveling salesman problem to complex dynamic routing problems. Among the prominent problems in distribution and logistics, the vehicle routing problem and its extensions have been widely studied for many years, mainly because of their applications in real world logistics and transportation problems. The VRP has been proven to be a non-deterministic polynomial time problem ([Bodin & Golden 1981]). This means that the time of the VRP solution grows exponentially with increasing the distribution points.

A large number of techniques in the literature deal with the VRP and its variations such as VRP with pickup and delivery, time windows VRP, stochastic VRP, multi-depot VRP and others. Generally, the techniques used for solving the VRP can be categorized into exact, heuristic and hybrid methods. Although exact algorithms are appropriate for instances with small size, they are not often suitable for real instances owing to the computational time required to obtain an optimal solution. There have been many papers proposing exact algorithms for solving the VRP. These algorithms are based on column generation approach ([Choi & Tcha 2007]), implicit enumeration algorithm ([Ruiz et al. 2004]), branch-and-bound method ([Valle et al. 2011]), etc.

The VRP is an NP-hard problem and difficult to solve by exact methods within acceptable computing times ([Lee et al. 2003]). In other words, when the problem size of the VRP is increased, the exact methods cannot solve it. So, heuristic methods are necessary to be used for solving instances with large size in a reasonable amount of time. These algorithms can be divided into two main groups including classical heuristics and meta-heuristics. Since heuristic approaches are not so efficient for escaping local optimum values, the obtained solutions by them may have a large disparity compared to the best known or sub-optimal solutions. Some of the well-known heuristic algorithms are gravitational emulation search ([Clarke & Wright 1964]), local search ([Gillett & Miller 1974]) and Lin-Kernighan ([Christofides et al. 1979]).

A new kind of emerged algorithm basically tries to combine basic heuristic methods in higher level frameworks aimed at efficiently and effectively exploring a search space in the last 30 years. These methods are nowadays commonly called meta-heuristics. Since the meta-heuristic approaches are very efficient for escaping from local optimum, they are one of the best group algorithms for solving combinatorial optimization problem. A great number of meta-heuristic algorithms have been applied to the VRP, including genetic algorithm ([Baker & Ayechew 2003]), large neighborhood search ([Hong 2012]; [Pisinger & Ropke 2010]), tabu search (TS) ([Leung et al. 2011]), simulated annealing ([Osman 1993]), memetic algorithm ([Ngueveu et al. 2010]), neural networks ([Su & Chen 1999]) and particle swarm optimization ([Ai & Kachitvichyanukul 2009]). On the other hand, a limited amount of research addressing the VRP has used the ant colony optimization (ACO), with candidate lists and ranking techniques to improve the ability of a single ACO to solve the VRP ([Bullnheimer et al. 1998]; [Bullnheimer et al. 1999]).

Recently, many researchers have found that the employment of hybridization in optimization problems can improve the quality of problem solving in comparison with heuristic and meta-heuristic approaches. Since hybrid algorithms such as genetic algorithms with a local search ([Prins 2009]; [Lima et al. 2004]), genetic algorithms with sweep algorithm (SW) and nearest addition method ([Wang & Lu 2009]), ACO and greedy heuristics ([Zhang & Tang 2009]), simulated annealing and TS ([Lin et al. 2009]), neural networks and genetic algorithms ([Potvin et al. 1996a]; [Potvin et al. 1996b]), genetic algorithms and ACO ([Reimann et al. 2001]), etc. have greater ability to find an optimal solution, they have been considered by researchers and scientists in recent years.

The ACO approach is one of the famous meta-heuristic algorithms that simulates the ants’ food-hunting behavior and is used for solving combinatorial optimization problems that do not have a known efficient algorithm. This technique, one of the most powerful methods compared to other meta-heuristic algorithms nowadays, was introduced by Dorigo et al. in ([Dorigo 1992]) ([Dorigo et al. 1991]; [Dorigo 1992]). Because a limited amount of research addressing the VRP has used the ACO combined with heuristic algorithms, a hybrid meta-heuristic algorithm based on ant colony system is proposed for the VRP in this paper. In this algorithm, the VRP is solved by the SW firstly, and then the ant colony system (ACS) and 3-opt local search are used for improving the solutions.

In the following parts of this paper, in ‘VRP mathematical model’, we will explain the formulation of VRP. Then, at the beginning of ‘Methods’, we specially explain the SW and ACS, and then, the combination of ACS and SW is extendedly explained in this section. In ‘Numerical calculations’, the proposed algorithm will be compared with some of the other algorithms on standard problems, which are included in the VRP library. Finally in the last section, the conclusions are presented.

### VRP mathematical model

The VRP is one of the applied problems in the real world. This problem consists of a large number of customers in which everyone has a known demand level. These customers must be supplied from node 0 called the depot. Delivery routes which start and finish at the depot are required for vehicles so that all customer demands are satisfied and each customer is visited by just one vehicle. Vehicle capacities are given and limited by Q. So, the VRP can be explained mathematically as follows.

Let G (V, A) be a perfect undirected connected graph with a vertex set V = {0, 1, …, n} and an edge set A = {(i, j):i, j ∈ V, i ≠ j}. If the graph is not perfect, we can replace the lack of any edge with an edge that has an infinite size. Vertex 0 represents the depot; each of the other vertex i ∈ V − {0} is a customer with a non-negative demand q i , and a non-negative distance c ij is associated with each arc (i, j) ∈ A and represents the travel cost from node i to node j. The cost matrix is symmetric, i.e., for all i, j ∈ V, c ij  = c ji . The use of the loop arc (i, i) is not allowed and defining c ii  = + ∞ for all i ∈ V.

So, the solution for the VRP determines a set of delivery routes that satisfies the requirements of distribution points and obtains the minimum total cost for all vehicles. In practice, minimizing the total cost is equivalent to minimizing the total distance traveled by m > 1 vehicles.

An example of a single solution consisting of a set of routes constructed for a classical VRP is presented in Figure 1, where m = 4 and n = 12. So, the solution of this example is 0-1-2-3-4-0; 0-5-6-7-0; 0-8-9-10-0; 0-11-12-0.

For presenting the integer linear programming model for VRP, the variables below are introduced:

n = the number of nodes for each instance.

m = the number of vehicles used for each instance.

${x}_{\mathit{ij}}=\left\{\begin{array}{l}1\phantom{\rule{0.36em}{0ex}}\text{if}\phantom{\rule{0.12em}{0ex}}\text{the}\phantom{\rule{0.12em}{0ex}}\text{vehicle}\phantom{\rule{0.24em}{0ex}}\text{travels}\phantom{\rule{0.24em}{0ex}}\text{directly}\phantom{\rule{0.12em}{0ex}}\text{from}\phantom{\rule{0.24em}{0ex}}\text{node}\phantom{\rule{0.12em}{0ex}}i\text{\hspace{0.17em}to}\phantom{\rule{0.12em}{0ex}}\text{node}\phantom{\rule{0.12em}{0ex}}j\\ 0\phantom{\rule{0.24em}{0ex}}\text{otherwise}\text{.}\end{array}$
(1)
${y}_{\mathit{ik}}=\left\{\begin{array}{l}1\phantom{\rule{0.36em}{0ex}}\text{if}\phantom{\rule{0.12em}{0ex}}\text{the}\phantom{\rule{0.12em}{0ex}}\text{node}\phantom{\rule{0.12em}{0ex}}i\phantom{\rule{0.12em}{0ex}}\text{is}\phantom{\rule{0.12em}{0ex}}\text{visited}\phantom{\rule{0.12em}{0ex}}\text{by}\phantom{\rule{0.12em}{0ex}}\text{the}\phantom{\rule{0.12em}{0ex}}\text{vehicle}\phantom{\rule{0.12em}{0ex}}k\\ 0\phantom{\rule{0.24em}{0ex}}\text{otherwise}\text{.}\end{array}$
(2)

Hence, one of the integer programming formulations for the VRP can be written as follows:

$min\sum _{i=0}^{n}\sum _{j=0}^{n}{c}_{\mathit{ij}}{x}_{\mathit{ij}}$
(3)

subject to

$\sum _{i=0}^{n}{x}_{\mathit{ij}}=1\left(j=1,\dots ,n\right)$
(4)
$\sum _{i=0}^{n}{x}_{i0}=m$
(5)
$\sum _{j=0}^{n}{x}_{\mathit{ij}}=1\left(i=1,\dots ,n\right)$
(6)
$\sum _{j=0}^{n}{x}_{0j}=m$
(7)
$\sum _{i=0}^{n}{q}_{i}{y}_{\mathit{ik}}\le Q\left(k=1,\dots ,m\right)$
(8)
$\sum _{i\in S}\sum _{j\in N-S}{x}_{\mathit{ij}}\ge 1\left(\varphi \ne S\subset \left\{1,\dots ,n\right\},\left|S\right|\ge 2$
(9)
$\sum _{i\in N-S}\sum _{j\in S}{x}_{\mathit{ij}}\ge 1\left(\varphi \ne S\subset \left\{1,\dots ,n\right\},\left|S\right|\ge 2$
(10)
${x}_{\mathit{ij}}\in \left\{0,1\right\}\left(i=0,\dots ,n\text{;}\phantom{\rule{0.12em}{0ex}}j=0,\dots ,n\right)$
(11)
${y}_{\mathit{ik}}\in \left\{0,1\right\}\left(i=0,\dots ,n;k=1,\dots ,m\right)$
(12)

The objective function (1) minimizes the total distance traveled in a tour. Constraint sets (2) and (3) ensure that the vehicle arrives once at each node and m times at the depot. Constraint sets (4) and (5) ensure that the vehicle leaves each node once and leaves the depot m times. Constraint set (6) prevents vehicles from carrying loads more than their capacity. Constraint sets (7) and (8) avoid the presence of sub-tours for each vehicle. Finally, Constraint sets (9) and (10) define binary conditions on the variables.

## Results and discussion

### Numerical calculations

At the first stage in this section, sensitivity analyses of parameters in the proposed algorithm (PA) are performed, and at the second stage, the SW + ACS, which was discussed in the previous section, is analyzed using several benchmarking problems of Christofides et al. ([Christofides et al. 1979]) and Taillard ([Taillard 1993]). The proposed algorithm was coded using MATLAB language executed on a computer with a 1.00-GB RAM and an Intel, 2.80-GHz CPU.

#### Sensitivity analyses of parameters

In this section, the parameters in our algorithm are tuned, in which there are four parameters including α, β, ρ and q0. The ranges of the four parameters were set to α ∈ {1, 2, 3}, β ∈ {2, 4, 6}, ρ ∈ {0.1, 0.2, 0.3} and q0 ∈ {0.9, 0.95, 0.99}. When tuning the parameters, the instance E-n51-k5 was determined as the test problem. Then, the algorithm with each parameter combination for this instance was tested five times.

Based on the gained results, the algorithm with the smaller weight parameter (α) of pheromone trails possesses higher performance. This may be attributed to the fact that in the SW + ACS, the initial pheromone trails are large values. If using the large control factor of the pheromone trail, the effect of visibility value is weakened and results in a premature convergence. In addition, the qualities of the solutions of the algorithms with β = 2 are better than those of 4 and 6.

From the test results, it can be found that by setting the evaporation factor to 0.1, the proposed algorithm can yield better solutions. This can be attributed to the fact that if pheromone evaporation is too rapid, it more easily results in the search to be trapped in local minimum. In other words, the smaller evaporation factor can ensure the sufficient diversity of search space and guide following ants to explore better solutions.

Finally, the SW + ACS, in which q0 is set to 0.99, can provide better solutions in comparison with other values. Thus, the combinations of optimal parameters are determined: {α = 1, β = 2, ρ = 0.1, q0 = 0.99}.

#### Benchmark instances

In the instances of Christofides et al. ([Christofides et al. 1979]), which can be downloaded from the DEIS - Operations Research Group Library of Instances (DEIS - Operations Research [Group 2012]), the results obtained from calculations by the proposed methods are compared with other algorithms including saving algorithm (SA), saving algorithm + 3-opt (SA + 3-Opt), TS search and ACO. The first two of these algorithms are traditional, and the next two are relatively new. These algorithms were executed on standard instances containing between 51 and 200 nodes of the VRP problem including E-n51-k5, E-n76-k10, E-n101-k8, E-n101-k10, E-n121-k7, M-n151-k12 and M-n200-k17. The number at the right of each instance shows the number of vehicles, and the middle number indicates the number of related customers.

Table 1 summarizes the computational results of the proposed, compared and other mentioned algorithms. Moreover, to show the method’s performance more clearly, we present the best known solutions (BKSs) that have been published in the related literature in this table.

Besides, Figure 2 shows a comparison between the gap values of the heuristic and meta-heuristic algorithms, where the gap is defined as the percentage of deviation from the best known solution in the literature. The gap is equal to 100[c(s**) − c(s*)]/c(s*), where s** is the best solution found by the algorithm for a given instance, and s* is the overall best known solution for the same instance on the web. A zero gap indicates that the best known solution is found by the algorithm.

As can be seen from Table 1, the proposed algorithm finds the optimal solution for one out of seven problems that are published in the literature. The results indicate that SW + ACS is a competitive approach compared to the traditional and new meta-heuristics. For instances E-n101-k8 and M-n200-k17, the gap is relatively as high as 3%. However, in other instances, the proposed algorithm finds nearly the best known solution, i.e., the gap is below 0.76%, and overall, the average difference is 1.1%. The performance comparison of results shows that the SW + ACS method clearly yields better solutions than the ACO, saving algorithm and its modified version (SA + 3-opt).

Moreover, computational results of the proposed algorithm and TS show that these algorithms have a close competition, and the proposed algorithm gives four better solutions than the TS. In other words, the performance of the SW + ACS is better in reaching the sub-optimal solution than the TS (Table 1).

From the statistical viewpoint in Table 2, there is no statistical significant difference between the PA and other meta-heuristic algorithms (p value = 0.9881). Furthermore, it can be observed from both the medians plot (Figure 3) and the means plot (Figure 4) that the PA is better than the ACO, SA + 3-Opt and SA algorithms. Also, by observing these figures, we can yield the approximate equality of the PA and TS methods.

In Table 3, the values obtained by the common ACO and proposed algorithm are shown. The results indicate that these two algorithms have very good ability for small problems, have approximately similar behavior and can converge to the best solutions. However, this ability of ACO against the proposed algorithm decreases when the number of nodes and feasible solutions increases.

Table 4 shows the results obtained for the second problem instances including 12 instances proposed by Taillard and presents the comparison between the best results of our algorithm and the BKS. As shown in Table 4, in three cases, the BKS can be found by our algorithm. In other cases, the deviation between the BKS reported and the solution found by the proposed algorithm is very low. In addition, the proposed algorithm finds closely the BKS for most of the instances, i.e., the gap is below 1.10%.

## Conclusions

In this paper, a hybrid algorithm combining ACS, SW and 3-opt local search was proposed for solving the VRP. The SW + ACS is more efficient than the ACO. Especially for large-size problems, this algorithm yields better solutions compared with previous algorithms. Another benefit of this algorithm is that when ACS is used, the number of nodes and complexity of the problem are decreased. As a result, the algorithm can solve these small problems easily. So, it is not necessary for the algorithm to be executed many times for finding the best solutions since the SW and 3-opt local search do not have great time requirements. It also seems that the combination of the proposed algorithm and genetic or simulated annealing algorithms will yield better results. Using the proposed algorithm for other versions of the VRP is suggested for future research.

## Methods

Because the VRP is one of the most important combinatorial optimization problems, a hybrid algorithm called SW + ACS is proposed in this paper. In this section, the SW is presented first then the ACS will be explained, and finally, the hybrid algorithm will be analyzed in more detail.

### Sweep algorithm

Gillett and Miller ([Gillett & Miller 1974]) proposed a SW in 1974 for Euclidean networks, which ranks and links demand points by their polar coordinate angle (Figure 5). The polar coordinate angle is calculated as follows:

$\text{An}\left(i\right)=arctan\left\{\left(y\left(i\right)-y\left(0\right)\right)/\left(x\left(i\right)-x\left(0\right)\right)\right\}$
(13)

It is noted that if y(i) − y(0) < 0 and y(i) − y(0) ≥ 0 then − π < An(i) < 0 and 0 ≤ An(i) ≤ π, respectively. In this algorithm, which is one of the famous and powerful heuristic algorithms, at first, the polar coordinates of all n customers are calculated, where the depot is node 0 and so An(1) = 0.

Then, sweeping (clockwise or counterclockwise) is started from customer i, which has not been visited, from the smallest angle to the largest angle until all customers are included in a tour.

$0=\text{An}\left(1\right)\le \text{An}\left(2\right)\le \dots \le \text{An}\left(n\right)\text{.}$
(14)

### Ant colony system

ACS is one of the most powerful versions of ACO. This meta-heuristic algorithm was introduced in 1996 by Dorigo and Gambardella ([Dorigo & Ganbardella 1997]), which was strongly inspired by the ant system (AS). So, this algorithm achieves performance improvements because of the introduction of new mechanisms based on ideas not included in the original AS. The ACS algorithm has two major changes to the rules employed in the AS algorithm, namely:

1. (1)

A novel transition rule that favors either exploitation or exploration is introduced. Node j that is next to node i, among the unvisited nodes J i k, is selected by ant k in the route. According to the following transition rule, the probability of each node being visited is

${P}_{\mathit{ij}}^{k}\left(t\right)=\left\{\begin{array}{ll}1\hfill & \text{if}\left\{q\le {q}_{0}\phantom{\rule{0.5em}{0ex}}\text{and}\phantom{\rule{0.5em}{0ex}}j={j}^{*}\hfill \\ 0\hfill & \text{if}\left\{q\le {q}_{0}\phantom{\rule{0.5em}{0ex}}\text{and}\phantom{\rule{0.5em}{0ex}}j\ne {j}^{*}\hfill \\ \frac{{\tau }_{\mathit{ij}}^{\alpha }\left(t\right){\eta }_{\mathit{ij}}^{\beta }\left(t\right)}{{\sum }_{r\in {J}_{i}^{k}}{\tau }_{\mathit{ir}}^{\alpha }\left(t\right){\eta }_{\mathit{ir}}^{\beta }\left(t\right)}\phantom{\rule{0.5em}{0ex}}\text{otherwise}\hfill \end{array}$
(15)

Where

j* = the unvisited node j in J i k for which [τ ir (t)][η ir (t)]β is maximized.

τ ij (t) = the amount of pheromone that is on the edge joining nodes i and j.

η ij (t) = the heuristic information for the ant visibility measure defined here as the reciprocal of the distance between node i and node j.

α, β = two control parameters that represent the relative importance of the amount of pheromone on the edge between node i and node j compared to the ant visibility value respectively.

q = a random variable in [0, 1].

q0 = a given arbitrary parameter fixed before the program is started such that when q is less than q0, the ant employs exploitation to select node j* as the next node in its tour, whereas if q exceeds q0, the ant uses probabilistic exploration to select the next node in its tour.

1. (2)

There are two ways for updating pheromone trail as follows:

Local updating: When an ant moves from node i to node j, it updates the amount of pheromone on the traversed edge using the following formula:

${\tau }_{\mathit{ij}}\left(t+1\right)=\left(1-\rho \right).{\tau }_{\mathit{ij}}\left(t\right)+\rho {\tau }_{0}\begin{array}{c}\hfill \text{if}\left(i,j\right)\in {T}_{k}\hfill \end{array}$
(16)

where τ0, the initial amount of pheromone, is calculated as τ0 = (nC i )−1, n is the number of nodes, C i is the cost of the initial tour produced by a construction heuristic such as the nearest neighbor heuristic, SW, etc., and ρ is a parameter called evaporation rate in the range [0, 1] regulating the reduction of pheromone on the edges. It should be noted that local updating has an important effect, such that whenever an ant traverses an edge (i, j), its pheromone trail τ ij is reduced. So, the edge becomes less desirable for the ants in future iterations. Local updating not only encourages an increase in the exploration of edges that have not been visited yet but also helps avoid poor stagnation situations.

Global updating: When all tours are generated by ants, the edges that belong to the best tour are updated using the following formula:

${\tau }_{\mathit{ij}}\left(t+1\right)=\left(1-\rho \right).{\tau }_{\mathit{ij}}\left(t\right)+\rho \left(1/{C}_{\text{b}}\right)\begin{array}{c}\hfill \text{if}\left(i,j\right)\in {T}_{\text{b}}\hfill \end{array}$
(17)

where Cb is the cost of the best tour Tb found yet. It is important to note that the pheromones of the edges belonging to the best tour are only updated in the global updating. This encourages ants to search in the vicinity of this best tour in future iterations.

### Hybrid algorithm

From another viewpoint, there are also two heuristic groups for solving combinatorial optimization problems: construction algorithms that produce a feasible solution themselves, and improvement algorithms that can improve the solutions with having a feasible solution. Here, a construction algorithm, namely SW, and two improvement algorithms, namely ACS and 3-opt local search, are used. In this algorithm, the ACS is applied for improving every route of the vehicle; however, the nodes of each vehicle should be unchanged. On the other hand, the 3-opt local search is used for changing nodes and improving each vehicle. In other words, if this algorithm is separated into two parts, the first one to improve the route of the vehicle without changing the vehicle’s nodes and the second one to improve it only by changing the vehicle’s nodes, then the ACS does operation 1 and the 3-opt local search does operation 2 (Figure 6).