Keywords

1 Introduction

The optimization of production processes in the industrial environment has been an object of study and research in various areas of knowledge, such as business management, economics, logistics, among others, being most notably studied in production engineering [1, 2]. In logistics, for example, the distribution of products and routing of vehicles are gaining space and becoming competitive advantages for companies. To reduce the delivery time, increasing the availability of products and inputs, it is mandatory to make deliveries respecting the deadlines. Nevertheless, the reduction of costs associated with the vehicles routing activity becomes an important tool for effective planning of products distribution.

The Vehicle Routing Problem (VRP) has attracted, in the last years, an increasing attention of researchers due to the great difficulty of its solution and its presence in many practical applications [3]. As consequence, there has been great effort to develop robust algorithms that can be modeled according to the scenario that describes a determined situation.

The Capacitated Vehicle Routing Problem is a variant of VRP and consists, basically, in determining the routes to be followed by a fleet of homogeneous vehicles, to serve a given number of customers, without violating the capacities of the vehicles [4]. The CVRP belongs to the class of NP-hard problems, that is, problems whose the solution usually requires non-polynomial complexity time algorithms and because of this are usually solved with the use of heuristic and metaheuristics algorithms such as Gillett & Miller [5], Clarke and Wright [6, 7], Tabu Search [6, 8], Simulated Annealing [6] and Genetic Algorithms [9, 10].

This work presents a strategy for CVRP optimization using Genetic Algorithms combined with two heuristics: Gillett & Miller and Hill Climbing. The first one is used to generate solutions that are included in the initial population of GA, starting it with some feasible solutions while the second is responsible for making a refinement of the solutions generated by the GA, after a certain number of generations without improvement. It is worth mentioning that among the works available in the literature, we did not find approaches using the constructive and refinement heuristics considered in this work combined with GA for solving CVPR.

The performed experiments showed that the proposed strategy presented good results for CVRP solution, confirming that the use of the employed heuristics helps the GA to converge on promising points in the search space with a smaller number of generations.

2 Theoretical Background

2.1 Capacitated Vehicle Routing Problem

The CVRP is the classic version of VRP in which all customers have their demands previously defined and that must be attended entirely by a only vehicle, the fleet is homogeneous, in other words, all vehicles are similar and run from only distribution center. In this problem, just the vehicle capacity restriction is imposed [6]. This restriction determines that the sum of the demand of all customers of a route does not exceed the capacity of vehicle used to execute that route.

Let G = (V, A) be a graph in which V = 0.....,n is the set of vertices that represent the customers and A the set of edges, representing the connections among the customers and the distribution center.

Each edge \((v_i,v_j)\) is associated with a cost, \(C_{ij}\), representing the cost of the connection between the vertices i and j. When \(C_{ij} = C_{ji}\), the problem is recognized as symmetrical, otherwise the problem is identified as asymmetrical. A set of K identical vehicles with capacity cv is allocated to the distribution center. For each customer vi a demand di is associated, and for the distribution center is defined d\(_{0}\) = 0.

In summary, the CVRP consists of finding a set of routes, where each route is traveled by a vehicle, with the objective of minimizing the total cost of the routes (tc), respecting the following restrictions: (i) Each route must start and finish at the distribution center; (ii) Each customer must be visited just only time and (iii) The sum of the customers’ demands included in a route can not exceed the vehicle’s capacity. The mathematical formulation of CVRP, adapted from Vieira [11], is expressed as follows:

Minimize

$$\begin{aligned} \small {tc=\sum _{i=0}^{nc} \sum _{\begin{array}{l} {j=0} \\ {j\ne i} \end{array}}^{nc} \sum _{k=1}^{K}c_{ij} x_{ijk}} \end{aligned}$$
(1)

Subject to

$$\begin{aligned} \small {\sum _{k=1}^{K} \sum _{\begin{array}{l} {j=1} {} \end{array}}^{nc} x_{0jk} \le K} \end{aligned}$$
(2)
$$\begin{aligned} \small {\sum _{j=1}^{nc} x_{0jk} =\sum _{\begin{array}{l} {j=1} {} \end{array}}^{nc} x_{j0k} =1,\begin{array}{cc} {}&{} \end{array}k=1,...,K} \end{aligned}$$
(3)
$$\begin{aligned} \small {\sum _{k=1}^{K}\sum _{j=0}^{nc} x_{ijk} =1,\begin{array}{cc} {}&{} \end{array}i=1,...,nc} \end{aligned}$$
(4)
$$\begin{aligned} \small {\sum _{j=0}^{nc}x_{ijk} -\sum _{j=0}^{nc} x_{ijk} =0,\begin{array}{cc} {}&{} \end{array}k=1,...,K\begin{array}{cc} {}&{} \end{array}i=1,...,nc} \end{aligned}$$
(5)
$$\begin{aligned} \small {\sum _{k=1}^{K}\sum _{i\in S}^{} \sum _{j\in S}^{} x_{ijk} \le \left| S\right| -v(S),\, \, \, \begin{array}{ccc} {\forall S}&{\subseteq }&{V\backslash } \end{array}\{ 0\} ,\, \, \, \left| S\right| \ge 2} \end{aligned}$$
(6)
$$\begin{aligned} \small {\sum _{i=1}^{nc}d_{i} \sum _{\begin{array}{l} {j=0} \\ {j\ne i} \end{array}}^{nc} x_{ijk} \le \, \, cv,\, \, \, k=1,...,K} \end{aligned}$$
(7)
$$\begin{aligned} \small {{x_{ijk} \in \, \{ 0,\, 1\} ,\, \, \, \, i=1,...,nc,\, \, \, \, j=1,...,nc,\, \, \, \, k=1,...,K}} \end{aligned}$$
(8)

where: \(d_i\): demand of customer i; k: vehicle; K: set of vehicles; S: Set of customers; nc: number of customers; v(S): Minimum number of vehicles to attend S; cv: Capacity of vehicles; \(c_{ij}\): cost of the connection from vertex i to vertex j; tc: is the total cost of routes (Eq. 1); \(x_{ijk}\): connection from the vertex i to vertex j with vehicle k;

Equation 2 ensures that K vehicles will be used starting from the distribution center, while the Eq. 3 guarantees that each route has its beginning and ending at the distribution center. Equation 4 defines that customers must be attended exactly one time and the Eq. 5 keeps the flow ensuring that the vehicle arrives at a customer and out of it, preventing that a route ends prematurely. The Eq. 6 prevents the formulation of routes which do not include the distribution center. In this restriction, v(S) represents the minimum number of vehicles required to attend a set of customers S.

To ensure that the number of vehicles used to attend the set customers of S is not less than v(S), the restriction 6 establishes, indirectly, that the capacity of the vehicle is not exceeded. However to let explicit, the Eq. 7 is used to formulate the capacity restriction. The Eq. 8 is related to the dimensions and allowed values of matrix x. The Eq. 9 is used to evaluate the solutions generated by the proposed strategy. It reflects the value of the objective function (OF) or fitness and involves the number of vehicles used in the solution, the violated restrictions (Eqs. 2 to 7) and the total cost of routes.

$$\begin{aligned} \small {OF=fitness=(K*W_{v} )+(nr*W_{r} )+tc_{}} \end{aligned}$$
(9)

where: \(W_v\) is the weight assigned to the number of vehicles used in the solution; nr is the Number of violated restrictions and \(W_r\) is the weight given to the violated restrictions.

2.2 Heuristics and Metaheuristic Techniques Employed by Proposed Approach

Genetic Algorithms (GA) are probabilistic search methods that are based on the evolutionary process, in other words, based on the theory of species evolution proposed by Charles Darwin [10]. GA present the following operational steps: starts a population containing a predefined number of individuals, in which each individual represents a possible solution. For each individual is attributed a value of aptitude or fitness, in our case represented by Eq. 9, which indicates how good is the individual in relation to the population. Thereby, individuals are selected based on their aptitudes and pass their characteristics to the next generation. To this end, it is applied the crossover and mutation methods between individuals, aiming the development of a new generation with fittest individuals (best solutions). This iterative process is repeated until the stopping criterion is reached [9].

The algorithm of Gillett & Miller [5] is based on the notion of economies and is part of the group of two stages heuristics (or constructive heuristics). The strategy consists in dividing the problem in two steps to solve it. In the first step, the vertices (points of demands) are grouped according to some criterion of proximity. Then, the routes are obtained by solution of CVRP for each of the formed groups of vertices [12].

The Hill Climbing algorithm is a local search technique based on depth [13]. It adjusts the position of a candidate solution (state) only if the new position (neighbor) is better than the current state. In other words, the optimization of this algorithm occurs by evaluating neighboring solutions of current state, based on their objective function values. At each step, the solution generated by the current state is replaced by the solution represented by the best neighbor and the algorithm terminates when it reaches a peak (or a valley when it is trying to minimize a fitness function), that is, when it did not find better solution in the neighborhood [14]. Due to the characteristics of this algorithm, it has been used for refining of solutions generated by metaheuristics, in solving several problems. In additon, when this algorithm is applied in a minimization problem, as CVPR addressed in this work, it is also referred as “downhill”.

3 Methodology

For development of proposed strategy, the programming language C/C++ and GAlib libraryFootnote 1 were used. The GAlib is a free library widely used in solving combinatorial optimization problems. To evaluate the strategy, experiments were performed and the results obtained were compared with the best results found in the literature, for the sets of instances from Christofides [15] and TSPLIBFootnote 2 with up to 30 customers. In the experiments, the following hardware configurations were used: Intel Celeron 2955U, 1.40 GHz processor; 4 GB of RAM; operating system Windows 7 Ultimate 32-bits.

4 Proposed Strategy for CVRP Optimization

In the proposed strategy (illustrated in Fig. 1), it was decided to represent the chromosome by a binary matrix with dimensions nc x nc x K, in which rows represent the number of customers to be visited, columns represent the order that customers will be visited and K, the number of vehicles (fleet). A chromosome is a solution contemplating customers information which will be attended by some vehicle, including customer visiting order. This representation facilitates the control of the restrictions imposed on the problem an also the execution of GA operations such as crossover and mutation.

Fig. 1.
figure 1

Sequence of operations employed by the proposed strategy.

In the refinement process by HC algorithm, the neighborhood of a current state (solution) is generated by shifting the elements of chromosome’s matrix in a circular manner along the two dimensions indicated by nc (rows/columns), considering four directions (up, down, left and right). The parameters used by GA were defined (empirically) as follows: Chromosome encoding = Binary Matrix; Population Size = 1200; Population subset for refinement (R) = 1/3 of population; Number of generations without improvement (gw) = 30; Number of Generations (used as stop criterion) = 5000; Population rate of replacement = 80%; Elitism = 20%; Crossover = 80%; Selection Method = Roulette; Rate of Mutation = 1%; Type of Mutation = Flip Bit.

5 Results and Discussion

In the evaluation of the proposed strategy, we performed ten tests for each of 16 considered instances and the results obtained were compared with the best solutions in the literature. For instances of Christofides [15], the optimal solutions presented by Reinelt and Wenger [16] were considered and for TSPLIB instances, the optimal solutions indicated by Ralphs et al. [17] were adopted.

To evaluate the goodness of the solutions obtained, a measure known in the literature as GAP was used. In our case, GAP = (OF_Med - OF_Best) OF_Best, being OF_Med the average of the objective function (OF) values obtained in the 10 tests (using Eq. 9) and OF_best the OF value of the best solution found in the literature. In addition, the standard deviation of OF values (\(OF_\sigma \)), the execution time and the best solution (OF*) obtained by our strategy, for each instance, are presented in Table 1. Nevertheless, we present in Table 2 the results of proposed strategy evaluation, with and without the use of heuristics Gillett & Miller and Hill Climbing were performed in a combined way, as follows: GA + GM + HC = Genetic Algorithms + Gillett & Miller + Hill Climbing; GA + GM = Genetic Algorithms + Gillett & Miller; GA + HC = Genetic Algorithms + Hill Climbing; GM = only Gillett & Miller; GA = Only Genetic Algorithms (without the use of heuristics).

Table 1. Results of experiments with the proposed strategy.

As can be seen in Table 1, the GAP in most cases (exception of instances “E-n13-k4”, and “E-n23-k3”) remained less than 10% and, for 38% of instances, the strategy found the best known solution (OF_Best). In addition, for 69% of instances the obtained GAP was less or equal than 5%.

The Table 1 also shows that the average GAP considering the 16 instances did not exceed 5%, showing the good performance of the strategy with respect to the quality of the solutions. It is also possible to observe that the standard deviation (\(OF_\sigma \)) in 81% of cases is less than 10 and, in 50% of the cases, it was obtained \(OF_\sigma \) less than 5, indicating good stability strategy with respect to the exploitation of the search space. Concerning the computational cost, the processing time ranges from 80 seconds to smaller instance (Eil7) to 250 seconds for larger instances (Eil30 and E-n30-k3). Thus, this strategy showed the relatively low computational cost. However, this processing time could be improved minimizing the sparsity of chromosome representation.

Table 2. Results of the experimental strategy with and without the application of heuristics.

Table 2 shows a comparison of the results obtained by the proposed strategy with and without the application of considered heuristics (GM and HC). Note that, in general, the results are better when these heuristics are embedded in GA. These results suggest that the use of heuristics Gillett & Miller and Hill Climbing helps the GA to converge for promising points in the search space, creating solutions with good quality.

6 Conclusions and Outlook

In this work, a hybrid strategy for solving the Capacitated Vehicle Routing Problem (CVRP) using Genetic Algorithms (GA) combined with the heuristics of Gillett & Miller (GM) and Hill Climbing (HC) was presented. From the computational experiments, it was possible to conclude that the proposed strategy achieved good results with re-spect to quality of solutions with low computational cost, considering the instances extracted from Christofides and TSPLIB libraries. The experiments also demonstrate that the use of heuristics Gillett & Miller and Hill Climbing helped the GA to converge on promising points in the search space with a smaller number of generations.