### A matheuristic for the consistent vehicle

### routing problem with service level

### agreements: a case study in the

### pharmaceutical distribution sector

### Pedro Filipe Dias Belchior Campelo

Masters’ Dissertation

Supervisor: Prof. Pedro Sanches Amorim

### Mestrado Integrado em Engenharia Industrial e Gestão

## Abstract

Distributors are being pressured to increase the frequency of deliveries and to provide better service as customers look to them as business partners that allow them to decrease stock levels and to have a quicker and more reliable response to stock-outs. Moreover, in highly compet-itive markets, overall customer satisfaction and the provided service level are the main drivers behind customer retention. For these reasons, companies in this environment are looking to-wards customer-focused solutions, such as consistent routing strategies. However, in complex and unpredictable environments with stochastic customers and demand, robust routes with driver consistency are hard to plan and to implement.

A mathematical model was then developed to tackle the Consistent Vehicle Routing Problem while considering customers with multiple daily deliveries and different service level configura-tions, such as time windows, daily period specifications and order deadlines right before vehi-cle departure. In addition, an instance size reduction algorithm and a Fix-and-optimize based matheuristic are presented. This solution approach allows the use of the model to solve instances of larger size, thus enabling its application in real-life scenarios.

A case study in a Portuguese pharmaceutical distribution company is then analyzed, in which a database and key performance indicators dashboard is developed. The proposed model and matheuristic are then used to plan their routes in five different warehouses, with instances having up to 905 total number of orders. Finally, a simulation model is created to test the performance of the new robust routes plans under real historical data, while also enabling the evaluation of what-if scenarios.

By applying the matheuristic to historical data, the model was able to reduce the overall objec-tive value by 7.2% and the total traveled distance by 5.5%. Simulations were then run to compare the performance of the robust routes plan proposed by our model to the routes currently in place which were mainly developed using a commercial route planner. In the simulated horizon, using the routes suggested by our model while optimizing the route sequence, the total traveled distance is reduced by 17.4% and the total route durations decrease by 8.4%. These improvements have an estimated impact of 12.7% in the monthly distribution cost of the company considered to be influenceable by the project.

## Resumo

As empresas de distribuição têm sido pressionadas para aumentarem a frequência das entregas e para forncerem um serviço de maior qualidade visto que os seus clientes os vêem como par-ceiros de negócio que permitem uma redução dos níveis de existências e uma resposta mais rápida quando há falta de produtos. Em mercados altamente competitivos, a satisfação dos clientes e o nível de serviço são os fatores mais importantes na retenção de clientes. Por estas razões, as empresas que operam nestes setores consideram cada vez mais soluções focadas no cliente como sistemas de rotas fixas. No entanto, em ambientes mais complexos e imprevisíveis, com clientes e procura estocásticos, as rotas robustas com consistência de condutor são difíceis de planear e de implementar.

Um modelo matemático foi então desenvolvido para atacar o Consistent Vehicle Routing Prob-lem, a considerar clientes com diversas entregas diárias e com configurações de nível de serviço diferentes tais como janelas de entrega, especificações de período diário de entrega e limites de pedido próximos da hora de saída do veículo. Um algoritmo de redução de tamanho de instancias por agrupamento de entregas e uma matheurística baseada no Fix-and-Optimize são apresentadas. Este método de solução permite o uso do modelo com instâncias significativamente maiores, o que torna possível a sua aplicação em cenários reais.

Um caso de estudo numa empresa portuguesa de distribuição de medicamentos é depois anal-isado, no qual uma base de dados e um mapa de indicadores de desempenho são desenvolvidos. O modelo e a matheurística propostos são então usados para planear as rotas de cinco centros de distribuição diferentes, tendo as instâncais um total de até 905 entregas. Por fim, o desempenho dos novos planos de rotas robustas é testado num modelo de simulação com dados reais, sendo que o mesmo modelo também permite a análise de condições de negócio alternativas.

Ao aplicar a matheurística a dados históricos, o modelo foi capaz de, em média, reduzir a função objetivo global em 7.2% e a distância percorrida em 5.5%. Foram então realizadas simu-lações para comparar o desempenho dos planos de rotas robustas propostos pelo modelo com os planos usados atualmente pela empresa que foram desenvolvidos através de um sotware de rotea-mento. No horizonte temporal simulado, ao usar as rotas sugeridas pelo modelo e a otimizar o sequência em que são feitas, foi possível diminuir, em média, a distância percorrida em 17.4% e a duração total das rotas por 8.4%. Estas melhorias têm um impacto nos custos mensais de distribuição da empresa considerados influenciáveis pelo projeto estimado em 12.7%.

## Acknowledgements

First and foremost I would like to thank my supervisor, Prof. Pedro Sanches Amorim, for giving me the opportunity to be a part of such an exciting adventure throughout this semester. His uninterrupted encouragement and overwhelming dedication not only put me through the harder times but also inspired me to constantly strive for greatness. I am utterly grateful for his friendship and for becoming a role model for my professional development and future endeavors.

I would like to thank Fábio Moreira for his unceasing support which was definitely the cor-nerstone to all the work developed during this dissertation. His presence in the team provided never-ending motivation and invaluably enjoyable recreational moments.

I am also extremely gratified by having spent these last month as part of the most supportive, brilliant and inspiring team in CEGI. I could not have wished for a better work family and I hope that my contribution to the team was as big as the influence they had in my personal development. To all of my family I give my most profound gratefulness, especially my parents and my sister, which made me who I am today and helped me overtake all obstacles I have faced. I can only hope to make you as proud as I am proud of having you guiding me through life.

I would also like to thank all of my friends for all the moments we spent together, and espe-cially Vitor for never letting me forget what is truly important.

Inês, I am deeply overjoyed for sharing these last years with you. You make me a much better person every single day and I sincerely hope to be able to retribute all the care and support you have given me. Thank you for making the present worthwhile and the future worth looking forward to.

“Somewhere, something incredible is waiting to be known”

Carl Sagan

## Contents

1 Introduction 1

2 Literature Review 5

2.1 Consistent Vehicle Routing Problem . . . 5

2.2 Periodic Vehicle Routing Problem . . . 6

2.3 Vehicle Routing Problem with Time-Windows . . . 8

3 Mathematical formulation 11 3.1 Problem statement . . . 11 3.2 Mathematical formulation . . . 14 4 Solution approach 17 4.1 Methodology overview . . . 17 4.2 Proposed algorithm . . . 18

4.3 Approach for larger instances . . . 27

5 Case study in a pharmaceutical distribution company 29 5.1 Case study overview . . . 29

5.1.1 Company description . . . 29

5.1.2 Objectives of the case study . . . 31

5.2 Data analysis and and key performance indicators . . . 32

5.3 Methodology used to solve the case study . . . 33

5.3.1 Route planning . . . 34

5.3.2 Transshipment evaluation . . . 36

5.3.3 Simulation model . . . 37

5.4 Results . . . 40

5.4.1 Validation of the simulation model . . . 40

5.4.2 Instance characteristics . . . 41

5.4.3 conVRP-SLA results . . . 42

5.4.4 Simulation results . . . 43

6 Conclusions and future work 47

## Acronyms

ALNS Adaptive Large Neighbourhood Search. 6, 8, 48 API Appplication Programming Interface. 35

conVRP Consistent Vehicle Routing Problem. 2, 5–7, 47

conVRP-SLA Consistent Vehicle Routing Problem with Service Level Agreements. 11, 14, 17, 23, 30, 33, 34, 40, 43, 44, 47, 48

FO Fix and Optimize. 17, 18, 22, 41, 42, 47

GA Genetic Algorithm. 7

KPIs Key Performance Indicators. 33, 39, 40, 43, 47

LNS Large Neighbourhood Search. 6

MIP Mixed-Integer Program. 6, 7, 11, 22, 26

PVRP Periodic Vehicle Routing Problem. 6–8

SLA Service Level Agreements. 11

TS Tabu Search. 6–8

TSPTW Traveling Salesman Problem with Time Windows. 8, 39, 44

VNS Variable Neighbourhood Search. 7 VRP Vehicle Routing Problem. 5–9

VRPTW Vehicle Routing Problem with Time Windows. 8, 9

## List of Figures

3.1 Variables defining the service level agreements . . . 12

3.2 Different nodes belonging to the same customer . . . 12

4.1 Overview of the proposed matheuristic solution process . . . 18

4.2 Node grouping to reduce the size of the instance . . . 19

4.3 Different types of nodes in a route . . . 24

4.4 Different types of released arcs to allow for changes in customer assignment . . . 26

5.1 Regressions of the weight of the carried load as a function of the number of boxes 33 5.2 Methodology used in the case study . . . 34

5.3 Overview of the simulation model . . . 37

## List of Tables

1.1 Examples of different service level agreements . . . 2

5.1 Main characteristics of the company’s different customers . . . 30

5.2 Comparison between simulated and real results . . . 40

5.3 Parameters used to define the instances . . . 42

5.4 Main characteristics of the solved instances . . . 42

5.5 Results of the conVRP-SLA applied with the developed matheuristic . . . 43

5.6 Simulation results for the different company’s warehouses . . . 44

### Chapter 1

## Introduction

Customer satisfaction is becoming one of the main drivers in competitive markets, and there-fore new factors need to be considered during the planning and execution of delivery operations. In some markets, customers try to decrease their overall stock levels and simultaneously improve re-sponse time in case of a stock-out. This is pressuring distributors, especially when operating with several competitors, to increase the frequency of delivery and to be more concerned with providing a good service rather than straight up reducing its operating costs. In this setting, the operational efficiency of the resources involved in this whole process is crucial as the border between profit and losses is thin. From an Operations Research point of view, these delivery operations often boil down to vehicle routing problems that arise whenever goods need to be distributed throughout a series of delivery locations by more than one vehicle. While this broad description fits a wide variety of applications, it is common for several specific business characteristics to harden the decision making process on this problem, which in turn leads to the development of increasingly specific models that relate more closely to practical issues faced by companies.

In this research we are concerned with a scenario in which customers have high-standard ser-vice level agreements, which may vary significantly in their nature (Table 1.1). These agreements are provided by companies that ensure customized delivery solutions. In the distribution business it is common for this type of agreements to guarantee that between ordering and delivering only a given, small amount of hours may pass, and that multiple deliveries throughout the day may be fulfilled. While the existence of time windows is often the case in vehicle routing problems, having multiple customer-specific order placement deadlines increases planning complexity as it is not possible to aggregate orders from the same customer in the same route if they were placed in different periods of the day. Moreover, some of the orders may be placed just in time for the vehicle loading operations and subsequent departure, which further complicates routing flexibil-ity. An additional challenge occurs when customers with multiple daily order deadlines are to be served alongside customers with less broad agreements that either do not enforce any specific period of delivery or have just a less specific one. In these cases it is possible that, throughout the day, multiple routes are able to deliver these requests. Choosing which route should serve these customers is not trivial since it has implications not only on traveled distance but also on vehicle

2 Introduction

capacities and may even influence delays throughout the whole day. This is especially common in distribution companies that deliver goods from different companies and different businesses which have specific and non-conformant service level agreements with their own customers. In this case, the distribution company needs to adapt their operations and to develop routes that fulfill all the different specifications required.

Table 1.1: Examples of different service level agreements

Customer Daily order frequency

Time window Dispatching period

Ordering deadline A Several daily

deliveries

Expected arrival time Afternoon shift 14:15 B One visit Between 10:00 and

17:00

Any Week before

Uncertainty, which renders the planning and execution of these systems harder, may come from several sources such as demand, service times and customers’ locations. Moreover, the impact of uncertainty is felt both at the tactical and operational level. On the tactical level, the decisions about the operational model to serve clients and fleet sizing have to be taken simultane-ously and must incorporate these uncertainty sources explicitly. Regarding the operational model there are mainly two alternatives of planning the routes to deliver the products: flexible routes that are routed dynamically based on the current orders that have to be delivered or robust routes that have defined the set of clients that are served per route a priori. The first option could theoreti-cally lead to a better dimensioning of the fleet and more optimized routes, but it ignores the fact that, upstream, the orders that were known a couple of hours before have to be prepared and con-solidated next to a given delivery vehicle. Furthermore, the important goal of personalization of services, making the driver the contact person whenever the customer needs service is forgotten. Using robust routes one may also increase the driver familiarity with their own routes and terri-tories, which improves driver efficiency. Actually, the increased focus on the customers makes driver recognition an ever more important factor in route planning. Drivers become the face of the company and a very effective medium of customer management as they become acquainted with the downstream decision makers. In addition, robust routes provide a much more stable and easy way to manage delivery schedules and enable the possibility of delivering to customers at ap-proximately the same time every day. The robustness of customer-route assignment may also be motivated by operational level constraints when the customers’ order placement deadline is very close to vehicle departure. In these situations, it may be necessary to start picking operations and to load the vehicles before the full list of orders for the day is known. By having robust routes, the assignment of each order to a vehicle is both easier to manage and less error-prone. The tactical challenge of these logistics systems is then how to design the best set of robust routes that will result in the lowest operating costs. This problem is known in the literature as the Consistent Ve-hicle Routing Problem (conVRP). In recent years, the conVRP has been gathering the attention of

Introduction 3

the academic community as innovative and better solutions are being requested by companies. In this type of problem, customers are assigned to specific routes before any orders have been placed during a tactical planning phase. On the operational level, every order placed by a customer will be served by the same vehicle at approximately the same time over multiple days. This impedes the flexibility of dynamically molding the routes to the requests to be delivered in order to strictly minimize costs, which is the way vehicle routing problems are usually addressed.

From a practical point of view, the problem being tackled applies to specific sectors that bene-fit from planning their routes according to the previously defined motivations. Companies that put their focus on customer service level, maintain a close relationship with the customer and operate on a tight delivery lead time have the most benefits to withdraw from using a delivery system with consistent routes. Cases of such companies are fairly common in small package distribution industries facing large competition and highly demanding customers, with pharmaceutical and au-tomobile spare parts distribution being the most well-known examples. Other activities in which consistent routing with a service level focus is relevant include home care services, better estab-lished home deliveries, which may be a potential development area for e-commerce operations, and also the transportation of children, elderly or handicapped people. These companies seek for a customer focused environment that leads to more complex and strict service level agreements as a way to increase customer loyalty. However, with stricter service level targets, the number of fail-ures and complaints tends to increase, which often leads to frequent changes to the tactical plan in order to quickly solve these problems. Making solid consistent route plans that will perform well in practice while still being efficient is therefore a very hard task that many companies struggle with. Tools that assist decision-making in these conditions and take the business characteristics in consideration are therefore very useful and desired by practitioners.

Several approaches have been proposed to address variants of the problem tackled in this thesis. Our contribution is two-fold. Firstly, to the best of our knowledge, there is no work that tackles the service level agreement often encountered in these logistics systems, in which not only the delivery window, but also the time between ordering and receiving in the same day is defined. This constraint limits drastically the number of clients to be paired and the flexibility in the departure times of the vehicles. Secondly, although several formulations have been put forward to solve consistent vehicle routing problems, they were never used to address real-world instances. In this work we propose a solution method leveraged by a fix-and-optimize approach that fully utilizes the developed mathematical model and aims to be well suited for application in real-life business situations. In order to test its validity and potential, the solution method is used with historical data to plan the robust routes of a Portuguese pharmaceutical distribution company with over 3000 daily deliveries in an environment with both deterministic and stochastic customers and stochastic demand. The proposed plans are then simulated and the performance of the new plan is compared to the one currently in practice at the company.

The remainder of this thesis is organized as follows. The theoretical background is introduced in Chapter 2 with a literature review of the vehicle routing problem and some of its specific for-mulations with more relevancy to our model. Chapter 3 presents the formulation of the problem

4 Introduction

and the respective mathematical model, while Chapter 4 describes the proposed solution approach thoroughly and the motivations for its development. The case study is then introduced in Chapter 5 with a brief description of both the company’s operations and all the tools developed and used dur-ing the analysis. In Chapter 6, the results of the proposed model on the real case study are shown and analyzed. Finally, conclusions and improvement opportunities are discussed in Chapter 7.

### Chapter 2

## Literature Review

Since its introduction by Dantzig and Ramser (1959), the research community has been exten-sively studying different Vehicle Routing Problem (VRP) variants and applications. As expected, the complexity of the addressed challenges also suffered a massive increase as the value of the optimization techniques captured the interest of most competitive logistics operators. The compu-tational power that is available nowadays enables the scientific community to further develop new mathematical models as well as the necessary methods to solve them. This remarkable and logical evolution is described by Laporte (2009).

### 2.1

### Consistent Vehicle Routing Problem

This research mainly focuses on a less studied VRP extension which is the conVRP. This optimization problem demands the definition of vehicle routes for several periods, maintaining a certain level of consistency on pre-selected metrics. For instance, when distribution companies make an agreement for the deliveries to be made always by same driver, they are adding consis-tency constraints in order to take into account customer satisfaction. Therefore, the objective is to achieve minimum cost routing plans satisfying the classical routing constraints as well as con-sistency requirements taking into account customer satisfaction. Generally, this type of customer-oriented routing considers two types of consistency for customer satisfaction: driver consistency, and time consistency (Kovacs et al., 2014a). Driver consistency is measured by the number of different drivers that visit a customer whereas time consistency is related to the maximum dif-ference between the earliest visit and the latest arrival at each customer. The conVRP arises in many industries where customer satisfaction is considered as a distinctive factor of competitive-ness. Particularly in industries transporting small packages, providing a standard service with a single driver and approximately at the same time of the day enables the customers to prepare them-selves for a delivery, strengthening supplier/customer relationships (Kovacs et al., 2014b). Since the conVRP considers several periods, it can be seen as a tactical extension of the classical VRP with customer-focused routes.

6 Literature Review

Despite the advantages of adopting consistent routes, few papers have addressed the conVRP and most approaches resort to approximation methods. Groer et al. (2009) formulate the conVRP as a Mixed-Integer Program (MIP) and improve the algorithm used by Li et al. (2005) to solve very large VRPs. A real-world data set is used to generate instances with up to 700 customers which are solved by the algorithm. The obtained consistent routes are less than 10% longer on average, compared to inconsistent routes. Recently, Ridder (2014) shows that some optimal solu-tions provided by Groer et al. (2009) are not feasible because service times were not considered. The author develops an algorithm that improves solutions provided by the latter paper. Tarantilis et al. (2012) propose a Tabu Search (TS) algorithm to iteratively generate template routes and to improve the daily routes that are derived from the template routes. These routes are used as the basis to construct the vehicle routes and service schedules for both frequent and non-frequent customers over multiple days. The best reported cumulative and mean results over all conVRP-benchmark instances is improved. Kovacs et al. (2014b) construct template routes by means of an Adaptive Large Neighbourhood Search (ALNS), which uses several operators in order to destroy and repair a given solution. It is shown that solving daily VRPs may lead to inconsistent routes whereas consistent long-term solutions can be generated by using historic template routes. Kovacs et al. (2014a) state that assigning one driver to each customer and bound the variation in the arrival times over a given planning horizon may be too restrictive in some applications. They propose the generalized conVRP in which a customer is visited by a limited number of drivers and the vari-ation in the arrival times is penalized in the objective function. A Large Neighbourhood Search (LNS) metaheuristic generates solutions without using template routes. The computational results on different variants of the conVRP prove the efficiency of the algorithm, as it outperforms all published algorithms. Sungur et al. (2010) consider a real-world courier delivery problem where customers appear probabilistically. Although the authors do not call it a conVRP, their assump-tions are completely in line with this type of problem. The proposed approach generates master plans and daily schedules with the objective of maximizing both the coverage of customers and the similarity between the routes performed in each day. In order to deal with uncertain service times, it is assumed that the master plans serves frequent customers with the worst-case service times found in historical data. Once again, a mathematical formulation is proposed but the real-world problem is tackled by means of a two-phase heuristic based on insertion and TS.

The papers proposing a mathematical formulation to deal with consistency features are still scarce in the literature. These formulations are only able to solve small instances containing less than 12 customers. To the best of our knowledge, no single approach is able to efficiently make use of a mathematical formulation to solve conVRP instances with realistic size.

### 2.2

### Periodic Vehicle Routing Problem

The Periodic Vehicle Routing Problem (PVRP) demands the definition of vehicle routes for several periods without considering consistency constraints. Contrary to the conVRP, the PVRP

2.2 Periodic Vehicle Routing Problem 7

has been studied extensively for more than forty years and its applications cover numerous con-texts. Recently, many applications are considering the classic PVRP as a basis where additional constraints or alternative objectives are added (Campbell and Wilson, 2014). The conVRP is an application of the PVRP considering consistency constraints and the two problems are closely related. Therefore, it is worth to review the literature concerning this topic. The periodicity of VRPs may be considered in three different ways. Either it can be achieved with a predefined set of allowable alternatives (Christofides and Beasley, 1984) or it can be obtained by specifying the space between deliveries to each customer (Cordeau et al., 2001). One can also enforce minimum and maximum required spacing between deliveries (Gaudioso and Paletta, 1992). In this work, we are particularly interested in the first case, as it is more related to our challenge.

The PVRP has been tackled by numerous solution approaches. Cordeau et al. (1997) propose a TS metaheuristic for a PVRP with multiple depots. The algorithm constructs an initial solution that is later improved by the search algorithm. The computational results show that the algo-rithm outperforms other PVRP heuristics available at the time, solving instances with up to 360 customers and 9 periods. Hemmelmayr et al. (2009) present a Variable Neighbourhood Search (VNS) for a PVRP with time-windows. The initial solution is constructed by solving a VRP for each day using the Clarke and Wright savings algorithm (Clarke and Wright, 1964). Afterwards, the algorithm searches for better solutions by applying the classical shaking, local search and move or not phases that are presented by Hansen and Mladenovi´c (2001). They find new best solutions for sets of instances containing up to 400 customers and up to 10 periods. Vidal et al. (2012) tackle a PVRP by means of an hybrid Genetic Algorithm (GA). The metaheuristic combines the good exploratory features of population-based evolutionary algorithms, the improvement capabilities of neighbourhood-based metaheuristics, as well as advanced procedures to manage the population-diversity. The computational experiments for the PVRP, considering a set of instances with up to 400 customers, showed that the method is able to identify either the best-known solutions or new best solutions for all benchmark instances. Therefore, it outperforms current state-of-the-art metaheuristics.

Note that the aforementioned approaches are approximated methods which do not guarantee optimal solutions. Indeed, few exact approaches are available for the PVRP. Baldacci et al. (2011) present a mathematical formulation that is used in a framework consisting in three phases. The formulation is strengthened with valid inequalities and used to compute a near-optimal dual so-lution of the LP-relaxation. Then, a reduced integer problem containing all optimal soso-lutions is generated from the dual solution. Finally, the resulting problem is solved with an MIP solver. The effectiveness of the proposed method is shown on benchmark instances and on new sets of test instances as well. Since it presentes an exact method, this paper is also the first evaluation of the best-known solutions for the PVRP instances that had been used in the previous 30 years.

It is quite clear that exact methods are not able to solve large instances. Researchers try to hy-bridize exact and approximated phases so as to enhance the algorithms for the PVRP. Pirkwieser and Raidl (2009) propose a column generation where a mathematical formulation selects a set of optimal routes (columns) to solve a PVRP. The algorithm starts by considering a small set of

8 Literature Review

routes and additional routes that can potentially lead to better solutions are iteratively generated by solving the a pricing subproblem. Recently, Cacchiani et al. (2014) propose a hybrid optimiza-tion algorithm which also relies on a column generaoptimiza-tion approach. Although there are not many approaches based on this idea, this strategy of restricting the scope to exact parts of algorithms should be better explored. Indeed, there is evidence that approaches such as the Fix-and-Optimize (Helber and Sahling, 2010) can be quite efficient in different optimization problems. The idea is to iteratively find improvements on a given solution by fixing parts and optimizing the smaller sub-problems. This enables the possibility to solve larger instances, as we can fix as much variables as the solver needs. It seems reasonable to use a similar approach in large and realistic PVRPs with consistency constraints.

### 2.3

### Vehicle Routing Problem with Time-Windows

Besides the consistency constraints regarding the number of drivers servicing each customer, the problem we aim to tackle in this work also considers time-windows for each request. This feature is usually necessary in rich routing problems as customers need to be prepared to receive shipments. Since this type of constraint is responsible for a huge increase in complexity, most successful approaches are obtained with non-exact methods.

Solution approaches based in the TS metaheuristic have been proven to be quite efficient. Cordeau et al. (2001) propose a unified TS heuristic for the Vehicle Routing Problem with Time Windows (VRPTW) where an initial solution is constructed, without guaranteeing feasibility. Af-terwards, the TS algorithm generates a certain number of solutions and chooses the best feasible one. This solution is then post-optimized by applying a specialized heuristic for the Traveling Salesman Problem with Time Windows (TSPTW) to each individual route. The computational experiments show that the proposed algorithm may not be the best available for the VRPTW. Nevertheless, this weakness is compensated by the flexibility, the speed of execution, and memory usage of the approach. The program can run on any computer with minimal resources, solving instances with up to 100 customers. Taillard et al. (1997) propose a TS heuristic for a VRP with soft time-windows. The vehicles are allowed to arrive late to customer locations, though a penalty is incurred in the objective function. Problems with hard time-windows can also be tackled by setting penalties to large values. The algorithm uses a stochastic insertion heuristic to construct different solutions. Then, the TS heuristic is applied to each solution and the resulting routes are stored in an adaptive memory, which will be later used to construct other solutions. Subset routes are combined in order to obtain novel solutions until the stopping criteria are met. In the end, a post optimization procedure is applied to each individual route. This methodology has produced best-known solutions for VRPTW benchmark instances. Pisinger and Ropke (2007) present a general heuristic for several VRPs, including the VRPTW. An ALNS metaheuristic is applied, improving 183 best-known solution out of 486 benchmark tests. In this metaheuristic, a number of simple algorithms compete to modify the current solution. In each iteration, an algorithm de-stroys and another algorithm repairs the solution. The choice of the algorithms to be used in each

2.3 Vehicle Routing Problem with Time-Windows 9

iteration is made by an adaptive layer which is biased according to the past performance of each algorithm. The authors describe this methodology as a sequence of fix-and-optimize operations. The fix operation selects a subset of variables that are fixed at their current value whereas the opti-mize operation seeks to find a near-optimal solution by changing non-fixed variables. This is one of the most successful methods among the VRP community, and therefore we consider that ex-ploring different techniques to fix and optimize parts of routing problems is a promising research direction.

Purely exact methods are not so common in the literature as they are not able to solve instances with a large number of customers. The survey presented by Kallehauge (2008) reviews four differ-ent formulations for the VRPTW and describes two main lines of developmdiffer-ent concerning exact algorithms. One focuses on general decomposition approaches and in the solution to dual prob-lems associated with the VRP. The other is concerned with the analysis of the polyhedral structure of the problem. Despite the advances in the exact methods, tackling instances with realistic size is still an unwise decision. Baldacci et al. (2012) review recent exact methods for the VRPTW and report a comparison between different approaches. It is interesting to observe that state-of-the-art approaches are only able to solve instances with less than 100 customers.

### Chapter 3

## Mathematical formulation

Consistent vehicle routing is still most likely a sub-optimal plan on the daily basis as it trades off the necessary flexibility to respond to the specific daily demand of each customer in order to allow the use of consistent routes. It is therefore of utmost importance to avoid excessive compromises of solution quality in the solution method to ensure suitable and efficient results, which ultimately led to the development of an exact model of the proposed problem. In this section, the Consistent Vehicle Routing Problem with Service Level Agreements (conVRP-SLA) will be formally stated along with the associated MIP model.

### 3.1

### Problem statement

LetD be the set of days with service to be fulfilled and P a set of distinct periods of shipping within the depot. LetC be the set of customers having to be served throughout the days. Each customer has a set of ordering windows that, according to their Service Level Agreements (SLA), may or may not have an associated delivery time window [ai, bi], a previously assigned shipping

period pi and/or an order availability time avi(Figure 3.1). The time window refers to the time at

which the order should be delivered at the customer, the period specifies whether this order should be delivered by a route in a specific shipping period and the order availability time is the earliest time at which that specific order could be ready for shipping if it was to be placed at exactly the ordering deadline. All ordering periods which do not have a specific order deadline during the daily horizon are assumed to be ready at opening hours.

LetN be the set of n nodes, each representing a pair costumer-ordering window with cibeing

the customer of node i. In this way, every different window of delivery of each customer is to be treated as a different node (Figure 3.2). Two additional fictitious nodes 0 and n + 1 will be added to the set representing the depot as a departure node and a return node, respectively, with NCbeing the subset of all non-depot nodes. LetNTWbe the subset of nodes with a time window,

NPthe subset of nodes with a specific shipping period andNODthe subset of nodes with an order

12 Mathematical formulation

Figure 3.1: Variables defining the service level agreements

placement deadline. On each day, customers may or may not place an order on any of its ordering periods. As such, letO be the set of orders (i,t) placed by node i on day t, which are defined by their service time stit and ordered quantity qit.

Furthermore, a setA of arcs connecting nodes i and j on day t is considered. Note that the arc (0, n + 1,t) exists and will be used when a route is not to leave the depot on that day. Each arc has an associated travel time tti j and a travel distance tdi j, which are both independent of the day.

These arcs are pre-processed in order to eliminate combinations that will never be used and are therefore unnecessary to use in the model. For each day t, in order for an arc to exist connecting node i to node j, both of them need to be either a regular customer node with orders placed on day tor one of the depot nodes, 0 or n + 1. In case both i and j are customer nodes, they must belong to different customers (ci6= cj) and their specific shipping periods, in case they both exist, must

be the same.

Figure 3.2: Different nodes belonging to the same customer

A set of routes R is also considered, whose size should be an upper bound estimation of the number of necessary vehicle departures. Each route r has an associated period r pr, which

defines which of the shipping periods it operates on. The vehicles that will perform the routes are considered to be homogeneous so a maximum capacity Q is defined. In order to adjust the model to labor related legal constraints, a maximum single route duration MD is also considered in the model. A depot time window [aW, bW ] is also present representing the operational hours of the

3.1 Problem statement 13

depot and therefore defining the minimum departure time and maximum return time for all routes.

Sets and subsets A set of arcs C set of customers D set of days N set of nodes

NC set of non-depot nodes

NTW subset of nodes with time windows

NP subset of nodes with shipping period

NOD subset of nodes with order deadlines

O set of orders

P set of shipping periods R set of routes

Parameters

ai earliest limit of node i ’s time window

bi latest limit of node i ’s time window

pi mandatory shipping period of node i

avi time at which orders from node i are available for shipping

n number of customer nodes stit service time of node i on day t

qit quantity ordered by node i on day t

tdi j travel distance between node i and node j

tti j travel time between node i and node j

r pr shipping period of route r

Q estimated vehicle capacity MD maximum allowed route duration

aW time at which the depot allows vehicles to leave bW time until which vehicles may return to the depot M big number

Decision variables

There are three main binary decision variables in this model: X_{i jt}r , which defines each arc that
is traveled by route r during day t; Z_{i}r, which defines each node’s route assignment; Yr, which

14 Mathematical formulation

time related decision variables are also considered, with Wit representing the daily arrival time

at customer i, dWrthe planned departure time of route r and rWtrbeing the time at which route

r arrives to the depot on day t. Moreover, since daily request patterns are stochastic, capacity
and service level constraints might not be fulfillable at all times. As such, constraint softening
decision variables were defined along with their associated objective function weights. Early and
late arrivals at node i on day t are represented as φ_{it}−and φ_{it}+, respectively. ωtrdefines how much

route r exceeds maximum route duration L on day t, while θtr is the excess of capacity on that

same route and day.

X_{i jt}r =
(

1 if arc (i, j,t) is traveled by route r, 0 otherwise.

Z_{i}r =
(

1 if node i is part of route r, 0 otherwise.

Yr =

(

1 if route r is active, 0 otherwise.

Wit time at which node i is served on day t

dWr time at which route r is set to departure from the depot
rW_{t}r time at which route r arrives at the depot on day t
φ_{it}− earliness at node i on day t

φ_{it}+ lateness at node i on day t
ωtr overduration of route r on day t

θtr overcapacity of route r on day t

α weights of objective function components

### 3.2

### Mathematical formulation

The conVRP-SLA’s mixed integer linear formulation is as follows.

The objective function (3.1) primarily minimizes the total traveled distance since this is usually the main cost driver of transportation operations. A penalty for the number of routes is also included in case there is a fixed cost associated with their execution. The remainder parts represent the different penalties for breaking constraints regarding customer arrival times, route duration and vehicle overloads, respectively.

min

_{∑}

i∈_{N}j∈

### ∑

_{N}t∈

### ∑

_{D}r∈

### ∑

_{R}tdi j· Xi jtr +

### ∑

r∈_{R}αr·Yr+

_{∑}

i∈_{N}t∈

### ∑

_{D}(α1· φit−+ α2· φ + it ) +

### ∑

r∈_{R}t∈

### ∑

_{D}(α3· ωtr+ α4· θtr) (i, j,t) ∈A (3.1)

Firstly, each node must be assigned to only one route (3.2). Also, each node must be visited exactly once, but only when it has placed an order on that particular day and by the route it was

3.2 Mathematical formulation 15

assigned to (3.3). To ensure a correct flow, the same reasoning applies to the number of departures from each node (3.4).

### ∑

r∈R Z_{i}r= 1 ∀i ∈NC (3.2)

### ∑

i∈_{N}t∈

### ∑

_{D}r∈

### ∑

_{R}X

_{i jt}r = Zrj ∀ j ∈NC, (i, j,t) ∈A (3.3)

### ∑

j∈_{N}t∈

### ∑

_{D}r∈

### ∑

_{R}X

_{i jt}r = Zr

_{i}∀i ∈NC, (i, j,t) ∈A (3.4)

Each route must also depart from the depot exactly once every day (3.5). In case no orders are placed by the nodes of route r on a given day t, then the existence of the arc (0, n + 1,t) allows for the fulfillment of this constraint. The return of the route to the depot is already assured by the basic flow constraints (3.3) and (3.4). If there are no nodes assigned to route r, then it is inactive (3.6). On the other hand, when at least one customer is assigned to a route r, then it is an active route (3.7).

### ∑

j∈_{N}X

_{0 jt}r = 1 ∀t ∈D,r ∈ R,(0, j,t) ∈ A (3.5)

### ∑

i∈_{N}C Z

_{i}r≥ Yr ∀r ∈R (3.6) Z

_{i}r≤ Yr ∀i ∈NC, r ∈R (3.7)

As all ordering windows of each customer are treated as different nodes, these have to be forced to be shipped in different routes (3.8). Moreover, when an order has a specific shipping period assigned to it, it can only be delivered by routes operating on that period (3.9).

Zr_{i}+ Zr_{j} ≤ 1 ∀r ∈R,i, j ∈ NC: ci= cj (3.8)

r pr+ M(1 − Zir) ≥ pi≥ r pr− M(1 − Zri) i∈NP, r ∈R (3.9)

In order to enable the existence of time windows in the model, the arrival time at all customers must be traced. As such, the time at which service starts at a given node j must be greater than or equal to the time at which the previous node i was served plus its service time and the travel time between the two (3.10). Also, for each node, the arrival time at each day is compared to the target time window (3.11).

16 Mathematical formulation

ai− φit−≤ Wit≤ bi+ φit+ ∀(i,t) ∈O,i ∈ NTW (3.11)

Both the depot departure and return times need to be coordinated with the first (3.12) and last (3.13) deliveries, respectively. Since exact departure and return times are only necessary for planning when the single route duration is over the limit, equality constraints are unnecessary as they would only jeopardize the performance of the model without any benefit.

dWr+ tt0 j≤ Wjt+ M(1 − X0 jtr ) ∀(0, j,t) ∈A ,r ∈ R (3.12)

Wit+ stit+ tti0≤ rWtr+ M(1 − Xin+1tr ) ∀(i, 0,t) ∈A ,r ∈ R (3.13)

In addition, vehicles need to leave and return to the warehouse during operational hours (3.14, 3.15). Also, each route must depart only after all of its orders are ready to be shipped. (3.16).

dWr≥ aW ∀r ∈R (3.14)

bW ≥ rW_{t}r ∀t ∈D,r ∈ R (3.15)

dWr≥ avi− M(1 − Zir) ∀i ∈NOD, r ∈R (3.16)

Furthermore, it is necessary to keep track of each vehicle’s total load (3.17) and daily dura-tion (3.18) in order to define the penalties for excesses on any day. These constraints and their associated objective function penalties are extremely dependent, not only on how much the deci-sion maker values these trade-offs, but also on how precise the measure of durations and vehicle capacity is.

### ∑

i∈_{N}C qit· Zir≤ Q + θtr ∀r ∈R,t ∈ D (3.17) rW

_{t}r− dWr

_{≤ MD + ω}r t ∀r ∈R,t ∈ D (3.18)

Finally, integrality, binary and non-negativity conditions are set by constraints (3.19).

X_{i jt}r , Zir,Yr∈ 0, 1; Wit, dWr, rWtr, φ
−
it , φ
+
it , ω
r
t, θ
r
t ≥ 0. (3.19)

### Chapter 4

## Solution approach

As is the case with most vehicle routing problems, the proposed model proved to be extremely hard to solve via exact methods as instances increased in size. In fact, using these methods, most possible applications of this problem are prone to need instances of unsolvable size. Therefore, a Fix and Optimize (FO) based approach was designed to tackle this problem by attempting to make use of its natural characteristics in order to solve larger instances. In this chapter, an overview of the methodology is given along with a detailed explanation of the proposed algorithm.

### 4.1

### Methodology overview

In the conVRP-SLA, the main driver for complexity is the number of considered nodes as they
increase the number of arcs and, consequently, the number of decision variables and constraints,
exponentially. Any change in the route assignment of a particular node leads to differences in
many parts of the solution, as routes need to be recalculated along with arrival time and all the
other associated variables. However, this assignment is the cornerstone decision that the model
needs to make, with everything else being dependent of the main binary variables Z_{i}r. While
changing a node may have a sort of butterfly effect throughout the remaining routes, distant routes
tend to be somewhat independent from each other as a customer from one of them will most
likely never join the other, especially under soft time window and capacity constraints. Hence, a
solution method was devised with the goal of (1) reducing the number of nodes and (2) iteratively
exploring the solution space. This method includes a pre-processing stage in which the dataset is
manipulated in order to simplify the problem followed by the actual problem solving stage.

The pre-processing stage aims to decrease the number of nodes in the actual model. The proposed algorithm consists of finding nodes which are very close to one another compared to the overall distances of the instance and to consider them in the model as a single grouped node. These nodes also need to have a similar ordering period and similar time windows in order to be able to be served by the same routes. By doing this, the number of nodes is effectively being reduced

18 Solution approach

with the downside of not allowing some groups of customers to be served by different routes. Such a procedure might be dangerous in areas of high node density as it may end up blocking the formation of good routes, hence why the parameters of the algorithm should be carefully defined for each instance. However, it is highly effective in less dense areas in which there are small groups of nodes very close to one another (e.g. a village), while being very distant from the rest of the nodes. In this case, it is safe to assume that these nodes will never be served by different routes.

The next step of the methodology focuses on actually solving the problem by trying to avoid approaching the whole instance at once. Taking advantage of the problem’s natural focus on the binary decision variables Zir and Xi jtr , a FO procedure was designed that fixes most of the nodes

and arcs and focuses on optimizing just a smaller part of the problem at each iteration. This allows for the exploration of a high percentage of the solution space without creating boundaries and while maintaining efficiency. This method requires a feasible initial solution, whose finding using the mathematical model is time consuming on larger instances. Therefore, an initial solution construction algorithm was also implemented to allow for fast start up times.

The overall solution approach consists of the described processes (Figure 4.1). The detailed definition of their individual steps is as follows.

Figure 4.1: Overview of the proposed matheuristic solution process

### 4.2

### Proposed algorithm

Node grouping

The node grouping step is based on the algorithm proposed by Dondo and Cerdá (2007) with the intent to reduce the computation effort of subsequent solution phases. The goal is to aggregate small groups of nodes with compatible time windows and that are geographically very close to one another when compared to the global set (Figure 4.2). This significantly reduces the number of variables and constraints of the model by assuming that those customers will always be served by the same vehicle, which is, most likely, the case. In order not to limit the ability of the model to allocate nodes to different periods, this stage is only performed for nodes with the same shipping period.

4.2 Proposed algorithm 19

Figure 4.2: Node grouping to reduce the size of the instance

The grouping algorithm (Algorithm 1) starts with a pool of all the nodes fromN ordered first by ai and then by bi, while requiring a maximum inter-node distance of maxD and a maximum

vehicle waiting time of δwait. Also, letN∗ be a set of grouped nodes i∗ to be populated by the

algorithm andN0a temporary set of unassigned regular nodes. Then, and until the original setNp

is empty, groups of nodes i∗will be created, populated and then added to the final set of grouped
nodes N∗. Every time a new grouped node i∗ is initialized, it is populated with the first node
ofN , which is also removed from the original set. The temporary set N0 is then created as a
copy ofN and iterated for each of its nodes i. Node i is added to the group i∗ if they both share
shipping period, if the distance to its closer node is less than the maximum allowed and if the time
window is fulfillable. In order for this last condition to be verifiable, the time to serve all the nodes
in the group needs to be traced. Every time a new node joins the group, both its own service time
and the travel duration between itself and the node of the group which it is closest to are added
to the previous group service time. The latest time window in the node should then be fulfillable
assuming service starts at the beginning of the first node’s time window and that a maximum delay
of δwaitis allowed. In the end, all distances tdi∗∗_{j}∗and travel times tt_{i}∗∗_{j}∗ are recalculated respectively

as tdi∗

n, j∗0 and tti∗n, j0∗, assuming that the service of the new group of nodes starts at the first node and

progresses according to their placement order.

While δwait should be defined as a relatively small period of time comparing to expected route

duration as it represents how late it is acceptable to arrive to a customer in order for it to be grouped with nearby nodes, Dmaxshould vary according to the node density of each specific instance. This

is done to avoid excessively grouping nodes in high density areas, which would significantly hinder the model’s ability to define the routes by acting as a simple routing heuristic.

Initial solution construction

The initial solution construction stage is very straightforward as its only purpose is to allow for a quick start of the next steps when there is no provided initial solution. During this step, it is important to evaluate how close a node is to another, but a simple concept of distance is insufficient when dealing with different periods of delivery and time windows. For this purpose, a compatibility score between nodes τi j is introduced, attempting to measure the distance between

nodes and penalizing it when their time windows are not compatible. This measure is computed as shown in equation 4.1,

20 Solution approach

Algorithm 1 Pseudo-code for the node grouping stage. function GROUPNODES(N ,Dmax, δwait)

N∗_{← /0}
OrderN by ai, then by bi
repeat
i∗← First i ∈N
N 0_{←}_{N ← N \{i}∗_{[0]}}
repeat
i← First i ∈N 0
if pi= pi∗

and mintdj∈i∗, i ≤ D_{max}

and qi∗+ q_{i}≤ Q

and ai∗+ st_{i}∗+ mintt_{j∈i}∗_{,i} ≤ max {b_{i}, b_{i}∗} + δ_{wait} then

Add i to i∗after closest node j
qi∗← q_{i}∗+ q_{i}

sti∗ ← maxst_{i}∗+ tt_{j,i}+ st_{i}, a_{i}+ st_{i}− a_{i}∗

bi∗← max {b_{i}∗, b_{i}}

Remove i fromN0 andN else Remove i fromN0 end if untilN 0= /0 Add i∗toN∗ untilN = /0 returnN∗,td∗,tt∗ end function

4.2 Proposed algorithm 21 τi j= tdi j+ aj+ bj 2 − ai+ bi 2 − avg(stit) ∗ ¯v − tdi j 2 (4.1) with ¯vbeing the average speed of the vehicles to allow for a comparison between time and distance. This speed can be computed from an average of the ratio between each of the travel distances and travel durations in the instance. In the special case in which some nodes are to be placed in specific routes, a subset of nodesN 0 and the respective list of node-route assignment variables Z0 should also be provided. This can be especially useful if the algorithm is run on a previously found solution as an improvement mechanism.

Algorithm 2 Initial solution building.

function BUILDINITIALSOLUTION(Optional N0, Optional Z0)
for all i ∈N0, r ∈R : Z_{i}0r= 1 do
if ix← r
end for
for all i ∈N \N 0do
minCompat← 0
f oundNode← f alse
for all r ∈R : rpr= pi, j ∈N : jf ix= r do

if minCompat = 0 or τi j≤ minCompat then

minCompat← τi j
i∗← j
f oundNode← true
end if
end for
if foundNode then
if ix← i∗_{f ix}
else
if ix← random r ∈R : pi= r pr
end if
end for
for all t ∈D,r ∈ R do
Or
t ← (i,t0) ∈O : if ix= r and t0= t
OrderOtrby ai, then by bi
for k = 0 to size(Or
t) − 2 do
X_{O}rr
t[k]Otr[k+1]← 1
end for
end for
end function

The construction algorithm (Algorithm 2) is performed in several steps. Firstly, routes are populated with the provided nodesN 0in case there are any. Then, each of the remaining nodes iis assigned a fixed route if ix by searching the subset of all the routes of compatible periods for

the node which is closest to it. For this, the minimum compatibility score found so far is traced by minCompat, while boolean f oundNode tracks whether any node was found. The route of the closest node found is then selected for node i. In case no compatible node is found, the node is

22 Solution approach

assigned a random route from all the period compatible ones. The value of variables Zirare then set

accordingly as 1 or 0 and an iteration through all the days and routes follows. In this step, orders
are ordered by their time-windows and variables X_{i jt}r are set assuming the route is performed in this
sequence. As time windows are not hard constraints, as long as no period compatibility constraint
is broken, every partial solution constructed in this way is feasible and by solving the model with
the injected fixed variables, one is able to almost instantaneously fill out the remaining decision
variables.

Fix and optimize

The last and main stage of the solution method is a neighborhood search improvement matheuris-tic based on a FO approach. The reasoning for this approach is grounded on the high computa-tional burden of having a very large number of integer variables and on how easy it is to define a neighborhood as a set of nodes which are very close to one another. By defining a subsetNR

as the set of all nodes which are going to be able to change their values from the current solution
and subsequently limiting a very large portion of the integer decision variables, the MIP becomes
substantially easier to solve. First, let a node be labeled as fixed if the variables Z_{i}rare to maintain
their values for every route r, and released if these same variables will be able to change values.
Furthermore, let a route r be labeled as fixed if, for all nodes i ∈N , Zr

i is to remain equal to the

incumbent solution and released if the nodes are allowed to both join and leave this route. In prac-tice, fixing a binary variable means imposing constraints on it, such that both their lower bound and upper bound are equal to the current value in the incumbent solution.

The overall FO algorithm (Algorithm 3) starts by setting a counter nnoimp to keep track of

the number of iterations with no improvement to the incumbent solution and a time tracker ω to account for the time already expended in the algorithm. Then, a loop with three main steps runs until the time counter is over the limit ωmax. Firstly, the list of nodes to releaseNR is computed

following the current neighborhood size nnodes. Then, both the node assignment variables Zirand

the arc usage variables Xi jtr need to be either fixed to their current values or released. This is

done according to the previously defined list of nodes to release and the relevant arc releasing parameters.

After these pre-processing stages, the model is solved and the next procedure depends on the found solution. Let sol represent the found solution, with solob jbeing its objective value and solV

the full set of its variable values. If the incumbent solution is not improved, this is, if the found objective value is not better than the overall best ob jmin, the counter of no improvement iterations

is updated. Then, when the counter reaches a pre-established limit nmax, the neighborhood’s size

nnodesis increased by step. This process raises the number of nodes that will be released in the next

iteration, which allows for a larger search space that helps escape local optima. On the other hand, if the best overall objective value is improved, the new solution is saved as the new overall best by updating ob jmin and setting the overall best set of variablesV to current variable values. These

4.2 Proposed algorithm 23

found. In addition, if the current neighborhood size is larger than the initial one, n0, it is reset to

tighten the exploration space and therefore refocus the search on the newly found solution. This overall procedure is then repeated until the time limit is exceeded.

Algorithm 3 Overall Fix and Optimize algorithm. nnoimp, ω ← 0

repeat

nnoimp← nnoimp+ 1

NR← SelectNodesToRelease(N ,nnodes)

FixModelVariables(V ,NR, δ )

sol← solve conVRP-SLA if solob j≤ ob jminthen

ob jmin← solob j nnoimp← 0 V ← solV if nnodes> n0then nnodes← n0 end if else

if nimp= nmaxthen

nnoimp← 0

nnodes← nnodes+ step

end if end if update ω until ω ≥ ωmax

The first neighborhood definition stage deals with the selection of which nodes to release (Algorithm 4). The first node to be released, i0, is selected randomly between all the nodes in the

set. Then, and until enough nodes have been selected, the node i∗ with the highest compatibility score with the first random node is also selected to be released. By using the compatibility score (4.1), not only distance is being considered but also the compatibility of the time windows. Nodes are only considered for selection when they share the period of delivery with the first node or when they do not have a specific period for delivery. In the end, all the routes containing the selected nodes are released as well.

Algorithm 4 Node selection algorithm.

function SELECTNODESTORELEASE(N ,nnodes)

i_{0}←N [random]
add i0toNR

while sizeo f (NR) < nnodesdo

i∗← i : τii0= max {τ}

add i∗toNR

end while returnNR

24 Solution approach

After selecting the routes and nodes to be fixed and released, this information needs to be converted to set the actual binary variables of the model (Algorithm 5). Note that, since the time the model will take to explore the solution space is extremely dependent on the number of binary variables it considers, this decision is of utmost importance to assure the algorithm performs efficiently.

A new concept of a connection node is introduced representing the nodes that, on any of the days of the incumbent solution, are at a maximum of δ positions apart from any of the released nodes in their route. Each connection node will then have all the arcs connecting it to released nodes or other connection nodes of its route released as well. By doing this, released nodes will be able to move freely between connection nodes, while the connection nodes will remain in their current route. This position buffer δ will therefore define to what extent each released route will be freed for new nodes to be able to join it. This buffer allows for a more controlled release of arcs, as, in a very long route, if the neighborhood being optimized corresponds to just a small geographical part of it, it is not necessary to allow for the whole released route to be changed. A representation of fixed (1), released (2) and connection nodes (3) shows how these last nodes are defined based on the released ones around them (Figure 4.3).

Figure 4.3: Different types of nodes in a route

LetNF be the subset of fixed nodes,NC the subset of connection nodes andNR the subset

of nodes to be released. Also, let similar subsets be created for routes, withRF being the subset

of fixed routes andRR the subset of released routes. The first step is to define which nodes are

going to be connection nodes. In order to achieve this, each order (i,t) is given an attribute, posit,

defining in which position it is served. Then, for each route r on day t, if a node i is within δ positions of a released node, it is transferred from the subset of fixed nodesNF to the connection

nodes subsetNC.

The next step is to set the binary variables of the model. Regarding node-route assignment
variables, Z_{i}ris fixed to its current value if i ∈NF∪NC, and it is released if i ∈NR. As seen in

Figure 4.4, an arc X_{i jt}r is released in one of three situations. Firstly, if both i ∈NRand j ∈NR, the

4.2 Proposed algorithm 25

Algorithm 5 Model variables fixation algorithm. function FIXMODELVARIABLES(V ,NR, δ )

NF ←N \NR
NC← /0
for all r ∈R,t ∈ D do
(i, j,t, r) ← (i0, j0,t0, r0) : Xr0
i0_{j}0_{t}0 = 1 ∧ i = 0 ∧ t0= t ∧ r0= r
pos← 0
while j 6= n + 1 do
pos← pos + 1
posjt← pos
(i, j,t, r) ← (i0, j0,t0, r0) : X_{i}r00_{j}0_{t}0= 1 ∧ i0= j ∧ t0= t ∧ r0= r
end while
end for

for all (i,t) ∈O : i 6∈ NRdo

for all ( j,t) ∈O : Zr

i = Zrj = 1 do

if |posit− posjt| ≤ δ ∧ j ∈NR then

Add i toNC
Remove i fromNF
end if
end for
end for
for all i ∈N ,r ∈ R do
if i ∈NR∧ r ∈RRthen
Release Zir
else
Z_{i}r←V [Zr
i]
end if
end for

for all (i, j,t, r) ∈A do

if i ∈NR∧ j ∈NR∧ r ∈RR then
Release Xi jtr
else if i ∈NR∧ j ∈NCor i ∈NC∧ j ∈NRthen
Release Xr
i jt
else if i ∈NC∧ j ∈NC∧ Zir= Zrj = 1 then
Release X_{i jt}r
else
X_{i jt}r ←V [Xr
i jt]
end if
end for
end function

26 Solution approach

released routes in between other released nodes. In this stage, released routes may be from many different periods, which allows for nodes that do not have a specific one to freely change period of delivery. However, when just releasing these arcs, a node can only join another route if there are released nodes ordering in every day of the horizon in which it has also placed orders. This makes it hard for nodes to change routes unless the number of released nodes is very large, hence the connection nodes were introduced.

Figure 4.4: Different types of released arcs to allow for changes in customer assignment

In order to allow for every released node to join routes between connection nodes, all arcs Xi jtr

are released if either i ∈NR∧ j ∈NCor j ∈NR∧ i ∈NCfor the current route of the connection

node and for any t ∈D (2). Finally, the arcs between connection nodes are also released for every t∈D if i ∈ NC∧ j ∈NC(3). This is only done for route r : Zir= Zrj= 1, as connection nodes will

never change routes, so their arcs are only possible if they already belong to the same route. These arcs are released to allow the route to change configuration between the connection nodes if any released node either joins or leaves the route.

All the remaining arcs are fixed to their current values, effectively reducing the size of the problem by decreasing not only the number of binary variables but also the number of constraints. This makes the MIP much faster to solve, and is therefore suitable to apply in an iterative method in which many significantly smaller problems are solved. The size of the released neighborhood, which is highly dependent on both the number of released nodes and the position buffer, is the main driver for how the model will behave. When very few nodes and arcs are released, the model very quickly finds the best solution for each iteration. However, doing so hinders its ability to change the incumbent solution and may therefore not be able to escape from local optima. On the other hand, if many nodes and arcs are released, the model will solve very slowly and it will be hard to explore most of the solution space in acceptable amounts of time. As these performances vary according to the characteristics of the instance, the parameters should be fine tuned regarding the number of nodes and the amount of service level agreements. The settings used to solve the case study instances will be provided and can be used as benchmarks for new instances.

4.3 Approach for larger instances 27

### 4.3

### Approach for larger instances

When the number of days in the instance starts to increase, the proposed algorithm may still take too long to reach a good solution. This is because the workload of the matheuristic per released node is proportional to the number of considered days. When this is the case, the whole solution approach should be integrated within an increasing time horizon framework (Algorithm 6). This consists of starting the algorithm with only a small number of days and adding the rest of the planning horizon along the way. Having a smaller set of days enables the model to quickly explore the solution space regarding the basic route structure. The decision maker should decide on the minimum number of days minDays which ought to be sufficient to define a reasonable route skeleton which, in stabler operations, might be just a couple of days. The goal is to then enlarge the sample size to enable a more robust optimization, which acts as a stress test to the routes defined in the previous iterations. The step in number of days is defined as dayStep and is applied at the end of every iteration.

Algorithm 6 Increasing horizon algorithm. nDays← minDays

sol← /0

while nDays ≤ sizeo f (D) do
D0_{←}_{D : t ≤ nDays}

O0_{←}_{O : t ≤ nDays}

N 0_{← i : (i,t) ∈}_{O}0

N 0_{,td,tt ← GroupNodes(}_{N} 0_{, maxD, δ}
wait)

if nDays = minDays then BuildInitialsolution() else

BuildInitialsolution(solZ, solN)

end if

sol←FixAndOptimize nDays← nDays + dayStep end while

In every iteration, the set of considered daysD0 is defined by nDays, with the set of ordersO0 being the subset of all orders which were placed during the considered horizon, and with the set of nodes being reduced to only contain the ones that placed those orders. The matheuristic is then applied to the reduced instance, with the only difference being that the initial solution construction method is supplied with the current solution node-route assignment variables Z0in all but the first iteration.

### Chapter 5

## Case study in a pharmaceutical

## distribution company

The developed model and solution method were applied in a Portuguese pharmaceutical dis-tribution company in order to plan their consistent routes for their operations in Portugal. This section will present an overview of the case study, how the necessary data was collected, the modifications made to the model in order to adapt it to the company’s business model and all the additional tools that were developed in parallel to support the decision making process.

### 5.1

### Case study overview

5.1.1 Company description

The company targeted by the case study is a distributor that is part of a pharmaceutical whole-saler that operates mainly in Portugal. The pharmaceutical industry business is characterized by its low margins for the distribution sector of the supply chain, for being a highly regulated market, and by belonging to a well-established competitive environment. The company mainly provides de-livery services to a limited number of merchandise suppliers by specializing on the transportation of pharmaceutical items. These suppliers consist of other businesses of its parent-company, which need deliveries to pharmacies, supermarkets and perfume shops and also other large wholesalers.

The parent-company’s final customers are well defined in the information system, place fre-quent orders and their packages are sent in uniform containers retrieved automatically from the company’s warehouse. They may or may not have several deliveries in the different daily opera-tional periods and they may place orders until a deadline, which is normally around 30 minutes before the assigned vehicle departure. On the other hand, the deliveries made for other external companies have fairly stochastic customers, non uniform containers and arrive at the warehouse in the beginning of the day. As there is no unique identifier for the recipient of these orders, each package comes with its own delivery address and is assigned to a route according to its postal