1 Introduction

The petrol truck routing problem refers to the process of distributing petrol products from a depot to stations, and this distribution process is the last link in the petroleum industry chain. With the development of modern logistics technology, improving the distribution efficiency and reducing costs have become research topics of interest (Oke et al. 2018). Achieving these tasks directly serves the end users and ultimately corresponds to increased enterprise profit.

This research focuses on designing the routes for petrol trucks in the distribution process. In many large cities, hundreds of petrol stations are distributed and supplied by a regional petrol sales company. Currently, the process of petrol truck scheduling is as follows. Before the distribution starts, the sales company drafts a plan involving the amount of petrol and distribution time windows for the next day for each station according to the average daily sales and current inventory.

Each truck has two compartments that can load one or two types of petrol products and distribute to one or two stations. To control the quality of the petrol and ensure safety during transport, the petrol in each compartment must be fully transferred after arriving at the station. The demand of each petrol station is different, e.g. large stations have greater demands for certain types of petrol products and have correspondingly sized petrol storage tanks to meet the given demand.

The delivery time window depends on the sales of each petrol station. The delivery time window should guarantee that the stock level satisfies the minimum requirement before the truck arrives and that the stock level of a petrol storage tank at a station does not exceed the maximum limit after the truck departs. In China, petrol stations typically demand three types of petrol products: #92 gasoline, #95 gasoline, and #0 diesel. In the case of meeting the time window requirement, a truck has four choices: (1) it can deliver one type of petrol product to one petrol station; (2) it can deliver two types of petrol products to one petrol station; (3) it can deliver two types of different products to different petrol stations; (4) it can deliver the same product to two different stations. Therefore, a reasonable distribution plan is required to ensure that the three types of petrol products are delivered each day. In the actual distribution process, to enhance the delivery efficiency, a single truck can complete multiple distribution tasks in a day. As a result, after completely unloading the petrol products, the truck must return to the depot, reload, and then start from the depot to perform another task during the day. Moreover, so that the drivers can rest, a truck is associated with multiple crews to perform the delivery tasks. As a result, a truck can run for an entire day, with the former crew returning to the depot and the truck operation transferred to the next crew. When a truck is dispatched, a corresponding maintenance cost is accrued. The number of dispatched trucks should be minimized to the greatest extent possible under the constraints of the distribution. Therefore, the goal is to minimize the total travel and fixed costs associated with using the trucks.

The remainder of this paper is organized as follows. In the next section, the related literature is reviewed. Section 3 presents a description of the petrol truck routing problem. In Sect. 4, we provide a model to mathematically describe the problem. Section 5 presents a proposed heuristic method to solve this model. In Sect. 6, benchmark problems are investigated to verify the effectiveness of the proposed method, and a real-life case in Beijing is presented. Finally, the conclusions are provided in Sect. 7.

2 Literature review

The petrol truck routing problem is a specialized case of the vehicle routing problem (VRP). In 1959, Dantzig and Ramser (1959) were the first to introduce the truck dispatching problem. They modelled a fleet of homogeneous trucks dispatched to meet the petrol demands of multiple petrol stations from a central hub and with a minimum travel distance. Avella et al. (2004) studied the problem of a company that delivers several products to a set of fuel pump stations. The objective of the problem was to satisfy the orders using the available resources (trucks and drivers) based on minimizing the total travel cost for delivery. The authors developed a fast-combinatorial heuristic method that can be used to quickly find a feasible solution and provide an initial set of columns for the branch-and-price algorithm. In their problem, the total number of clients was 60, with approximately 25 clients served daily. Ng et al. (2008) studied a tanker assignment and routing problem for petrol products to minimize the number of tankers, minimize the number of drops in trips, maximize the profit and maximize utilization of resources. Cornillier et al. (2008b) proposed a heuristic method for the multiperiod petrol station replenishment problem; this heuristic approach included route construction and truck loading procedures, a route packing procedure, and two procedures associated with the anticipation or the postponement of deliveries. The objective was to maximize the total profit, or revenue and minimize the total routing costs and regular and overtime costs. Cornillier et al. (2008a) divided the problem into a truck loading problem and a routing problem and proposed an exact algorithm to solve the problems. In a follow-up study, Cornillier et al. (2009, 2012) considered the time window and multiple depots to make the problem more realistic. Boctor et al. (2011) proposed a heuristic algorithm to solve the problem considering different types of petrol trucks and their time-based work limits. Wang et al. (2018) studied petrol truck scheduling problems considering multipath selection and congestion and proposed a heuristic approach. Zhang et al. (2018) presented a case study on vehicle routing and scheduling problems of filling stations replenishment with time windows in initiative distribution.

The distribution of petrol products typically uses a single day as the study period because it is challenging to predict the demand at each station over a longer period. However, some researchers have studied the distribution of petrol products over certain periods that exceed one day. Popović et al. (2012) focused on the distribution problem of a petrol truck and the inventory management of petrol stations and proposed a variable neighbourhood search (VNS) method to solve the multiperiod, multicompartment, and multiproduct problem for a small distribution network (3 days and 10 petrol stations). In this network, at least three stations could be visited along the path of each vehicle. Vidović et al. (2014) expanded the scale of the above problem and developed an algorithm that could provide a solution over more days and for more stations (5 days and 50 petrol stations). Carotenuto et al. (2015) proposed a genetic algorithm (GA) to address the unloading of a single type of petrol product in a large-scale problem (at most 200 stations), with the objective of minimizing the total vehicle distance travelled within a week.

Optimization problems involving multiple compartments have been widely studied. Silvestrin and Ritt (2017) studied the multicompartment VRP, developed a tabu search (TS) heuristic method, and embedded this method into an iterative local search procedure. Sethanan and Pitakaso (2016) studied the raw milk transportation scheduling problem with multicompartment vehicles, where each compartment was dedicated to a certain type of milk depending on the destination. Sample problems, including 5–40 customers, were tested to investigate the performance of the algorithms. Alinaghian and Shokouhi (2018) proposed a hybrid algorithm based on an adaptive large neighbourhood search, and a VNS was developed to solve large-scale instances. The objective function of the proposed problem included the minimization of the number of vehicles and subsequent minimization of the total traversed distance.

Previous computational studies have proven that the VRP is an NP-hardness (nondeterministic polynomial-time hardness) problem (Lenstra and Kan 1981) and that VRPs with time windows (VRPTWs) are correspondingly challenging to solve in a reasonable amount of time for real-world problems. Many researchers have investigated VRPTWs (Ando and Taniguchi 2006; Desrochers, Desrosiers, and Solomon 1992; Cornillier et al. 2009). The petrol truck routing problem represents a branch of the VRPTW. A city typically has hundreds of petrol stations waiting for petrol products to be delivered from depots. To solve the associated routing problem, several solution techniques have been introduced. In the past decade, metaheuristic approaches such as the GA (Bae et al. 2007), differential evolution (DE) (Dechampai et al. 2017; Mingyong and Erbao 2010; Sethanan and Pitakaso 2016), ant colony optimization (ACO) (Dong and Xiang 2006), TS (Côté and Potvin 2009; Bolduc et al. 2010), and simulated annealing (SA) (Osman 1993; Azad et al. 2017) methods have been widely used to solve this problem. Some studies have combined these methods in a variable neighbourhood search, VNS, or large neighbourhood search to find a satisfactory solution in a reasonable amount of time.

Although many studies have generally used metaheuristic techniques, the exact algorithms are efficient only for instances involving certain small-scale problems. Moreover, an exact method can effectively avoid the problem of convergence to local optima, which is a characteristic limitation of metaheuristic methods. Some researchers have applied exact methods to solve the VRP problem. A common approach is to accelerate the solution process by adding certain valid inequalities to the basic model. Valid inequalities can help mathematical programming solvers obtain new configurations and improve the overall algorithm performance (Lahyani et al. 2015). Archetti et al. (2007) derived new additional valid inequalities to improve the linear relaxation of a model for the single-vehicle problem and proposed an exact algorithm to solve instances with up to 30 customers and six periods and with up to 50 customers and three periods. Previous researchers (Gendron and Crainic 1994) showed that adding inequalities can improve lower bounds and consequently reduce the search space of branch-and-bound algorithms. Moreover, some researchers (Jena et al. 2015; Coelho and Laporte 2014; Lahyani et al. 2015) have studied specific problems to determine how to apply the inequalities without introducing new variables; in this manner, the speed at which the optimal solution is found can be accelerated by reducing the number of nodes and the number of simplex iterations in the branch-and-bound algorithm.

Braekers et al. (2016) noted that the research on the VRP is increasingly approaching the characteristics and assumptions of practical problems that the models are more realistic and that the proposed algorithms are more applicable in practice. Although multiple literature reports have described investigations of the VRP and specific petrol product delivery problems, to our knowledge, the petrol truck routing problem considered in this research is the first study involving trucks returning to the depot and restarting from the depot several times in a single day. This condition is closer to the actual petrol product routing problem in China. Thus, in this study, we propose a combination of the branch-and-bound method with a tabu list and the Metropolis acceptance criterion to solve the petrol truck routing problem at a practical scale.

Therefore, this study contributes to the literature by presenting a new mathematical model for the multireturn-to-depot and multicompartment petrol truck routing problem. An approach combining the branch-and-bound method with a tabu list and the Metropolis acceptance criterion is designed to solve the large-scale instances of this problem. In addition, valid inequalities are added in the model to accelerate the process of solving the branch-and-bound algorithm. To evaluate the performance of the proposed algorithm, the algorithm results are compared with the results of the exact method based on a transformed Solomon benchmark. In addition, a large-scale petrol truck routing problem in Beijing, China, is studied to verify the practicality of the proposed algorithm.

3 Problem description

In the petrol truck routing problem, the sales company develops a distribution plan for each petrol product and petrol station and ensures that the truck can arrive on time. In the case of the above conditions, it is necessary to minimize the cost as much as possible. Trucks used to transport petrol products have two compartments with limited capacity. The distribution plan begins in the morning. Starting from the depot, the truck drives to stations according to the distribution scheme. After unloading both compartments, the truck must drive back to the depot. If follow-up tasks exist, then the truck must load petrol products and drive to other stations. If there is no follow-up task, then the truck will end its work. In this study, the research objectives have the following characteristics:

  1. (1)

    The truck has two compartments. Each truck can unload the products at two petrol stations at most, and the petrol product in a compartment must be unloaded entirely during the unloading process.

  2. (2)

    Trucks must return to the depot after finishing the delivery task. Moreover, taking the workload into account, the truck can leave the depot at most three times a day.

  3. (3)

    The demand for each petrol product at all stations should be met.

  4. (4)

    For a given number of petrol trucks at a depot, there is a sufficient number of feeding arms that are used for loading, and after the arrival of the trucks, the loading operation can be performed immediately; that is, the time required for the loading operations is fixed.

  5. (5)

    Each petrol station has a time window according to the inventory. After the truck is unloaded, the stock level of the petrol storage tanks shall not exceed the maximum inventory. In addition, the corresponding products should be replenished before inventory depletion. After the truck arrives at the station, it requires time to unload the petrol products from the compartment to the storage tank.

  6. (6)

    The unloading operating time at all petrol stations is identical.

  7. (7)

    The distance between two petrol stations and the distance between the depot and a station are known and do not vary with traffic conditions.

  8. (8)

    The truck speed is assumed to always be constant.

  9. (9)

    The sales companies of petrol products generally make a daily plan.

Figure 1 provides an example of the characteristics of a truck. To accommodate these characteristics, this study establishes a mathematical model.

Fig. 1
figure 1

The working scheme of a truck in a single day

4 Mathematical model

In this section, a mathematical model is formulated to minimize the total costs, including the total travel and fixed costs associated with using the trucks. The parameters and decision variables used in formulating the model are defined. The 0–1 mixed-integer programming formulation is presented below, with a brief explanation of each constraint.


Sets

N T :

A set of both the depot and petrol stations, denoted by indices i and j, respectively; the depot in this study is designated as 0

N C :

A set of petrol stations

N D :

The depot

K :

The set of trucks, denoted by index k

G :

The set of petrol products, denoted by index g

E :

The set of number of trips by a single truck, denoted by index e


Parameters

L i,j :

The distance from node i to node j

γ :

The distance cost conversion factor

F :

The fixed cost of using the trucks

d i,g :

The demand for product g at petrol station i

V :

The loading capacity of a truck

α :

The conversion factor based on distance and time

st :

The unloading operation time at stations

lt :

The loading operation time at the depot

bt i :

The starting time of the unloading operation time window at petrol station i

wt i :

The ending time of the unloading operation time window at petrol station i

R :

The maximum number of locations (including the petrol stations and the depot) for a truck to visit in a single trip

M :

A sufficiently large number


Decision variables

x i,j,k,e :

Refers to a binary variable corresponding to the eth time for truck k to transport petrol products from node i to node j: \(x_{i,j,k,e} { = }1\); otherwise, \(x_{i,j,k,e} { = }0\)

u k :

Refers to a binary variable; if truck k is used for the delivery task: \(u_{k} { = }1\); otherwise, \(u_{k} { = }0\)

y i,g,k,e :

Refers to a binary variable; if the product g for petrol station i is transported by truck k for the eth time: \(y_{i,g,k,e} { = }1\); otherwise, \(y_{i,g,k,e} { = }0\)

t i :

Refers to the arrival time when the truck visits petrol station i

\(ST_{i,k,e}\) :

is a real variable that refers to the visiting sequence of truck k at node i at its eth time of departure from the depot; for each station, the larger the \(ST_{i,k,e}\) is, the later the station is visited by the truck

These variables are formulated as follows.

$$\hbox{min} \sum\limits_{{i \in N_{T} }} {\sum\limits_{{j \in N_{T} }} {\sum\limits_{k \in K} {\sum\limits_{e \in E} {x_{i,j,k,e} \gamma L_{i,j} } } } } + \sum\limits_{k \in K} {u_{k} F}$$
(1)
$$\sum\limits_{{i \in N_{D} }} {\sum\limits_{{j \in N_{C} }} {x_{i,j,k,e} } } \le u_{k}, \quad k \in K,e \in E$$
(2)
$$\sum\limits_{{i \in N_{T} }} {x_{i,j,k,e} } = \sum\limits_{{i' \in N_{T} }} {x_{j,i',k,e} }, \quad j \in N_{T} ,k \in K,e \in E$$
(3)
$$\sum\limits_{{i \in N_{T} }} {x_{i,j,k,e} } \le 1, \quad j \in N_{C}, k \in K,e \in E$$
(4)
$$\sum\limits_{k \in K} {\sum\limits_{e \in E} {y_{i,g,k,e} } } = 1,\quad i \in N_{C} ,g \in G$$
(5)
$$\sum\limits_{g \in G} {y_{i,g,k,e} } \le M\sum\limits_{{j \in N_{T} }} {x_{j,i,k,e} }, \quad i \in N_{C}, k \in K,e \in E$$
(6)
$$\sum\limits_{{j \in N_{T} }} {x_{j,i,k,e} } \le M\sum\limits_{g \in G} {y_{i,g,k,e} }, \quad i \in N_{C}, k \in K,e \in E$$
(7)
$$\sum\limits_{{i \in N_{C} }} {y_{i,g,k,e} } d_{i,g} \le V, \quad g \in G,k \in K,e \in E$$
(8)
$$\sum\limits_{i = 0} {\sum\limits_{k \in K} {\sum\limits_{e \in E} {ST_{i,k,e} } } } = 0$$
(9)
$$ST_{i,k,e} + 1 \le ST_{j,k,e} + M(1 - x_{i,j,k,e} ), \quad i \in N_{T} ,j \in N_{C} ,k \in K,e \in E$$
(10)
$$t_{i} + \alpha L_{i,j} + st - M(1 - x_{i,j,k,e} ) \le t_{j}, \quad i,j \in N_{C} ,k \in K,e \in E$$
(11)
$$t_{i} + \alpha L_{i,0} - M(1 - x_{i,0,k,e} ) + lt \le t_{j} - \alpha L_{0,j} + M(1 - x_{0,j,k,e + 1} ),\quad i,j \in N_{C} ,k \in K,e = 1,2, \ldots ,\left| E \right| - 1$$
(12)
$$M\sum\limits_{i} {\sum\limits_{j} {x_{i,j,k,e} } } \ge \sum\limits_{i} {\sum\limits_{j} {x_{i,j,k,e + 1} } } ,i,j \in N_{C} ,k \in K,e = 1,2, \ldots ,E - 1$$
(13)
$$bt_{i} \le t_{i} ,i \in N_{C}$$
(14)
$$t_{i} \le wt_{i} ,\;i \in N_{C}$$
(15)
$$x_{i,j,k,e} ,y_{i,g,k,e} ,u_{k} \in \{ 0,1\}, \quad i,j \in N_{T} ,g \in G,k \in K,e \in E$$
(16)
$$ST_{i,k,e} \ge 0, \quad i \in N_{T} ,k \in K,e \in E$$
(17)

Equation (1) is the objective function; it aims to minimize the total cost, including the total travel cost and the fixed cost required to operate the trucks. Constraint (2) indicates that when each truck is assigned to a delivery task, the truck should start its route from a depot. Constraint (3) ensures that the truck must leave the same petrol station or depot that it entered. Constraint (4) ensures that each station can be visited only once. Constraint (5) ensures that the petrol demands of all stations for all types of petrol products are satisfied. Constraints (6) and (7) ensure that for each product, a corresponding truck must be assigned to execute the task. Constraint (8) ensures that the total amount of petrol loaded in a truck does not exceed the maximum available load. Constraints (9) and (10) ensure that subroutes are eliminated from the truck movements. These constraints guarantee that a truck starts at the depot, and a closed loop from petrol station to petrol station is not allowed in this model. Constraint (11) ensures that in a single-truck trip, the unloading time and travel time occur between the arrival times at the petrol stations based on an adjacent visit sequence. Constraint (12) ensures that the loading time and travel time occur between two adjacent trips of a truck. Constraint (13) ensures that for two adjacent truck trips, the second trip can only occur after the first trip ends. Constraint (14) ensures that the time of arrival of the truck occurs later than the starting time of the time window. Constraint (15) ensures that the time of arrival at each petrol station occurs earlier than the ending time of the time window. Constraints (16) and (17) define the domains of the decision variables.

4.1 Valid inequalities

Based on constraints (117), a basic model of the petrol truck routing problem is established. However, this problem requires that the solution be completed within a limited time. In our approach, it might be better to reduce the calculation time using the branch-and-bound solver Gurobi. According to the previous research (Gendron and Crainic 1994) that adding valid inequalities can reduce the search space of the branch-and-bound algorithm, we propose several valid inequalities to improve the computational speed for this problem.

  1. (1)

    Assignment constraints

$$u_{k} \ge u_{k + 1},\quad k = 1,2, \ldots ,\left| K \right| - 1$$
(18)

Constraint (18) requires that the truck with the first number in the sequence executes the task first. Assuming that three vehicles are used and that a task requires only one vehicle, three optimal solutions exist. By eliminating these redundant solutions, the number of unnecessary searches can be reduced.

$$Mu_{k} \ge \sum\limits_{{i \in N_{T} }} {\sum\limits_{{j \in N_{T} }} {x_{i,j,k,e} } }, \quad k \in K,e \in E$$
(19)

Constraint (19) ensures that the corresponding delivery route is arranged after truck k is enabled.

  1. (2)

    Routing constraints

$$\sum\limits_{{j \in N_{C} }} {x_{i,j,k,e} } \le 1, \quad i \in N_{T} ,k \in K,e \in E$$
(20)
$$\sum\limits_{{i \in N_{T} }} {\sum\limits_{{j \in N_{T} }} {x_{i,j,k,e} } } \le R, \quad k \in K,e \in E$$
(21)

Constraint (20) ensures that each truck can enter each petrol station only once. This constraint corresponds to constraint (4) but is expressed differently. Constraint (21) ensures that one truck can travel to only a limited number of petrol stations at one time considering the limitation of the capacity of the truck. These two constraints can eliminate solutions that dissatisfy these conditions.

$$\sum\limits_{{j \in N_{T} }} {x_{i,j,k,e} } \le \sum\limits_{g \in G} {y_{i,g,k,e} }, \quad i \in N_{C} ,k \in K,e \in E$$
(22)

Constraint (22) ensures that when the truck enters station i, the truck completes the delivery task at the station.

5 Proposed heuristic procedure

The model is a mixed-integer linear programming (MILP) model that contains a large number of binary variables. This problem requires a delivery plan that is generated every day; thus, the results should be completed in a relatively short amount of time. Therefore, we propose an algorithm that combines the branch-and-bound method with a tabu list and the Metropolis acceptance criterion.

An initial solution should be established. First, two types of libraries are built for each station that requires a visit; one type is called a “direct-reach library”, and the other type is called a “return-and-reach library”. In the first library, if a truck can drive from station A to station B within the time window, then station B is added to the direct-reach library of station A. In the second library, if a truck can drive from station A to the depot, load petrol products at the depot and then drive to station B in the requirements of the time window, then station B can be added to the return-and-reach library. We search all stations and obtain these two types of libraries for each station.

The second step is to assign each element of the library a likelihood of being selected. To reduce the number of trucks in the initial solution, stations that have a similar time window are assigned a higher probability of adjacent arrangement in the sequence of a truck. Moreover, to maintain a certain randomness in the subsequent search operation, other farther stations are assigned a nonzero probability of selection, thereby allowing two stations with time windows that are far apart to be adjacently arranged in sequence.

To generate the initial solution, a truck will find the top entry in the list of stations arranged in sequence. Taking this station as the first visited station, another station in the direct-reach library of the first station is randomly selected as the second visited station. Of course, this station is then removed from the list of stations arranged in sequence, as well as from the direct-reach library and the return-and-reach library. Furthermore, if it is not possible for the truck to go to the next station because of the loading capacity, then the truck must return to the depot to load before visiting other stations, and we must select a station in the return-and-reach library. We use this method until there are no stations in the direct-reach library or the return-and-reach library of the last station in the truck sequence. Subsequently, the next truck route is planned.

After the initial solution is generated, the solution is iterated with the goal of using fewer trucks and identifying shorter paths. As shown in Fig. 2, in previous studies, local search methods were used to analyse the route of a truck or two trucks using strategies such as relocate, exchange, cross, swap, and reverse. These methods randomly select one or two routes and then search for one station or a few stations in the neighbourhood of a given station to obtain an improved solution. However, a variety of sequences can be generated, and the solution determined is not necessarily the best solution; thus, a follow-up operation is required. Therefore, we propose a method for improving the efficiency of the above operations. First, several routes are randomly selected. Then, the MILP model with valid inequalities is solved to obtain the optimal solution. Next, we continue to select other routes, and the optimal solution of these routes is found. Using this method, the number of trucks used can be reduced, and the travel distance can be decreased; thus, a better result can be achieved.

Fig. 2
figure 2

Directly identifying the best routes. Note: 2-opt means 2-optimization, it is a local search algorithm for solving travelling salesman problem

For small-scale problems, the state-of-the-art Gurobi solver (Gurobi Optimization, LLC. 2018) can be used to calculate the optimal solution in a few seconds. Using this approach, a fast computational speed can be achieved for improved solutions or even optimal solutions by decomposing the original problem into multiple small-scale problems.

5.1 Search strategy

In this study, we use the random route selection method to search for the optimal solution based on the following strategies.

Method 1

Randomly select the routes of two trucks for optimal arrangement.

Method 2

Randomly select the routes of three trucks for optimal arrangement.

Method 3

Randomly select the routes of four trucks for optimal arrangement.

The routes in the above three methods are randomly selected. Next, using the above model, the optimal solution is obtained using the Gurobi solver with the branch-and-bound method. In the early stage of the search, method 3 can rapidly reduce the number of trucks. When the single search time of method 3 exceeds a certain limit, method 2 and method 1 are adopted for faster searching.

Method 4

The route of the truck with the smallest number of stations and the route of one random truck.

Method 5

The route of the truck with the smallest number of stations and the routes of two random trucks.

An important goal of the search is to reduce the number of trucks; when only one or two stations exist in a route, it is straightforward for these stations to be combined into another route. Therefore, a process that merges the routes of trucks with few stations to visit and other routes can reduce the number of trucks.

Method 6

A random station from the routes of the trucks with the smallest number of stations and the route of one random truck.

Method 7

A random station from the routes of the trucks with the smallest number of stations and the routes of two random trucks.

Similarly, considering that some routes cannot easily combine multiple stations in one route, it is better to insert specific stations sequentially into other routes, such that the stations visited by the truck, or trucks, with the smallest number of stations can be added to other routes instead. In this way, the number of trucks is reduced.

Method 8

Select a random station from the route of one random truck and then randomly select a route of a truck.

Method 9

Select a random station from the route of one random truck and then randomly select the routes of two trucks.

In the late search stages, particularly, if there are many stations on the routes of some trucks, the solution is relatively fixed, and it is not straightforward to generate improved solutions simply by rearranging the truck routes. Thus, selecting a random station from the route of one random truck and then associating the station with the routes of another one or two trucks can help avoid obtaining a local optimum solution. This strategy must be performed based on the Metropolis acceptance criterion.

5.2 Tabu list

A neighbourhood search is a metaheuristic method for solving a set of combinatorial optimization and global optimization problems. The tabu list is used to accelerate the search by suppressing certain experienced operations.

Considering the strategies mentioned above, to avoid the random selection of trucks matching the previously selected trucks and reduce unnecessary search processes, we developed a tabu list to record the steps of the previously selected trucks. Because selected trucks are assigned to the best solution, there is no need to select the same trucks in the following search steps; thus, such combinations are not selected. Only after there are changes to these routes are these combinations removed from the tabu list.

5.3 Metropolis acceptance criterion

The annealing process in thermodynamics essentially achieves a state of minimum energy between molecules with slowly decreasing temperature. Let us assume that there are n conditions that are finite and discrete in thermodynamic system S and that the energy of condition i is Ei. At temperature Tk, thermal equilibrium is approached over time, and the probability of achieving condition i is as follows:

$$P_{i} (T_{k} ) = C_{k} \exp \left( { - \frac{{E_{i} }}{{T_{k} }}} \right)$$
(23)

We apply the Metropolis acceptance criterion to our algorithm. This criterion can accept a solution that is not better than the original value. When using methods 6, 7, 8, and 9, the solution of the new generation may be no better than the original solution. Thus, the Metropolis acceptance criterion allows the search algorithm to avoid the local optimal solution, with a certain probability of obtaining a solution worse than the current solution.

6 Computational results

To obtain effective solutions for the petrol truck routing problem, we construct two cases and report their computational results. To our knowledge, no suitable benchmarks exist for the problems of interest in this study. Thus, we modified the well-known instances of the VRPTW introduced by Solomon (1987) in Sect. 6.1 to make this benchmark case match our problem. In Sect. 6.2, we provide the details of real cases in Beijing, China. The proposed solution algorithm was implemented in Python 3.6 using Gurobi 7.5 as the MILP solver and run on a PC with an Intel Core i7 3.40 GHz CPU and 8 GB of RAM.

6.1 Solomon benchmark

In this section, several modified Solomon’s benchmark problems are adapted as test instances to investigate the performance of the proposed model. In the remainder of this section, the test data set and experiment settings are introduced first, followed by the computational results of the proposed model based on this data set.

6.1.1 Test data set and experiment settings

The well-known Solomon’s benchmark problems were chosen as the test data sets in several previous studies of the VRPTW problem (Barbucha 2014; Markov et al. 2016; Zhang et al. 2017). Several factors were considered when these benchmark problems were generated, such as the geographical locations of the customers and the tightness of the time windows. In this study, we selected several examples that are similar to our petrol truck routing problem. Sixteen of the benchmark problems were chosen and adapted for the demonstration of the proposed model. Their major characteristics are listed in Table 1.

Table 1 The major characteristics of the selected Solomon’s benchmark problems

Three types of problems according to the geographical locations of customers are shown in Table 1. For each problem type, some instances are chosen with different time window widths. For each problem instance, there are 25 customers. According to the characteristics of the problems we have studied, we assume that each truck starts at a depot with a maximum capacity of 2 units of products, that each compartment can carry a unit and that each station requires one unit of product. We calculate the optimal solution by implementing the complete model in the Gurobi solver. The travel times are equal to the distance between two stations or between a station and the depot, and the service times are the same as those in the benchmark cases. This data set is selected to demonstrate the applicability of the proposed model for problem instances with different characteristics.

In our approach, the maximum number of search iterations is set to 2000. In the local search improvement phases, the search stops if the best feasible solution has not been improved for 200 consecutive iterations. Each problem instance is tested 10 times, and the minimum and average solutions are obtained.

6.1.2 Computational results of the proposed model for a typical problem instance

In this section, one of the problem instances (R101.25) in Table 1 is selected as a typical example to demonstrate the performance of the proposed model. R101.25 is considered a typical example because the randomly distributed geographical locations of customers are similar to the actual geographical distribution of petrol stations, and the time window width (approximately 1 h) is similar to the width of the time window of petrol distribution. The computational results of the proposed model for R101.25 are shown in Table 2.

Table 2 Computational results of the proposed method

For R101.25, the optimal solution yielded by our algorithm is consistent with the best solution, and the average solution is acceptable. In addition, the average time of the solution is related to the width of the time window. To validate the method, some examples have longer time windows, thereby reducing the solution time. In general, the time window length is close to the actual calculation examples, such as for C101.25, C105.25, C106.25, C107.25, R101.25a, R105.25a, R201.25, R205.25, and RC201.25, and the solution time is shorter.

6.2 A real case in China

In this section, we describe the computational experiments conducted to assess the performance of our model and algorithm. The details of the real instances in Beijing, China, are provided in Sect. 6.2.1. In Sect. 6.2.2, we analyse the results of the computational experiments obtained by our approach.

6.2.1 Background

We created an instance based on real data gathered in Beijing by Baidu Map. The investigation involves instances with one depot and up to 100 filling stations, with each station requiring three types of petrol products. We assume that the number of trucks is adequate and that the size of each truck is the same. Each truck has two compartments, and to control the quality of the petrol product and ensure safety during the transport process, the petrol in each compartment must be fully unloaded after arriving at the station. The demand for petrol at different petrol stations is different. Some stations have high demands for certain types of petrol products. Among these stations, the stations with a special demand for petrol products are shown in Table 3, and the demand of other petrol stations for all types of petrol products is 20,000 L. Considering the characteristics of urban traffic in Beijing, the Manhattan distance is used to simplify the paths between stations and between a station and the depot. The locations of all petrol stations and the depot are shown in Fig. 3. The distribution plan starts at 5 A.M., when trucks begin to deliver the petrol products from the depot to the stations. The total working time is 19 h, the time window is divided into 1900 sections, and every hour contains 100 divisions. A depot located on the west side of the study region is responsible for the petrol supply of these stations. The goods must be delivered within the given time range because adding time windows to the application makes the problem more complex. The trucks spend time waiting at customer locations to satisfy the time window requirements.

Table 3 Stations with a special demand for petrol products
Fig. 3
figure 3

Locations of the depot and petrol stations

6.2.2 Computational results

The real case was run five times using the proposed method, and the results are listed in Table 4. We set the maximum number of iterations to 5000, and the loop is stopped when a better solution cannot be obtained after 200 consecutive iterations.

Table 4 The results based on the proposed algorithm

According to the distribution plan, all stations with a high demand for petrol are loaded with a petrol truck, and the truck arrives at the target petrol station once. For stations with similar time windows and demands for different types of petrol products, using a truck to finish two of these three tasks along one route is convenient for the petrol station at which unloading occurs; this plan is similar to that of the actual process. Comparing the results of five calculations, the gap between the best and worst results is 1.18%. This overall planning for a full-day delivery scheme is better than single-route planning and effectively minimizes the delivery time and the number of trucks. In this case, the smallest calculation time is 2304.6 s, the average solution time is 2758.0 s, and the largest calculation time is 3704.8 s; therefore, the computational speed is acceptable.

7 Conclusions

We have proposed a mathematical model of the multireturn-to-depot petrol truck routing problem with time windows and developed a heuristic algorithm for addressing large-scale instances of this problem. The objective of this model is to minimize the total costs while considering the travel cost and fixed cost of using the trucks. The heuristic algorithm combines the branch-and-bound method with a tabu list and the Metropolis acceptance criterion. After the initial solution is generated, an improved solution is reached by constantly searching for the local optimum. Two cases are reported. The first case demonstrates the optimality and stability of the proposed algorithm, and the second case shows that this method can be applied to a real city petrol truck routing problem with 100 stations and three types of petrol products. The computational results show that this heuristic approach produces acceptable solutions with reasonable calculation times.