1 Introduction

In this paper a special vehicle routing problem arising from the real-life fuel replenishment problem of a European petrol company is discussed. More precisely, every afternoon the company faces the following problem: (a) The company has six depots, where different fuel types are stored. (b) The company delivers different fuel types to customers the next working day. (c) Regarding all customers, the order of the customer contains the following pieces of information: the geographical location of the customer; the quantity of the order for each type of fuel; a time window in which the customer must be served; and the type of the vehicle that serves the customer in which there are two different types: with pump and without pump. (d) A client that requires a vehicle with a pump can only be served by a vehicle with a pump, while a customer that does not have a restriction on the vehicle can be served by either type of vehicles. (e) Each vehicle has six compartments (five bigger and one smaller one) with known capacities. (f) Different fuel types cannot be mixed hence in each compartment only one type of fuel can be delivered. (g) The content of a compartment can serve one customer at most. (h) The service time of a customer depends on whether the customer requires a vehicle with a pump or not. (i) As for both types, each depot knows the number of vehicles available for the next day.(j) Each customer must be served by one vehicle. In this context the company is obliged to give a plan for the next day including the routes of the vehicles. The goal is to minimize the total distance traveled by the vehicles.

Based on their geographical locations, the company assigns each customer to exactly one of the six depots. Hence each day six smaller problems should be solved. These problems can be viewed as a multiple compartment vehicle routing problem with time windows (MCVRPTW) with special features. These features are:

  • Customers may have restrictions on the vehicles that can serve them, so a vehicle may not be able to serve all customers.

  • The service time of a customer depends on the demand of the customer and on the type of the vehicle that serves it.

  • The service of a customer must begin and end in the time window of the customer.

  • Vehicles can make several trips during their operations time.

To solve the six problems, we formulate each problem as mixed integer linear programming problem. The multiple compartment vehicle routing problem and the vehicle routing problem with time windows are NP complete, hence our problem is NP complete as well, so we cannot expect that these MILPs can be solved in reasonable time with MILP solvers for large scale instances. To reduce the size complexity of the models first the active orderings are clustered with machine learning and new constraints are added to the MILP models ensuring that in any route a vehicle can visit customers that are in the same cluster. Then the new MILP formulations are solved by EXPESSE-MP. The aim of this article is to demonstrate that by using this method, real world problems of the company could yield “good” solutions even in a short time.

2 Literature overview

Vehicle Routing Problem (VRP) is an important problem in transportation management and has been studied for more than 50 years. In the Vehicle Routing Problem, we have to fulfill orders of a group of customers from a depot using a given vehicle fleet. Surveys on the VRP and its variants can be found for example in Han and Wang (2018) and Mor and Speranza (2022). The Petrol Station Replenishment Problem (PSRP) is a special case of VRP in which the customers are petrol stations and the products are different kinds of petrol. The problem has many versions depending on the scheduling period, the number of the stations, properties of the vehicles and the size of the orders. The problem first appears in the work of Dantzig and Ramser (1959). They proposed and applied the first algorithmic approach to petrol delivery using a homogenous fleet. They fulfilled the order of the customers from a single central depot trying to minimize the amount of kilometers run by the trucks.

Brown and Graves (1981) published a case study of the Chevron Company’s network consisting of over 80 sites and 300 trucks. In that problem every order fully loaded a truck. Therefore, every route of every vehicles consisted of exactly one customer. The authors formulated an integer programming model to solve this problem in which they assigned a truck to every order. Their goal was to minimize the total traveled distance and they set a penalty function for the vehicles that exceeded the allowable work hours.

Brown et al. (1987) developed a software for the American Mobil Oil Corporation. It was an extension of their previous article with a network of 120 sites and 430 trucks where they allowed visiting multiple customers in every round.

Van der Bruggen et al. (van der Bruggen et al. 1995) wrote about a Dutch oil corporation’s project in 1995. The company wanted to reschedule its transportation network. The authors suggested a few simple models in which they assigned every customer to exactly one depot, determined the required fleet size and composition and recommended changes to the routes of the trucks.

Avella et al. (2004) examined a PSRP problem with one depot, a heterogeneous fleet and no time windows. In their work every order was a multiple of 1000 liter of oil and the trucks’ compartments had to be either full or completely empty when the vehicle left the site. The authors suggested a set partitioning approach and invented a branch-and-price algorithm. Applying that technique, they were able to give a solution to the problem using heuristic methods.

Ng et al. (2008) examined two smaller gas station networks in Hong Kong. In their model, they assigned routes to stations and vehicles simultaneously. In their case the company handled the stocks of the stations, not the customers. They determined when to refuel the stations and how much petrol to deliver without running out of oil. However, they could not guarantee that this amount would always be sufficient at all gas stations.

Cornillier et al. published 4 important articles on this topic. The first one (Cornillier et al. 2008a) was published in 2008 in which they gave an exact algorithm to solve a problem with one depot, an unlimited vehicle fleet, and no time windows. In their second work (Cornillier et al. 2008b) they used a limited number of trucks and still no time windows. The maximum number of customers that could be visited with one trip was two in both cases. In their third article (Cornillier et al. 2009) they worked with time windows (Petrol Station Replenishment Problem with Time Windows, PSRPTW), meaning that certain time intervals were specified by the customers and they had to be served during these intervals. They also raised the number of stations that could be visited in one trip from two to four. Their most recent work on this topic (Cornillier et al. 2012) was published in 2012. In this article the customers were served from multiple different sites (Multidepot PSRPTW, MPRSPTW).

Petrol Station Replenishment Problems usually observe one day of transportation since it is really difficult to estimate the exact needs of the stations for a longer period. Popović et al. (2012) worked on a multi-day observation. They optimized the replenishment of 10 stations for 3 days, transported various products and used multi-compartment trucks. They used an algorithm based on variable neighborhood search (VNS) in order to solve the problem.

Vidović et al. (2014) developed a method to solve a larger problem with 50 customers for 5 days.

Carotenuto et al. (2015) further developed this method and were able to optimize a network with 200 customers a week in advance with the help of a generic algorithm (GA).

Zhang et al. (2018) were examining a petrol station network next to a highway in Beijing and formulated a Mixed Integer Linear Programming (MILP) model to solve the PSRPTW problem.

A similar model was used in the work of Wang et al. (2019). They were able to optimize a network of 100 customers with time window constraints. In their case, the trucks were allowed to return to the depot multiple times during optimization and every truck had exactly 2 compartments. This meant that the vehicles were only able to visit one or two customers in every route, which made their problem significantly smaller and easier to solve.

Recently Chowmali and Sukto (2020, 2021) studied PSRP with a heterogeneous fleet of vehicles with multiple compartments. In their work the vehicles were allowed to make one tour and the customers did not have time windows. They proposed and applied two new algorithms to solve a fuel delivery problem in Thailand with twenty petrol stations.

3 Mathematical model

Each of the six smaller problems corresponding to the six depots of the company can be modeled as a vehicle routing problem with some extra conditions in the following mode. We are given a site and N customers. The number of vehicles at the site is M. (Customers are numbered from 1 to N, while vehicles are numbered from 1 to M. The site is denoted by 0.) For each customer the demand of the customer (per liter) for the different commodities is known. Furthermore, we also know which customer needs a vehicle equipped with pump. Every vehicle has six compartments: 5 big and one smaller one with known capacities. In one compartment of a vehicle only one commodity can be transported to one customer. Each vehicle starts and ends its tour at the depot. One vehicle can make multiple tours during the day. Every customer has a time window (opening hours). A vehicle must arrive at a customer and serve the customer during the customer’s time window. We assume that every customer can be served by one vehicle. We wish to plan the routes of the vehicles so that every demand is satisfied and the total distance covered by the vehicles is minimal.

3.1 Notations of the model

Parameters:

M:

number of vehicles

N:

number of customers

O:

maximum number of trips of a vehicle

\(d_i^c\):

Amount(liter) demanded by customer i from commodity c. \(1\le i\le N,\ 1\le c\le 5\)

\(d_i\):

Total amount (liter) of the demand of customer i; \(1\le i\le N\);

\(pv_k\):

Equals 1, if vehicle k is equipped with pump, otherwise 0; \(1\le k\le M\)

\(p_i\):

Equals 1, if customer i requires a vehicle with pump, otherwise equals 0; \(1\le i\le N\)

\(r_i^c\):

Number of compartments of a vehicle needed to service the demand of customer i from commodity c; \(1\le i\le N\), \(1\le c\le 5\)

\(r_i\):

Total number of compartments of a vehicle needed to service customer i; \(1\le i\le N\).

\(s_i^c\):

Equals 1, if the demand of customer i from commodity c can be served by \(r_i^c\) compartments including the small compartment; \(1\le i\le N,\ 1\le c\le 5\)

\(s_i\):

Equals 1, if the demand of customer i can be transported in \(r_i\) compartments using the small compartment; \(1\le i\le N\)

\(A_i\):

Opening time of customer i; \(1\le i\le N\)

\(B_i\):

Closing time of customer i; \(1\le i\le N\)

\(A_0\):

Opening time of the depot

\(B_0\):

Closing time of the depot

\(D_{ij}\):

Distance between customers (or depot) i and j; \(0\le i,j\le N\).

\(T_{ij}\):

Traveling time from customer/depot i to customer/depot j; \(0\le i,j\le N\).

\(f_i\):

Service time of customer i; \(0\le i\le N\)

W:

Total capacity (liter) of the vehicles.

\(f_0\):

The fill up time of the vehicles at the depot.

\(W_b\):

Capacity of the big compartments of the vehicles.

\(W_s\):

Capacity of the small compartment of the vehicles.

The following connections are held between the parameters:

$$\begin{aligned}{} & {} d_i=\sum _{c=1}^5 d_i^c\qquad 1\le i\le N\end{aligned}$$
(1)
$$\begin{aligned}{} & {} r_i^c=\lceil d_i^c/W_b\rceil \qquad 1\le i\le N\end{aligned}$$
(2)
$$\begin{aligned}{} & {} r_i=\sum _{c=1}^5 r_i^c\qquad 1\le i\le N \end{aligned}$$
(3)
$$\begin{aligned}{} & {} s_i^c\ \text {equals 1, if}\ (r_i^{c}-1)\cdot W_b+W_s\ge d_i^{c}; \text {otherwise}\ 0. \end{aligned}$$
(4)
$$\begin{aligned}{} & {} s_i=\max _{c} s_i^c\qquad 1\le i\le N \end{aligned}$$
(5)

Continuous variables:

\(dep_0^{ko}\):

Starting time of vehicle k from the depot in round o. \(1\le k\le M;\ 1\le o\le O\).

\(arr_0^{ko}\):

Arrival time of vehicle at the depot in round o. \(1\le k\le M;\ 1\le o\le O\).

\(dep_i\):

Starting time of a vehicle from customer i. \(1\le i\le N\).

\(arr_i\):

Arrival time of a vehicle at customer i. \(1\le i\le N\).

C:

Total distance run by the vehicles.

Binary variables:

\(x_{ij}^{ko}\):

Equals 1, if in the o. round, vehicle k travels from customer i to customer j. \(1\le k\le M;\ 1\le i,j\le N,\ 1\le o\le O\).

3.2 Constraints of the model

The mathematical model of the problem contains the following constraints:

  • Each customer is served by exactly one vehicle in exactly one round.

    $$\begin{aligned} \sum _{j=0}^N\sum _{o=1}^O\sum _{k=1}^{M} x_{ji}^{ko}=1\qquad \qquad 1\le i\le N \end{aligned}$$
    (6)
  • If a vehicle leaves a customer or the depot in a certain round, the vehicle enters that customer or the depot in the same round.

    $$\begin{aligned} \begin{aligned}&\sum _{j=0}^N x_{ij}^{ko}=\sum _{j=0}^N x_{ji}^{ko}\\&0\le i\le N;\quad 1\le k\le M;\ 1\le o\le O \end{aligned} \end{aligned}$$
    (7)
  • In any round a vehicle can leave the depot and arrive at the depot in the depot’s opening hours.

    $$\begin{aligned} A_0\le dep_0^{ko}\le & {} B_0\qquad \qquad 1\le k\le M,\ 1\le o\le O \end{aligned}$$
    (8)
    $$\begin{aligned} A_0\le arr_0^{ko}\le & {} B_0\qquad \qquad 1\le k\le M,\ 1\le o\le O \end{aligned}$$
    (9)
  • Each customer must be visited and served by a vehicle during the customer’s opening hours.

    $$\begin{aligned}{} & {} dep_i\le B_i\qquad \qquad 1\le i\le M \end{aligned}$$
    (10)
    $$\begin{aligned}{} & {} arr_i\ge A_i\qquad \qquad 1\le i\le M \end{aligned}$$
    (11)
  • The departure time of a vehicle from a customer is the arriving time of the vehicle at the customer plus the service time of the customer.

    $$\begin{aligned} dep_i=arr_i+f_i\qquad \qquad 1\le i\le N \end{aligned}$$
    (12)
  • If, in any round, a vehicle moves from i to j (where i and j can be customer or depot, too), the arriving time at customer j can not be less, than the departure time of customer i plus the traveling time from i to j. L denotes a big value in the constraints.

    $$\begin{aligned}{} & {} dep_i-L\left( 1-\sum _{k=1}^{M}\sum _{o=1}^{O}x_{ij}^{ko}\right) +T_{ij}\le arr_j\qquad 1\le i,j\le N \end{aligned}$$
    (13)
    $$\begin{aligned}{} & {} dep_0^{ko}-L\left( 1-x_{0i}^{ko}\right) +T_{0i}+f_0\le arr_i\\{} & {} 1\le i\le N,\ 1\le k\le M,\ 1\le o\le O \nonumber \end{aligned}$$
    (14)
  • If, in any round, a vehicle moves from customer i to the depot, the arriving time of the vehicle at the depot cannot be less than the departure time of customer i plus the traveling time from i to the depot. L denotes a big value in the constraints. Furthermore, in any round, the arriving time of a vehicle at the depot must be greater than the departure time of the vehicle from the depot.

    $$\begin{aligned}{} & {} dep_0^{ko}\le arr_0^{ko}\qquad 1\le k\le M,\ 1\le o\le O \end{aligned}$$
    (15)
    $$\begin{aligned}{} & {} dep_i-L\left( 1-\sum _{k=1}^{M}x_{i0}^{ko}\right) +T_{i0}\le arr_0^{ko}\qquad 1\le i\le N,\ 1\le o\le O \end{aligned}$$
    (16)
  • In any round, a vehicle can only start from the depot after it arrived at the depot in the previous round.

    $$\begin{aligned} dep_0^{k,o+1}\ge arr_0^{k,o}\qquad 1\le k\le M,\ 1\le o\le O-1 \end{aligned}$$
    (17)
  • In any round, a vehicle cannot carry more goods than its capacity.

    $$\begin{aligned} \sum _{i=1}^{N}\sum _{j=0}^{N}x_{ij}^{ko}\cdot d_i\le W\qquad \qquad 1\le k\le M,\ 1\le o\le O \end{aligned}$$
    (18)
  • Each vehicle can use at most 5 big tanks and one small tank.

    $$\begin{aligned}{} & {} \sum _{i=1}^{N}\sum _{j=0}^{N}x_{ij}^{ko}\cdot r_i\le 6\qquad \qquad 1\le k\le M, \ 1\le o\le O \end{aligned}$$
    (19)
    $$\begin{aligned}{} & {} \sum _{i=1}^{N}\sum _{j=0}^{N}x_{ij}^{ko}\cdot r_i\le 5+\sum _{i=1}^{N}\sum _{j=0}^{N}x_{ij}^{ko}\cdot s_i\\{} & {} 1\le k\le M,\ 1\le o\le O\nonumber \end{aligned}$$
    (20)
  • If a customer requires a pump, then it must be served by a vehicle equipped with a pump.

    $$\begin{aligned} x_{i,j}^{ok}=0\ \text {if}\ p_i=1\wedge pv_k=0 \end{aligned}$$
    (21)
  • The total distance, traveled by the vehicles should be minimized.

    $$\begin{aligned} C=\sum _{i=0}^{N}\sum _{j=0}^{N}\sum _{k=1}^{M}\sum _{o=1}^{O}x_{ij}^{ko}\cdot D_{ij}\rightarrow \min \end{aligned}$$
    (22)

The mathematical model of the problem consists of constraints (621) and objective function (22).

4 Numerical results

To test the model, we obtained data for 11 days from the company. Except for some days of the weekend, a day consisted of two shifts. For each day/shift/depot combination, the data contained:

  • the number of vehicles with and without a pump available at the depot at the start of the shift;

  • the coordinates (latitude and longitude) of active clients assigned to the depot;

  • the demand of active customers of different fuel types;

  • the opening and closing time of customers;

  • the list of active customers that must be served by a vehicle with pump.

In general, for each depot the first shifts contained more customers than the second shifts, and the second shifts contained only few customers that needed a vehicle with a pump. Table 1 shows the main characteristics of the test problems.

Table 1 Main properties of the test problems

Using the coordinates of the active clients we used R’s osrm package to create the distance and time matrices necessary for the MILP model. At first, for each day/shift/ combination, the corresponding MILP models of the first depot were formulated and solved by FICO-XPRESS on an Intel Core i7 personal computer equipped with 8 GB RAM and 512 GB SSD using a time limit of one hour. Although these problems were smaller (contained less clients) than the problems corresponding to the other depots, XPRESS could not find a feasible solution in one hour for 8 from 9 cases of the shift 1 problems. In 2 cases of the shift 2 problems in which the number of clients were 7 and 8, the optimal solution was found in 10 min and 5 s, respectively. Furthermore, a feasible solution was found in 6 from the remaining 7 cases of the shift 2 problems. For the shift 2 problems we calculated the relative gaps (RGAP) of the obtained solutions. The RGAP value for the solution is defined by

$$\begin{aligned} RGAP=100\cdot \frac{BP-LB}{LB} \end{aligned}$$

where BP is the objective value of the solution and LB is the lower bound given by FICO-XPRESS. The RGAP values are shown in Table 2.

Table 2 RGAP-s of the solutions of the shift 2 problems of depot 1

Each day the company has very short time to solve all of the problems corresponding to the different depots; therefore we were asked to use a much smaller time limit than one hour when running FICO-XRESS. So the time limit was set to 5 min and this time for each day/shift/depot combination the corresponding MILP model was solved by FICO-XPRESS.

4.1 Clustering the customers

The results of solving the MILP models of the first depot with a time limit of one hour suggested that we had to reduce the size complexity of the MILP models in order to be able to find a feasible solution to the problems by solving them using FICO-XPRESS with a time limit of 5 min.

A possible approach to reduce the size complexity of the MILP models is to forbid travel between clients that are far from each other, i.e., to set \(x_{i,j}=0\) for those (ij) pairs for which the distance between i and j exceeds a prescribed limit. One disadvantage of this method is that it is not easy to decide what limit should be used. Furthermore, applying this method could “isolate” some clients from the others, which means that a vehicle that visits this customer cannot visit other customers in that round.

For this reason, instead of forbidding long travel we used a clustering approach. Given a clustering of active customers we reduced the number of binary variables \(x_{ij}^{ko}\) by adding the following constraints to the model: if i and j are two customers that are in different clusters, a vehicle cannot visit them in the same round so the following constraint was added to the model:

$$\begin{aligned} x_{ij}^{ko}=0\ \ 1\le i,j\le N,\ 1\le k\le M,\ 1\le o\le O,\ c(i)\not =c(j) \end{aligned}$$
(23)

In this way, the modified model consists of constraints (623) and objective function (22).

We chose the k-medoids clustering method because it is a robust method and it can work with a distance matrix. The k-medoids clustering problem can be modeled as a MILP, too. However, since the solution time of the problem introduced in this article was a crucial factor for the company, the clustering was done in R by the Kmed package’s fastkmed function. The clustering resulted in a positive integer c(i) for each customer i, which means that customer i is in the c(i)-th cluster.

4.2 Results

First we examined the effect of using clusters in the MILP model. The MILP models of the test examples were solved without clustering (i.e., with one cluster) and with different cluster sizes \(1,2\ldots \) and \(\lceil \frac{n}{6}\rceil \), too. We found a feasible solution without applying clusters in 12 examples. On 3 occasions (in night shifts with few customers) we even found the optimal solution. From the 12 examples in 8 cases we got better solutions with some of the cluster numbers. Furthermore, there were 26 cases in which without clustering we did not find a feasible solution, but we did find a solution with clustering. We observed empirically that in most cases the best solution was found when the number of the clusters was \(\lceil \frac{n}{10}\rceil \).

Next we compared our results obtained by using \(\lceil \frac{n}{10}\rceil \) clusters with the solutions of the company, which were obtained by software that uses a genetic algorithm. There were 15 cases in which our method yielded a feasible solution for both shifts in a day for some of the 6 depots. The liter/kilometer values (which are the most important KPIs of the company) of our (SZE, Széchenyi István University) solutions and the solutions of the company are shown in Table 3. (The original values are divided by a constant.)

Table 3 Comparing the liter/km values

It can be seen from Table 3 that in 10 cases the MILP approach combined with clustering gave a better solution (with a larger liter/kilometer value) than the software used by the company so our method outperformed the software used by the company in 10 out of 15 cases.

4.3 The two-phase method

In many cases that contain a lot of customers even the MILP model combined with clustering could not find an initial solution in the 5-minute running time. To handle this problem Heitz (2020) proposed a two-phase method. In the first phase, instead of minimizing the total distance traveled by the vehicles, we maximized the number of customers whose demands could be satisfied. To do so, the original MILP model was modified. Equation (6) was changed to

$$\begin{aligned} \sum _{j=0}^N\sum _{o=1}^O\sum _{k=1}^{M} x_{ji}^{ko}\le 1\qquad \qquad 1\le i\le N \end{aligned}$$
(24)

which states that each customer is visited at most by one vehicle. The objective function (22) was changed to

$$\begin{aligned} C=\sum _{i=0}^{N}\sum _{j=1}^{N}\sum _{k=1}^{M}\sum _{o=1}^{O}x_{ij}^{ko}\rightarrow \min \end{aligned}$$
(25)

which means that we minimize the number of customers that are visited at least by one vehicle, which is equivalent to the number of customers whose demands are satisfied. The modified MILP model consists of constraints (7-21,24) and objective function (25). This new MILP model was applied to the test examples corresponding to the depot in Pécs (18 shifts overall). The total number of clients and the number of clients that are served in the solution found by the method is shown in Table 4.

Table 4 Number of clients whose demands are satisfied

In 13 cases a solution, in which all of the clients were served, was found. In the remaining 5 cases, the method found a solution in which 1 or 2 clients were not served.

If it turns out in the first phase that all customers can be served then in the second phase the original MILP model is used to determine the optimal routes of vehicles. If the result of the first phase tells us that some customers cannot be served, these customers are deleted from the active client list and the original MILP model is used to determine the optimal routes of the vehicles serving the remaining active clients. In this case, the company can either get in touch with the clients that are not served and try to modify their contracts (for example change their service time to another shift) or manually insert these clients into the route plan given by the MILP model. The company uses both methods in its daily activities.

5 Conclusion

In this paper we investigated a special petrol station replenishment problem of a European petrol company. Taking into consideration the special conditions we introduced a MILP model of the problem. To reduce the size complexity of the model, the customers were clustered using machine learning and based on the clusters, another MILP model was presented. The MILP models were tested on examples of the company. The tests showed that the MILP model without clustering can find a solution in small-sized examples. We experienced that the MILP model combined with clustering gave solutions for many more problems than the model without clustering. Furthermore, in 10 cases our results outperformed the software used by the company and in the case of 3 night shifts we were able to find the optimal solutions. Since the computers and softwares that can solve MILP models are continuously developing, our MILP approach is promising. In the future, we would like to investigate whether our method can be used for long-term planning as well.