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.
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:
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.
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:
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
k, is selected by ant k in the route. According to the following transition rule, the probability of each node being visited is
j* = the unvisited node j in J
k for which [τ
(t)]β is maximized.
(t) = the amount of pheromone that is on the edge joining nodes i and j.
(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.
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:
where τ0, the initial amount of pheromone, is calculated as τ0 = (nC
)−1, n is the number of nodes, C
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 τ
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:
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.
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).
In this method, first, the nodes that should be visited by vehicles are ordered with respect to the depot by SW, and then, they are set in an array. Second, all of the states in which the above-mentioned order is preserved in spite of a change in their locations are obtained. For example, if 1 2 3 is the order obtained for a feasible solution, then orders 2 3 1 and 3 1 2 are set in other arrays. Then for each array, the vehicle starts to move from the depot and visits the nodes in the arrays in the order described until it is not possible to add a further node. This means that if the load of a vehicle is more than its capacity, it returns to the depot and repeats these steps until there is no more node to be visited. When vehicle routes are obtained, the ACS is implemented for every route until the best route is obtained.
Furthermore, the vast literature on meta-heuristics tells us that a promising approach for obtaining high-quality solutions is to couple a local search algorithm with a mechanism to generate initial solutions. The ACO’s definition includes the possibility of using local search as daemon actions. Daemon actions are used to implement centralized actions that cannot be performed by a single ant. An example of daemon actions is the activation of a local optimization procedure. In implementation, 3-opt local search procedure is used to obtain more improvement in the algorithm’s performance.
This algorithm, which is shown in Figure 7, is based on omitting three arcs of the tour that are not adjacent and connecting them again by another method. It can be noted that there are several routes for connecting nodes and producing the tour again, but a state that satisfies the problem’s constraints is acceptable. So, this unique tour will be accepted only if, first, the above constraints are not violated specially regarding each vehicle’s capacity, and second, the new tour produces a better value for the problem than the previous solution. Besides, omitting three arcs and reconnecting them are repeated until no improving 3-opt is found.
When all of these n arrays are gained, the best one is selected as the best solution, and the algorithm will be finished. So, it must be noted that although the hybrid algorithm is composed of two heuristic and one meta-heuristic method, the strengths of this algorithm in comparison with other algorithms such as ACO or TS are, first, the less time taken to obtain the solution and, second, the algorithm not needing many iterations to gain a better solution. In other words, when the ACS is activated, the number of nodes is decreased, and the algorithm can reach a good solution during the execution. In addition, because of the lack of division in other meta-heuristic algorithms, the quality of solutions obtained are usually less stable compared to those of this algorithm in various executions. A pseudo-code of the proposed algorithm for the VRP is presented in the Figure 8, while in the current section, the procedures of the algorithm are explained in detail.