Scientific Programming

Volume 2017 (2017), Article ID 1021432, 13 pages

https://doi.org/10.1155/2017/1021432

## A Modified Harmony Search Algorithm for Solving the Dynamic Vehicle Routing Problem with Time Windows

Department of Information Science and Technology, Dalian Maritime University, Dalian 116026, China

Correspondence should be addressed to Rong Chen

Received 19 April 2017; Accepted 2 November 2017; Published 28 November 2017

Academic Editor: Emiliano Tramontana

Copyright © 2017 Shifeng Chen et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

The Vehicle Routing Problem (VRP) is a classical combinatorial optimization problem. It is usually modelled in a static fashion; however, in practice, new requests by customers arrive after the initial workday plan is in progress. In this case, routes must be replanned dynamically. This paper investigates the Dynamic Vehicle Routing Problem with Time Windows (DVRPTW) in which customers’ requests either can be known at the beginning of working day or occur dynamically over time. We propose a hybrid heuristic algorithm that combines the harmony search (HS) algorithm and the Variable Neighbourhood Descent (VND) algorithm. It uses the HS to provide global exploration capabilities and uses the VND for its local search capability. In order to prevent premature convergence of the solution, we evaluate the population diversity by using entropy. Computational results on the Lackner benchmark problems show that the proposed algorithm is competitive with the best existing algorithms from the literature.

#### 1. Introduction

The Vehicle Routing Problem (VRP) was first introduced in 1959 [1]. Since then, it has become a central research problem in the field of operation research and is also an important application in the areas of transportation, distribution, and logistics. The problem involves a depot, some customers, and some cargo. The cargo must be delivered from a central depot to customers at various locations using several vehicles. This is a combinatorial optimization problem in which the goal is to find an optimal solution that satisfies the service requirements, routing restrictions, and vehicle constraints.

DVRPs have been a vital research area for last 3 decades. Thanks to recent advances in information and communication technologies, vehicle fleets can now be managed in real time. In this context, Dynamic Vehicle Routing Problems (DVRPs) are becoming increasingly important [2–4]. A variety of aspects is addressed by numerous approaches. Early research on DVRP can be found in Psaraftis’s work [5]. They proposed a dynamic programming approach. Bertsimas and Van Ryzin [6] considered a DVRP model with a single vehicle and no capacity restrictions where requests appear randomly. They characterized the problem by a generic mathematical model that regarded waiting time as the objective function. Regarding DVRPTW, Chen and Xu [7] proposed a dynamic column generation algorithm for the DVRPTWs based on their notion of decision epochs over the planning horizon, which indicate the best times of the day to execute the reoptimization process. de Oliveira et al. [8] addressed the issue that arises with customers whose demands take place in real time in the DVRPTW and a capacitated fleet. Their solution was obtained through a metaheuristic approach using an ant colony system. Hong [9] also considered time windows and the fact that some requests may be urgent. This work adopted a continuous reoptimization approach and used a large neighbourhood search algorithm. When a new request arrives, it is immediately considered to be included in the current solution; therefore, it runs the large neighbourhood search again to obtain a new solution. de Armas and Melián-Batista [10] tackled a DVRPTW with several real-world constraints. Similar to Hong’s work, they also adopted a continuous reoptimization approach, but they calculated solutions using a variable neighbourhood search algorithm. In some recent surveys, Pillac et al. [11] classify routing problems from the perspective of information quality and evolution. They introduce the notion of degree of dynamism and present a comprehensive review of applications and solution methods for dynamic vehicle routing problems. Bekta et al. [12] provide another survey in this area; they provide a deeper and more detailed analysis. Last but not least, Psaraftis et al. [13] shed more light into work in this area over more than 3 decades by developing a taxonomy of DVRP papers according to 11 criteria.

As we know, for large-scaled DVRPTW, it is very difficult to develop exact methods to solve this type of problem. The majority of the existing studies deal with the metaheuristics and intelligent optimization algorithms. Harmony Search (HS) algorithm is a metaheuristic algorithm, developed in [14]. This algorithm imitates the behaviors of musical improvisation process. The musician adjusts the resultant tones with the rest of the band, relying on his own memory in the music creation, and finally the tones reach a wonderful harmony state. Similarly, it has been successfully employed by many researchers to solve various complex problems such as university course scheduling [15, 16], nurse rostering [17], water network design [18], and the Sudoku puzzle [19]. Due to its optimization ability, the HS algorithm has also been employed as a search framework to solve VRPs. To solve the Green VRP (an extension of the classic VRP), Kawtummachai and Shohdohji [20] presented a hybrid algorithm based on the HS algorithm in which the HS is hybridized by a local improvement process. They tested the proposed algorithm with a real case from a retail company, and the results indicated that the method could be applied effectively to the case study. Moreover, Pichpibul and Kawtummachai [21] presented a modified HS algorithm for the capacitated VRP and incorporated the probabilistic Clarke-Wright savings algorithm into the harmony memory mechanism to achieve better initial solutions. Then, the roulette wheel selection procedure was employed with the harmony improvisation mechanism to improve its selection strategy. The results showed that the modified HS algorithm is competitive with the best existing algorithms. Recently, Yassen et al. [22] proposed a meta-HS algorithm (meta-HAS) to solve the VRPTW. The results of comparisons confirmed that the meta-HS produces results that are competitive with other proposed methods.

As described above, the HS algorithm has been successfully applied to solve standard VRPs but has not been applied to solve dynamic VRPs. Solving a dynamic VRP is usually more complex than solving the corresponding standard VRP, as we should solve more than one VRP when we deal with dynamic requests. It is well-known that minimizing travel distances of standard VRPs is NP-hard in the general case, so solving dynamic VRPs with the same objective function is also a hard computational task. In this paper, we propose a Modified Harmony Search (MHS) algorithm to solve the DVRPTW. It is related to the static VRPTW, as it can be described as a routing problem in which information about the problem can change during the working day. It is a discrete-time dynamic problem and can be viewed as a series of static VRPTW problem. Therefore, the MHS algorithm we proposed includes two parts: one is the static problem optimization; we combine the basic HS algorithm with the Variable Neighbourhood Descent (VND) algorithm, with the goal of achieving the benefits of both approaches to enhance searching. The combined HSVND algorithm distinguishes itself in three aspects: first, the encoding of harmony memory has been improved based on the characteristics of routing in VRPs. Second, this augmented HS was hybridized with an enhanced VND method to coordinate search diversification and intensification effectively. In this scheme, four neighbourhood structures were proposed. Third, in order to prevent premature convergence of the solution, we evaluate the population diversity by using entropy. The other is the dynamic customer check and insertion. Four rules were employed within the DVRPTW that address the insertion of dynamic requests into the DVRPTW. Furthermore, the MHS is verified for practical implementation by using a comparison study with other recently proposed approaches. The results show that our algorithm performs better than the compared algorithms; its average refusal rate was smallest among the three compared algorithms. Moreover, travel distances computed by our algorithm were also best in 29 out of 30 instances.

The remainder of this paper is structured as follows. The next section provides a formal mathematical model of DVRP. The notations are briefly described in Section 2. Section 3 describes the main framework and details the development of the HSVND algorithm for DVRP. The experimental setting and results are presented in Section 4. Finally, Section 5 summarizes the major conclusions of this article and recommends some possible directions for future research.

#### 2. Problem Definition

The DVRPTW can be mathematically modelled by an undirected graph , where is the set of vertices including the depot () and the customers , also called requests, orders, or demands and is the set of edges between each pair of vertices. Each vertex has several nonnegative weights associated with it, namely, a request time , a location coordinates , the demand , service time , and an earliest and latest , possible start time for the service, which define a time window , while is the service time range. At the same time, each edge is associated a travel time and a travel distance .

A total number of customers are to be served by fixed size fleet of identical vehicles, each vehicle has associated with a nonnegative capacity . Every customer has arrival time and begin service time . Particularly, the vehicle is only allowed to start the service no earlier than the earliest service time , . In other words, if a vehicle arrives earlier than , it must wait until . The customers can be divided into two groups, static customers () and dynamic customers (), according to the time at which the customers made their requests. Customers in whose locations and demands are known at the beginning of the planning horizon (i.e., time 0), are also called priority customers because they must be serviced within the current day. The locations and demands of customers who belong to set will be known only at the time of the order request. These customers call in requesting on-site service over time.

The objective is to accept as many requests as possible while finding a feasible set of routes with the minimum total travelled distance. The goal we consider here is a hierarchical approach, which is similar to the goal defined in [10]. The objective functions are considered in a lexicographic order as follows.(i)Number of refused customers.(ii)Total travelled distance.(iii)Total number of routes.

Note that [10] included 7 objective functions: total infeasibility (Sum of the hours that the customers’ time windows are exceeded), number of postponed services, number of extra hours (sum of hours that vehicles’ working shifts are exceeded), number of extra hours (sum of the hours that the vehicles’ working shifts are exceeded), total travelled distance, total number of routes, and time balance (difference between the longest and shortest route time made by one vehicle regarding time). They regarded the time windows as soft constraints; consequently, they needed to consider these additional objective functions. In contrast, because we regarded the time windows as hard constraints, the objective functions related to time windows could be removed.

The DVRPTW can be modelled by the following formulas. First, we introduce three binary decision variables , , and , which are defined as follows: = 1 if edge is travelled by vehicle and 0 otherwise. = 1 if vehicle is used and 0 otherwise. = 1 if the dynamic customer is accepted.

Then the main objective can be described as in the following formula:where is the vehicles arrival time at the customer and is the actual start time of , so as (9) stated. In addition, for each customer , let indicate the reverse arrival time, defined as (10).

The objective function (1) minimizes the number of refused customers, (2) aims to minimize the travel distance, and (3) minimizes the total number of routes. Eq. (4) is a flow conservation constraint: each customer must have its in-degree equal to its out-degree, which is at most one. Eq. (5) ensures that each customer must be visited by exactly one vehicle. Eq. (6) ensures that every route starts and ends the central depot. Eq. (7) specifies the capacity of each vehicle. Eq. (8)–(11) define the time windows. Finally, (12) imposes restrictions on the decision variables.

The degree of dynamism of a problem (Dod) [23] is defined to represent how many dynamic requests occur in a problem. Let and be the number of static and dynamic requests, respectively. Then, the Dod is described as follows:where Dod varies between 0 and 1. When Dod is equal to 0, all the requests are known in advance (static problem), whereas when it is equal to 1, all the requests are dynamic.

#### 3. Solution Approach

In this section, we present a metaheuristic algorithm to solve the DVRPTW. First, we introduce the framework of the heuristic algorithm to show how it can solve DVRPTWs interactively. Then, we discuss the details of the proposed harmony search-based algorithm, including its initialization, the way it improvises new solutions, and its VND-based local search method. Finally, we present some strategies used to accommodate dynamic requests.

##### 3.1. The Framework of the General Algorithm

The general algorithm to solve a DVRPTW interactively is summarized in Algorithm 1. First, the routes and deliveries to the static customers are solved by HSVND, which is our proposed harmony search-based algorithm described in Section 3.2. HSVND will return the best solution found, in which all the static customers have been inserted into routes. Consequently, the fleet can start to deliver goods for the customers based on the routes found in this solution. Then, dynamic customers submit requests. When a new dynamic customer request occurs, the algorithm will immediately check the feasibility of servicing the request Algorithm 3 (discussed in Section 3.3). If the request is acceptable, it then invokes the HSVND again to rearrange all the known customer requests that have not been serviced so far. Otherwise, the request will be rejected. This dynamic procedure is repeated until there are no new requests. Then, the entire solution including service for all static and dynamic customers’ requests will be returned by the general algorithm.