1 Introduction

The vehicle routing problem (VRP) has been extensively studied due to its relevance to industry and world economy. In the last decades several variants of the problem were proposed because of the diversity of operating rules and constraints encountered in real-world applications (Vidal et al. 2014). To address the actual needs of carriers and industry, the problem has been enriched with additional restrictions, as well as clients’ and fleet’s characteristics (see, for example, Sniezek and Bodin 2006; Cordeau et al. 2007; Pureza and Laporte 2008; Kritikos and Ioannou 2013; Escobar 2014; Ehmke et al. 2016; Mao et al. 2020, and the references therein).

This article addresses an important aspect of the VRP: the situation in which companies hire a third-party logistics company (3PL), whose freight charges are calculated using discontinuous step cost functions. This problem will be called the Fleet Size and Mix Vehicle Routing Problem with Time Windows and Step Cost functions from now on, and it will be referred to with the acronym FSMVRPTWSC, according to the usual nomenclature. In this problem, the company prepares its own routing, evaluating all the restrictions and freight costs, but it does not own the vehicles that deliver the goods; the fleet belongs to a 3PL partner. In general, such providers have a vast fleet with multiple vehicles of each kind to offer to the clients (see, for example, UPS Fact Sheets.Footnote 1) The use of logistics services allows the company to focus on its core business and to avoid costs related to the acquisition and maintenance of a fleet, equipment depreciation, drivers and employees’ payroll, among other costs. Lieb and Lieb (2015) point out that, by 2013, the 3PL industry had evolved into an important outsourcing option for logistics managers around the globe. This industry generates nearly $700 billions in annual operating revenues and it provides a broad range of services to managers seeking not only to reduce operating costs and improve service levels, but also, in many cases, to reduce their capital commitments by using the asset base of 3PLs. An extensive review on the relationship between companies and 3PL partners is presented in Marasco (2008).

The shipping charges considered in this work are calculated using step cost functions in which values are determined according to the type of vehicle and the distance traveled, with fixed values for predefined distance ranges, which is a convenient way to calculate and verify these charges. To illustrate the benefit of directly considering the step cost functions, consider the following example. There are five clients, each one with a demand of 10 units, that can be served by vehicles of capacity 35 units departing from a central depot. Figure 1a shows the distances between the clients and the depot. Table 1 and Fig. 2 (solid lines) present the freight costs with four distance’s ranges. Suppose that the trend line \(\mathrm {cost}(d) = 30.9 + 1.7 d\), shown in Fig. 2 (dashed line), is used to compute the cost of transportation. In this case, Fig. 1b presents the optimal solution with two vehicles traveling a total distance of \(15+16 = 31\) units. The freight table shows that the distance traveled by each vehicle is in the second distance range. So each one costs 60 monetary units, leading to a total cost of 120. Using a direct approach to the problem as a step cost function problem, an alternative solution can be obtained (see Fig. 1c) with a total distance of 32 units. The distance traveled by the first vehicle, 10 distance units, is within the first distance range with a cost of 30 and the distance of the second vehicle, 22, is in the second range, with a cost of 60. In this case, although the total distance is greater than in the previous solution, the total cost is 90. This example was intended to show that there are opportunities, even in small cases, that can go unnoticed when solving a step cost function problem using linear approximations.

Table 1 Freight costs table
Fig. 1
figure 1

Example with five clients and two vehicles: a spatial distribution of clients and depot; b optimal solution using linearized costs; and c optimal solution using the actual freight cost’s table given by a step cost function

Fig. 2
figure 2

Illustration of a step cost function with four ranges and a possible linearization (trend line in the range [0, 60]

The Fleet Size and Mix Vehicle Routing Problem with Time Windows (FSMVRPTW) can be considered the problem with the closest characteristics to the FSMVRPTWSC. Moreover, the FSMVRPTW has been the starting point for several studies that contribute to approximate VRP-like problems to practice. Liu and Shen (1999) were the first to consider the combination of the FSMVRP and the VRPTW. Their work explores some characteristics of the combined problem to adapt the savings heuristics proposed by Golden et al. (1984) for the FSMVRP. Another important contribution made by these authors was to adjust the data sets proposed by Solomon (1987) for the VRPTW to the FSMVRPTW. Dullaert et al. (2002) also proposed heuristics for this problem that combine the insertion method from Solomon (1987) with the savings concepts for fixed costs of heterogeneous fleets from Golden et al. (1984). However, Dullaert et al. (2002) adopted as the goal to be minimized the total en-route time (excluding the service times at clients); while in Liu and Shen (1999) the goal is given by this measure added to the total fixed costs of the used vehicles. Dell’Amico et al. (2007) developed a parallel regret construction heuristic that is embedded into a ruin and recreate metaheuristic. Liu and Shen (1999) and Dullaert et al. (2002) pointed out that the FSMVRPTW is NP-hard; therefore, through polynomial reduction, FSMVRPTWSC can also be set as NP-hard.

Many articles have also addressed the FSMVRPTW, in general through metaheuristic approaches. For example, Bräysy et al. (2009) introduced a hybrid method that combines threshold accepting and guided local search metaheuristics, Paraskevopoulos et al. (2008) implemented a tabu search within a reactive variable neighborhood search metaheuristic, and Vidal et al. (2014) and Koç et al. (2015) developed population search based metaheuristics. A comparative analysis of the performance of metaheuristic algorithms applied to the FSMVRPTW can be found in Koç et al. (2016).

Hoff et al. (2010) presented an extensive literature review on the different types of fleet composition and vehicle routing problems including time windows restrictions. Despite their positive review of the addition of restrictions and real-world characteristics to the problem, the authors claim that literature still falls short in reflecting real-world situations. In line with this perception, the present work aims at contributing to the literature with an approach that better reflects problems actually faced by the industry. For example, Gudehus and Kotzab (2012) present a freight cost calculation named zonal rates in which the freight cost is fixed per distance zone and transportation unit. As it is possible to understand distance zones and transportation units as distance ranges and types of vehicle, respectively, this cost function can be seen as a variation of the cost function considered in the FSMVRPTWSC, in which the cost does not depend linearly on the traveled distance; and it is represented by a discontinuous function. Ghiani et al. (2004) also present various motion (transportation and handling) costs related to freight transportation. They mention (see p. 201) that “when a shipper uses a public carrier, the cost for transporting a shipment can be calculated on the basis of the rates published by the carrier [\(\dots \)] usually reported in tables” and that “costs often present discontinuities”. A practical example of a freight table that applies fixed values per distance range can be found in a FedEx Standard List RatesFootnote 2 where the delivery costs are defined according to the distance range and the delivery weight. Different freight charging systems are presented in the literature. However, as far as we know, no dedicated solution method has been presented in the literature to approach a problem with freight costs calculated using a table of distance ranges and different types of vehicles.

In this study, first a mixed integer linear programming (MILP) model is introduced to provide a precise definition of the FSMVRPTWSC, allowing future references, new developments, and fair comparisons. Then, two sequential insertion heuristics are proposed. This kind of approach was selected due to the fact that it was successfully applied to the FSMVRPTW by Dullaert et al. (2002) considering the total en-route time. Moreover, the small computational effort of such kind of strategy, which is valuable in some practical applications, is one of the drivers for this study. More specifically for VRP problems, Laporte (2009) claims that several of the most successful metaheuristics seem to be over-engineered; this author suggests that one should attempt to produce simpler and more flexible algorithms capable of handling a larger variety of constraints, even if it causes minor losses in accuracy.

The rest of this manuscript is organized as follows. In the next section the focused problem is described and a mathematical formulation is presented. The proposed heuristic methods are introduced in Sect. 3. Section 4 describes the benchmark and the study case instances and presents numerical experiments. The last section summarizes the main results.

2 Problem description and a mathematical model

In the problem, there are \(n+1\) points geographically scattered, \(N = \{0, 1, 2, \dots , n\}\). Each route begins and ends at the central depot (\(i=0\)), respecting its working hours limited by \([e_0, \ell _0]\). Each client i (\(i = 1, 2, \dots , n\)) has a predetermined demand \(q_i\), a service time \(s_i\), and the start time of the service should be within a specific time window, i.e. between time instants \(e_i\) and \(\ell _i\). The distance \(d_{ij}\) and travel time \(t_{ij}\) between every pair of points are known before the routing plan is defined. There are K different types of vehicles available. Each type of vehicle k (\(k = 1, 2, \dots , K\)) has a load capacity \(a_k\) (\(a_1< a_2< \dots < a_K\)). The cost of each vehicle has a fixed value for each predefined distance range, i.e. each vehicle k has a cost \(C_{kf}\) whether its total traveled distance varies from \(W_f\) to \(W_{f+1}\) for \(f = 0, 1, 2, \dots , F-1\), where \(F-1\) is the penultimate distance range. The last range, F, is an exception, since it has no upper bound and the cost grows linearly, starting from \(C_{k,F-1}\), plus \(C_{kF}\) for each unit of distance added. Thus, given a traveled distance \(d>0\), the step cost function \(C_k\) for vehicle k can be defined as

$$\begin{aligned} C_k(d) = \left\{ \begin{array}{ll} C_{kf}, &{} \text{ if } W_f< d \le W_{f+1} \text{ for } \text{ some } f \in \{ 0, 1, \dots , F-1\}, \\ C_{k,F-1} + C_{kF}(d - W_F), &{} \text{ if } W_F < d. \end{array} \right. \end{aligned}$$

Figure 3 illustrates the step cost function mechanism with three types of vehicles (\(K = 3\)) and four distance ranges (\(F = 4\)).

Fig. 3
figure 3

Example of step cost functions with three types of vehicles and four distance ranges

An MILP model for the FSMVRPTWSC is presented next. The basic elements of the model are based on the model presented by Golden et al. (1984) for the FSMVRP. New elements are introduced in this work to consider time windows constraints and, more important, to consider step cost functions as the freight costing method.

Indexes:

p, i, j,

clients,

k,

type of vehicle,

v,

vehicles,

f,

distance range.

Parameters:

n,

total number of clients,

\(t_{ij}\),

travel time from client i to client j,

K,

number of types of vehicle available,

\(d_{ij}\),

distance from client i (depot if \(i=0\)) to client j (depot if \(j=0\)),

F,

number of distance ranges,

\(s_i\),

service time at client i,

\(q_i\),

demand of client i,

\(e_i\),

earliest time to begin service of client i,

\(\ell _i\),

latest time to begin service in client i,

\(a_k\),

load capacity of a vehicle of type k,

\(W_f\),

upper bound of the distance range \(f-1\),

\(C_{kf}\),

cost of vehicle k for distances \(d \in (W_f, W_{f+1}]\) for some \(f=0, 1, 2, \dots , F-1\),

\(C_{kF}\),

slope of the linear cost of vehicle k for distances \(d > W_F\),

V,

upper bound on the number of required vehicles (defined as \(V = n\)),

M,

very large positive number.

Variables:

\(x_{ij}^v\),

1 if vehicle v travels from i to j, 0 otherwise,

\(z_{kf}^v\),

1 if vehicle v is of type k and travels a distance in the range f, 0 otherwise,

\(b_i\),

beginning of service of client i,

\(D_f^v\),

total distance traveled by vehicle v in the distance range f,

\(P^v\),

cost of vehicle v.

$$\begin{aligned} \text{ Minimize } \sum _{v=1}^{V} P^v \end{aligned}$$
(1)

subject to

$$\begin{aligned} \sum _{j=0}^{n} x^v_{0j} \le 1&v=1,\dots ,V, \end{aligned}$$
(2)
$$\begin{aligned} \sum _{i=0}^{n} x^v_{ip} - \sum _{j=0}^{n} x^v_{pj} = 0&v=1,\dots ,V, \; p=0,\dots ,n, \end{aligned}$$
(3)
$$\begin{aligned} \sum _{v=1}^{V} \sum _{i=0}^{n} x^v_{ij} = 1&j=1,\dots ,n, \end{aligned}$$
(4)
$$\begin{aligned} \sum _{i=0}^{n} \sum _{j=1}^{n} q_jx^v_{ij} \le \sum _{f=0}^{F} \sum _{k=1}^{K} a_k z^v_{kf}&v=1,\dots ,V, \end{aligned}$$
(5)
$$\begin{aligned} b_i + s_i + t_{ij} - M ( 1 - \sum _{v=1}^{V} x^v_{ij} ) \le b_j&i=1,\dots ,n, \; j=1,\dots ,n, \end{aligned}$$
(6)
$$\begin{aligned} e_i \le b_i \le \ell _i&i=1,\dots ,n, \end{aligned}$$
(7)
$$\begin{aligned} b_i - t_{0i} + M ( 1 - \sum _{v=1}^{V} x^v_{0i} ) \ge e_0&i,\dots ,n, \end{aligned}$$
(8)
$$\begin{aligned} b_i + s_i + t_{i0} - M ( 1 - \sum _{v=1}^{V} x^v_{i0} ) \le \ell _0&i=1,\dots ,n, \end{aligned}$$
(9)
$$\begin{aligned} \sum _{f=1}^{F} D_f^v = \sum _{i=0}^{n} \sum _{j=0}^{n} x^v_{ij} d_{ij}&v=1,\dots ,V, \end{aligned}$$
(10)
$$\begin{aligned} \sum _{k=1}^{K} \sum _{f=0}^{F} z^v_{kf} = 1&v=1,\dots ,V, \end{aligned}$$
(11)
$$\begin{aligned} \sum _{k=1}^{K} z^v_{k0} + \sum _{j=0}^{n} x^v_{0j} = 1&v=1,\dots ,V, \end{aligned}$$
(12)
$$\begin{aligned} D^v_f \le W_{f+1} \sum _{k=1}^{K} z^v_{kf}&v=1,\dots ,V, \; f=1,\dots ,F-1, \end{aligned}$$
(13)
$$\begin{aligned} D^v_F \le M \sum _{k=1}^{K} z^v_{kF}&v=1,\dots ,V, \end{aligned}$$
(14)
$$\begin{aligned} D^v_F \ge W_F \sum _{k=1}^{K} z^v_{kF}&v=1,\dots ,V, \end{aligned}$$
(15)
$$\begin{aligned} P^v \ge \sum _{k=1}^{K} \sum _{f=1}^{F-1} z^v_{kf} C_{kf}&v=1,\dots ,V, \end{aligned}$$
(16)
$$\begin{aligned} P^v \ge z^v_{kF} C_{k,F-1} + C_{kF} ( D^v_F - W_F )&v=1,\dots ,V, \; k=1,\dots ,K, \end{aligned}$$
(17)
$$\begin{aligned} D^v_f \ge 0&v=1,\dots ,V, \; f=0,\dots ,F, \end{aligned}$$
(18)
$$\begin{aligned} x^v_{ij}\in \{0,1\}&v=1,\dots ,V, \; i=0,\dots ,n, \; j=0,\dots ,n, \end{aligned}$$
(19)
$$\begin{aligned} z^v_{kf}\in \{0,1\}&v=1,\dots ,V, \; k=1,\dots ,K, \; f=0,\dots ,F. \end{aligned}$$
(20)

In the objective function (1), the total cost of the vehicles used in the routing is minimized. Constraints (2) state that each vehicle can perform at most a single route. Constraints (3) define that if a vehicle v visits a client p, then it has to move on to the next client or back to the depot. Constraints (4) ensure each client to be visited by exactly one vehicle. Constraints (2), (3), and (4) together guarantee that all routes begin and end at the depot and that they are performed by different vehicles. Constraints (5) determine the type of vehicle v according to the total demand associated with each route. Constraints (6) set the minimum time for the beginning of the service in a client j by a vehicle v and avoid subtours. Constraints (7) ensure that all clients are visited within their time windows and, specifically for the depot, constraints (8) guarantee that no vehicle leaves the depot earlier than \(e_0\). Constraints (9) establish that the vehicles should return to the depot before the end of its time window (\(\ell _0\)).

The subsequent sets of constraints are particularly connected to the FSMVRPTWSC’s attributes. Constraints (1015) link the total distance of a route to the corresponding distance range; while constraints (16,17) determine the cost. Constraints (10) calculate the total distance covered by each vehicle v. Constraints (11) state that each vehicle v must be of a single type k and that its traveled distance must be within one distance range f, i.e. only one variable \(z_{kf}^v\) can be equal to one. Constraints (12) determine that either the vehicle is in distance range 0, when no distance is traveled and therefore the vehicle does not perform any route, or if it performs any route, it must start from the depot. Constraints (13) say that if a route is within range f then its distance cannot exceed the range upper bound \(W_{f+1}\). As previously defined, there is no maximum distance to the last range (F) so, specifically for this range, constraints (14) limit the distance of the last range to a big M value, which is the maximum possible distance of a route in the problem being solved. As this is a minimization problem, it is enough to impose an upper bound on the route’s distance for assigning a route to a range. This is because assigning an unnecessary higher range to a route increases its costs—as costs are fixed per range, the higher the range, the more it costs. The only exception is the last range (\(f = F\)), whose costs are not fixed and, if lower distances are assigned to this distance range, it might provide lower costs than it would if assigned to lower distance ranges. For this reason, constraints (15) limit the route distance assigned to the last range (F) to be bigger than its minimum distance.

It is relevant to notice that vehicles that do not perform any route have \(\sum _{f=1}^F D_f^v = 0\) and must be allocated to range \(f = 0\), to ensure that no cost is generated. As a matter of fact, \(f = 0\) is not in constraints (13)–(15), but it is in (11) and (12). When \(\sum _{f=1}^F D_f^v = 0\), restrictions (13) and (14) are inactive and restrictions (15) force \(z_{kF}^v=0\); this setting allows any \(z_{kf}^v\) to be equal to one for f ranging from 0 to \(F-1\). As this is a minimization problem, the best solutions will always have \(z_{k0}^v=1\), since this assignment generates \(P^v=0\), which is the minimum possible cost for a vehicle.

Constraints (16) and (17) define the minimum value of the cost \(P^v\) of vehicle v. Constraints (16) are activated only for distance ranges f where costs are fixed (\(1 \le f \le F-1\)). Constraints (17) are activated just for \(f = F\), in which the cost grows linearly starting from \(C_{k,F-1}\). Sets of constraints (1820) denote the domain of the variables.

3 Proposed heuristics

This section introduces two constructive heuristics based on the sequential insertion strategy. The main components of the proposed heuristics are novel and specifically devised to take advantage of the step cost functions feature. This kind of methodology was first presented by Solomon (1987) for the VRPTW and it has been successfully adapted to many variants of the VRP by many authors ever since. For example, Dullaert et al. (2002) proposed heuristics for FSMVRPTW that combine the insertion method with the savings concepts considering the total en-route time. Kritikos and Ioannou (2013) proposed a sequential insertion heuristic for the heterogeneous fleet vehicle routing problem with time windows in which some vehicles, under a penalty, are able to transport route demands above their capacity limit. Belfiore and Yoshizaki (2009) investigated a real-world case where split deliveries are allowed; these authors adapted sequential insertion heuristics and presented a scatter search approach.

The proposed heuristic procedure creates one route at a time. The route being constructed will be referred as open route; while the already settled routes, to which no more clients can be added, will be referred as closed routes. As a first step or whenever the open route is closed, if there still is at least an unrouted client, an open route is created serving the farthest from the depot unrouted client with the smallest possible vehicle. Then, the sequential insertion heuristic evaluates which of the unrouted clients are eligible to be served in the open route, which means evaluating which unrouted clients have a demand that can be met by the biggest available vehicle when added to the open route’s total demand. For each eligible client, an insertion criterion \(\mathcal{C}_1\) is used to select the best position in the route where the client could be added without generating an infeasible route due to time window restrictions. Next, the procedure calculates a criterion \(\mathcal{C}_2\) that evaluates the advantage of having the client in this tour instead of in an exclusive trip. The client with the largest \(\mathcal{C}_2\) value is added to the route in the position determined by \(\mathcal{C}_1\). If there is no beneficial feasible insertion, the route is closed. The procedure terminates when all clients have been assigned to routes.

Criterion \(\mathcal{C}_1\) can be understood as the negative impact caused by adding the client to the open route. This criterion can take into account a series of factors that can increase costs, for example the increase in route total length and the need of a bigger and more expensive vehicle due to the higher demand, as well as non-financial aspects, such as additional travel time in the route that can limit the amount of served clients. For each possible insertion position in a route, the smaller the value of \(\mathcal{C}_1\), the better the option is. Criterion \(\mathcal{C}_2\) is a balance of the benefit derived from inserting the client in the open route rather than in a direct exclusive route from the depot to the client. If  \(\mathcal{C}_2\) is positive, it means that the addition is beneficial. The bigger \(\mathcal{C}_2\), the better it is to insert the client in the position of the route pointed out by \(\mathcal{C}_1\).

Assume that the open route has m clients. So the route consists in leaving the depot, visiting clients \(i_1, i_2, \dots , i_m\) and returning back to the depot. For simplicity, we denote this route by \(i_0, i_1, \dots , i_m, i_{m+1}\), where \(i_0 = i_{m+1} = 0\) and, thus, the total distance of the route can be computed as \(D = \sum _{j=0}^m d_{i_j,i_{j+1}}\). Let f be the range to which D belongs. Let \(Q = \sum _{j=1}^m q_{i_j}\) be the demand of the route; and let k be the type of the smallest vehicle that can be assigned to the route. This means that the cost C of the open route is given by \(C_{k,f}\) if \(f < F\) or by \(C_{k,F-1} + C_{kF} ( D - W_F)\) if \(f=F\). The earliest beginning of the service at client \(i_1\) is given by \(b_{i_1} = \max \{ e_0 + t_{0,i_1}, e_1\}\), i.e. it is the maximum between the beginning of the depot’s time window plus the time travel from the depot to the client and the beginning of the time window of the client. For any other client \(i_h\), \(h=2,\dots ,m\), the earliest beginning time is given by \(b_{i_h} = \max \{ b_{i_{h-1}} + s_{i_{h-1}} + t_{i_{h-1},i_h}, e_{i_h}\}\). If, for any client, \(b_{i_h} \not \le \ell _{i_h}\) then the route is infeasible. For the open route, these constraints are satisfied, since the open route is constructed in such a way it is always feasible. (Note that it is assumed that, for every client u (\(u=1,\dots ,n\)), \(e_0 + t_{0u} \le \ell _u\) and that there exists a vehicle type k(u) whose capacity satisfies \(a_{k(u)} \ge q_u\). This means that all exclusive routes are feasible.)

Consider now an unrouted client u. There are \(m+1\) potential places h (\(h=1,\dots ,m+1\)) where client u can be inserted into the route; place h corresponding to inserting u before client \(i_h\). Suppose that client u is inserted at position h and, thus, the sequence becomes \(i_0, \dots ,i_{h-1},u, i_h, \dots , i_{m+1}\). Then, the total demand is given by \(Q^{\text{ new }}(u) = Q + q_u\). Moreover, we have that the earliest beginning times of the services of the clients at the route are given by

$$\begin{aligned} \begin{array}{lcl} b^{\text{ new }}_{i_{\nu }}(u,h) &{}=&{} b_{i_{\nu }}, \; \text{ for } \nu =1,\dots ,h-1,\\ b_u &{}=&{} \max \{ b_{i_{h-1}} + s_{i_{h-1}} + t_{i_{h-1},u}, e_u\},\\ b^{\text{ new }}_{i_h}(u,h) &{}=&{} \max \{ b_{u} + s_{u} + t_{u,i_h}, e_{i_h}\},\\ b^{\text{ new }}_{i_{\nu }}(u,h) &{}=&{} \max \{ b_{i_{\nu -1}} + s_{i_{\nu -1}} + t_{i_{\nu -1},i_{\nu }}, e_{i_{\nu }}\}, \text{ for } \nu =h+1,\dots ,m. \end{array} \end{aligned}$$
(21)

Insertions that do not satisfy the depot’s and the clients’ time windows or that make the route’s demand to exceed the capacity of the vehicle with largest capacity are infeasible and do not need to be considered. The length of the route is given by

$$\begin{aligned} D^{\text{ new }}(u,h) = D - d_{i_{h-1},i_h} + d_{i_{h-1},u} + d_{u,i_{h}}. \end{aligned}$$
(22)

Let \(f^{\text{ new }}(u,h)\) be the range to which \(D^{\text{ new }}(u,h)\) belongs; and let \(k^{\text{ new }}(u,h)\) be the type of the smallest vehicle that can be assigned to the route. This means that the cost of the route is given by

$$\begin{aligned} C^{\text{ new }}(u,h) = \left\{ \begin{array}{ll} C_{k^{\text{ new }}(u,h),f^{\text{ new }}(u,h)}, &{} \text{ if } f^{\text{ new }}(u,h)<F,\\ C_{k^{\text{ new }}(u,h),F-1} + C_{k^{\text{ new }}(u,h),F} ( D^{\text{ new }}(u,h) - W_F), &{} \text{ if } f^{\text{ new }}(u,h)=F. \end{array} \right. \end{aligned}$$
(23)

The insertion of a client u into the open route depends on characteristics an exclusive route from the depot to the client has. The distance of an exclusive route for client u is given by \(2 d_{0,u}\). Let f(0, u) be the range to which \(d_{0,u}\) (half of the exclusive route’s distance) belongs; and let k(0, u) be the type of the vehicle with smallest capacity capable of serving the route, whose demand is given by \(q_u\). We also define P(0, u) as the cost of the one-way trip from the depot to client u, i.e.

$$\begin{aligned} P(0,u) = \left\{ \begin{array}{ll} C_{k(0,u),f(0,u)}, &{} \text{ if } f(0,u) < F,\\ C_{k(0,u),F-1} + C_{k(0,u),F} ( d_{0,u} - W_F ), &{} \text{ if } f(0,u) = F. \end{array} \right. \end{aligned}$$
(24)

Note that, in order to evaluate an exclusive route, only half of its distance is being considered, since it is expected the route to be extended later.

Both proposed heuristics follow the same insertion procedure, differing in the criteria used to decide whether an unrouted client u should be inserted (at position h) of the open route. It should be stressed that the definition of criteria \(\mathcal{C}_1\) and \(\mathcal{C}_2\), that determine if an insertion of a client is advantageous or not, is the crucial component of the proposed methods. The evaluation of these criteria considers, besides the possible increase of the total cost and time consumed, opportunities of a better usage of the resources.

3.1 Step Cost Insertion Heuristic 1

The Step Cost Insertion Heuristic 1, henceforth called SCIH1, aims to directly exploit the features of the studied problem. In the FSMVRPTWSC, the increase in the total distance traveled by a vehicle may not have a direct impact on the objective function value of the problem. This growth only affects the total cost if the updated traveled distance is within a different distance range than previously used. If it still is within the same range, then there is no change in the total cost. So, a heuristic procedure designed to solve this problem may be more effective not by calculating the route distance variation, but rather by evaluating the possible variation of the freight costs. In this heuristic, criteria \(\mathcal{C}_1\) and \(\mathcal{C}_2\) will be henceforth called \(\mathcal{C}_1^{S1}\) and \(\mathcal{C}_2^{S1}\), respectively.

The computation of criterion \(\mathcal{C}_1^{S1}(u)\) relies on four different components. The first component, \(\mathcal{C}_{1,1}^{S1}(u,h)\), is defined as the remaining distance in the range within which the open route fits after the hypothetical insertion of client u at position h. Note that the larger this amount is, the larger the open route’s potential for adding further clients without a cost increase. This term is calculated as the difference between the total distance \(D^{\text{ new }}(u,h)\) of the route after the addition of client u at position h and the upper bound \(W_{f^{\text{ new }}(u,h)+1}\) of the distance range \(f^{\text{ new }}(u,h)\) to which \(D^{\text{ new }}(u,h)\) belongs. If \(f^{\text{ new }}(u,h) = F\), \(\mathcal{C}_{1,1}^{S1}(u,h)\) is defined as zero because it would be impossibility to insert further new clients to the route without additional costs.

Similarly, a component is evaluated in \(\mathcal{C}_1^{S1}(u)\) to consider the available vehicle capacity. Note that, when a client is added, its extra demand may require a larger vehicle and, consequently, lead to higher costs. However, this negative impact can be balanced by the opportunity of having further clients added to the route keeping the same vehicle. This term, \(\mathcal{C}_{1,4}^{S1}(u,h)\), is calculated by the difference between the total route demand \(Q^{\text{ new }}(u)\), that considers the addition of client u, and the capacity of the smallest vehicle type \(k^{\text{ new }}(u,h)\) able to meet this demand, given by \(a_{k^{\text{ new }}(u,h)}\). The other components of \(\mathcal{C}_1^{S1}(u)\), \(\mathcal{C}_{1,2}^{S1}(u,h)\) and \(\mathcal{C}_{1,3}^{S1}(u,h)\), evaluate the delay in the beginning of the service at client \(i_h\), caused by the insertion of client u before it, and the additional freight cost generated by the insertion, respectively. The four elements are weighed in \(\mathcal{C}_1^{S1}(u)\) by \(\alpha _t \in [0,1]\) (\(t=1,\dots ,4\)) as follows

$$\begin{aligned} \mathcal{C}_1^{S1}(u) = \min _{h \in H(u)} \left\{ - \alpha _1 \mathcal{C}_{1,1}^{S1}(u,h) + \alpha _2 \mathcal{C}_{1,2}^{S1}(u,h) + \alpha _3 \mathcal{C}_{1,3}^{S1}(u,h) - \alpha _4 \mathcal{C}_{1,4}^{S1}(u,h) \right\} , \end{aligned}$$
(25)

where H(u) corresponds to the values of \(h \in \{ 1,\dots ,m+1 \}\) such that inserting client u at position h results in a feasible open route,

$$\begin{aligned} \begin{array}{rcl} \mathcal{C}_{1,1}^{S1}(u,h) &{}=&{} \left\{ \begin{array}{ll} W_{f^{\text{ new }}(u,h)+1} - D^{\text{ new }}(u,h), &{} \text{ if } f^{\text{ new }}(u,h) < F,\\ 0, &{} \text{ if } f^{\text{ new }}(u,h)=F, \end{array} \right. \\ \mathcal{C}_{1,2}^{S1}(u,h) &{}=&{} b_{i_h}^{\text{ new }}(u,h) - b_{i_h},\\ \mathcal{C}_{1,3}^{S1}(u,h) &{}=&{} C^{\text{ new }}(u,h) - C,\\ \mathcal{C}_{1,4}^{S1}(u,h) &{}=&{} a_{k^{\text{ new }}(u,h)} - Q^{\text{ new }}(u).\\ \end{array} \end{aligned}$$
(26)

Observe that, since the purpose of \(\mathcal{C}_1^{S1}(u)\) is to estimate the negative impact of an insertion, negative signs are assigned to components \(\mathcal{C}_{1,1}^{S1}(u,h)\) and \(\mathcal{C}_{1,4}^{S1}(u,h)\), that measure opportunities generated by the insertion.

Aiming to evaluate the benefit of inserting client u in the open route, criterion \(\mathcal{C}_2^{S1}(u)\) compares the impact generated by this inclusion, given by \(\mathcal{C}_1^{S1}(u)\), to the impact of an exclusive route between client u and the depot. The first part of criterion \(\mathcal{C}_2^{S1}(u)\) also has four components, all related to an exclusive route to serve client u. The first term, \(\mathcal{C}_{2,1}^{S1}(u)\), evaluates the remaining distance in the distance range f(0, u) after serving client u. Terms \(\mathcal{C}_{2,2}^{S1}(u)\) and \(\mathcal{C}_{2,3}^{S1}(u)\) consider time and cost aspects, respectively; while \(\mathcal{C}_{2,4}^{S1}(u)\) evaluates the remaining capacity of the vehicle allocated to perform the exclusive route. All these components are balanced by weights \(\beta _t \in [0,1]\) (\(t=1,\dots ,4\)); and criterion \(\mathcal{C}_2^{S1}(u)\) is defined as

$$\begin{aligned} \mathcal{C}_2^{S1}(u) = \Big [ - \beta _1 \mathcal{C}_{2,1}^{S1}(u) + \beta _2 \mathcal{C}_{2,2}^{S1}(u) + \beta _3 \mathcal{C}_{2,3}^{S1}(u) - \beta _4 \mathcal{C}_{2,4}^{S1}(u) \Big ] - \mathcal{C}_1^{S1}(u), \end{aligned}$$
(27)

where

$$\begin{aligned} \begin{array}{rcl} \mathcal{C}_{2,1}^{S1}(u) &{}=&{} \left\{ \begin{array}{ll} W_{f(0,u)+1} - d_{0u}, &{} \text{ if } f(0,u) < F,\\ 0, &{} \text{ if } f(0,u)=F, \end{array} \right. \\ \mathcal{C}_{2,2}^{S1}(u) &{}=&{} t_{0,u} + s_u, \\ \mathcal{C}_{2,3}^{S1}(u) &{}=&{} P(0,u), \\ \mathcal{C}_{2,4}^{S1}(u) &{}=&{} a_{k(0,u)} - q_u.\\ \end{array} \end{aligned}$$
(28)

In the definition of \(\mathcal{C}_{2,4}^{S1}(u)\), \(a_{k(0,u)}\) is the capacity of a vehicle of type k(0, u); and, in the definition of \(\mathcal{C}_{2,2}^{S1}(u)\), \(t_{0,u}\) is the travel time from the depot to client u and \(s_u\) is the serving time. Observe that the time consumed returning to the depot is not considered.

Algorithm 1 describes the Step Cost Insertion Heuristic 1 (SCIH1) in detail. In line 3, the first route is open and the set U of unrouted clients is defined. The main loop, that starts in line 4, is executed while \(U \ne \emptyset \). Within the loop, in line 5, the set \(Z \subseteq U\) with selected unrouted clients is defined. It corresponds to the unrouted clients whose demand, if added to the route’s demand, could be attended by an existent vehicle. If \(Z=\emptyset \), in line 6, the route is closed, a new route is open, and the iteration ends. If \(Z \ne \emptyset \), the loop from lines 10 to 17, determines, using criteria \(\mathcal{C}_1^{S1}\) and \(\mathcal{C}_2^{S1}\), the client u to be inserted in the route and the insertion’s position h. If an advantageous insertion exists, insertion is performed in line 19. Otherwise, in line 21, the route is closed and a new route is open. In any case, at each iteration, a client is removed from U.

figure a

3.2 Step Cost Insertion Heuristic 2

Procedure SCIH2 is more judicious in assessing the opportunities generated by the insertion of client u in the route. Note that SCHI1 calculates the remaining capacity available in the assigned vehicle and the remaining distance within the distance range, but it does not check whether there is an unrouted client that could benefit from these available resources. To take such opportunities into account in the evaluation of criterion \(\mathcal{C}_1\), SCIH2 first checks whether there is an unrouted client that could use the opportunities left in the distance range or vehicle capacity. Criteria \(\mathcal{C}_1\) and \(\mathcal{C}_2\) for this heuristic will be henceforth called \(\mathcal{C}_1^{S2}\) and \(\mathcal{C}_2^{S2}\), respectively.

Criterion \(\mathcal{C}_1^{S2}(u)\) is calculated for each eligible client u. Its first term, \(\mathcal{C}_{1,1}^{S2}(u,h)\), estimates the opportunity associated with the remaining distance in the distance range \(f^{\text{ new }}(u,h)\). To conduct this evaluation, \(\mathcal{C}_{1,1}^{S2}(u,h)\) takes the value of the largest detour that can be made to serve an unrouted client preserving the distance range  \(f^{\text{ new }}(u,h)\). If \(f^{\text{ new }}(u,h)=F\) then there is no opportunity and \(\mathcal{C}_{1,1}^{S2}(u,h)\) is zero. Components \(\mathcal{C}_{1,2}^{S2}(u,h)\) and \(\mathcal{C}_{1,3}^{S2}(u,h)\) are calculated in the same way as in SCIH1. \(\mathcal{C}_{1,4}^{S2}(u,h)\) assumes the value of the largest demand among the unrouted clients that can be served, considering the remaining capacity of the vehicle assigned to perform the updated route. The elements of criterion \(\mathcal{C}_1^{S2}(u)\) are weighed by parameters \(\alpha _t \in [0,1]\) (\(t=1,\dots ,4\)) as follows:

$$\begin{aligned} \mathcal{C}_1^{S2}(u) = \min _{h \in H(u)} \left\{ -\alpha _1 \mathcal{C}_{1,1}^{S2}(u,h) + \alpha _2 \mathcal{C}_{1,2}^{S2}(u,h) + \alpha _3 \mathcal{C}_{1,3}^{S2}(u,h) - \alpha _4 \mathcal{C}_{1,4}^{S2}(u,h) \right\} , \end{aligned}$$
(29)

where

$$\begin{aligned} \mathcal{C}_{1,1}^{S2}(u,h)= & {} \left\{ \begin{array}{ll} \max _{\{(j,y) \in Y_1\}} \left\{ d_{i_y,j} + d_{j,i_{y+1}} - d_{i_y,i_{y+1}}\right\} , &{} \text{ if } f^{\text{ new }}(u,h) < F,\\ 0, &{} \text{ if } f^{\text{ new }}(u,h)=F, \end{array} \right. \nonumber \\ \mathcal{C}_{1,2}^{S2}(u,h)= & {} b_{i_h}^{\text{ new }}(u,h) - b_{i_h}, \nonumber \\ \mathcal{C}_{1,3}^{S2}(u,h)= & {} C^{\text{ new }}(u,h) - C,\nonumber \\ \mathcal{C}_{1,4}^{S2}(u,h)= & {} \max _{\{ j \in Y_2 \}} \{ q_j \}, \end{aligned}$$
(30)
$$\begin{aligned} Y_1= & {} \left\{ (j,y) \left| \begin{array}{l} j \text{ unrouted },\\ y \in \{0,\dots ,m\}, \text{ and } \\ d_{i_y,j} + d_{j,i_{y+1}} - d_{i_y,i_{y+1}} \le W_{f^{\text{ new }}(u,h)+1} - D^{\text{ new }}(u,h), \end{array} \right. \right\} \end{aligned}$$
(31)

and

$$\begin{aligned} Y_2 = \left\{ j \text{ unrouted } \; | \; q_j \le a_{k^{\text{ new }}(u,h)} - Q^{\text{ new }}(u) \right\} . \end{aligned}$$
(32)

Criterion \(\mathcal{C}_2^{S2}(u)\) improves \(\mathcal{C}_2^{S1}(u)\) in the same way \(\mathcal{C}_1^{S2}(u,h)\) improves \(\mathcal{C}_1^{S1}(u,h)\). Components of \(\mathcal{C}_2^{S2}(u)\) are balanced by weights \(\beta _t \in [0,1]\) (\(t=1,\dots ,4\)); and \(\mathcal{C}_2^{S2}(u)\) is defined as:

$$\begin{aligned} \mathcal{C}_2^{S2}(u) = \Big [- \beta _1 \mathcal{C}_{2,1}^{S2}(u) + \beta _2 \mathcal{C}_{2,2}^{S2}(u) + \beta _3 \mathcal{C}_{2,3}^{S2}(u) - \beta _4 \mathcal{C}_{2,4}^{S2}(u)\Big ] - \mathcal{C}_1^{S2}(u), \end{aligned}$$
(33)

where

$$\begin{aligned} \begin{array}{rcl} \mathcal{C}_{2,1}^{S2}(u) &{}=&{} \left\{ \begin{array}{ll} \max _{\{(j,y) \in Y_3\}} \left\{ d_{i_y,j} + d_{j,i_{y+1}} - d_{i_y,i_{y+1}}\right\} , &{} \text{ if } f(0,u) < F,\\ 0, &{} \text{ if } f(0,u)=F, \end{array} \right. \\ \mathcal{C}_{2,2}^{S2}(u) &{}=&{} t_{0u} + s_u, \\ \mathcal{C}_{2,3}^{S2}(u) &{}=&{} P(0,u), \\ \mathcal{C}_{2,4}^{S2}(u) &{}=&{} \max _{\{ j \in Y_2 \}} \{ q_j \}, \\ \end{array} \end{aligned}$$
(34)

and

$$\begin{aligned} Y_3 = \left\{ (j,y) \;|\; j \text{ unrouted }, \; y \in \{0,1\}, \text{ and } d_{i_y,j} + d_{j,i_{y+1}} - d_{i_y,i_{y+1}} \le W_{f_{(0,u)}+1} - d_{0,u} \right\} . \end{aligned}$$
(35)

The Step Cost Insertion Heuristic 2 (SCIH2) is similar to the one described in Algorithm 1. The computation of \(\mathcal{C}_1^{S1}\) and \(\mathcal{C}_2^{S1}\) in line 16 of Algorithm 1 must be substituted by the computation of \(\mathcal{C}_1^{S2}\) and \(\mathcal{C}_2^{S2}\) given by (29,30) and (33,34), respectively, where sets \(Y_1\), \(Y_2\), and \(Y_3\) are given by (31), (32), and (35).

4 Numerical experiments

Computational experiments were conducted to evaluate the proposed methods. Since the FSMVRPTWSC has not yet been studied in the literature, new instance sets were generated for this problem, based on benchmark instances for the FSMVRPTW. Moreover, three instances based on a real-world problem were solved. All considered instances are available in the online repository: https://github.com/jmanguino/FSMVRPTWSC/.

4.1 Problem instance generation

The set of instances proposed by Solomon (1987) for the VRPTW consists of 56 instances with 100 clients divided into six data types. Data sets with the prefixes “R”, “C”, and “RC” refer to clients with random, clustered, and a mixture of random and clustered locations, respectively. Sets named R1, C1, and RC1 have a short scheduling horizon; while sets R2, C2, and RC2 have a long scheduling horizon. For each of these instances, Liu and Shen (1999) introduced three different subclasses of instances, characterized by different vehicle costs: type a with high vehicle costs, type b with medium vehicle costs, and type c with low vehicle costs. Combining each VRPTW instance with the three categories of vehicle costs, 168 instances for the FSMVRPTW were obtained. The main characteristics of the original benchmark sets were maintained in the benchmark sets for the FSMVRPTWSC.

The adjustment to the data was to turn the cost structure from fixed costs per vehicle plus linear costs per distance traveled to a step cost structure. In line with the literature, in which cost is proportional to distance, the cost attributed to each distance range is a function of its length. More precisely, the cost associated with each distance range f is the cost of the previous one (\(f-1\)) plus the size of the considered range multiplied by a cost factor, for all ranges from \(f = 2\) to \(F-1\). For the first distance range, the cost is set to the value of the fixed cost defined in Liu and Shen (1999) for each vehicle, while for the last range, where costs are calculated through a linear function of the distance, only the line slope is set. The number of distance ranges (F) is defined according to the scheduling horizon. For the group with a short scheduling horizon, five distance ranges are set; while for the group with long scheduling horizon, six distance ranges are created.

4.2 Computational results

Codes were written in C programming language and tests were conducted on a Intel Core i7-7600U 2.8 GHz with 16 GB of RAM memory.

Preliminary tests were conducted on a reduced set of instances in order to select \(\alpha _t\) and \(\beta _t\) (\(t=1,\dots ,4\)) for each proposed method. In the data set there are 3 types of vehicles (a, b, and c), 3 types of clients’ spatial distribution (R, C, and RC), and 2 types of scheduling horizon (1 and 2); meaning that there are 18 different types of instances combining these 3 attributes (see the first column in Table 3). While the whole test set has 168 instances distributed among those 18 types; in the preliminary numerical experiments a subset was considered containing 3 instances of each type, i.e. 54 instances. Since it is natural to assume that the spatial distribution of the clients strongly affects the selection of the parameters, it was decided to select a combination of \(\alpha \) and \(\beta \) for each different clients’ spatial distribution R, C, and RC. The 18 instances of a considered type of clients’ spatial distribution were solved by each heuristic with all combinations of \(\alpha \) and \(\beta \) assuming values from 0 to 1 with step size 0.1. The average of the obtained objective function values for each combination of \(\alpha \) and \(\beta \) was computed; and combinations were ranked from the best to the worst (see Fig. 4). Figure 4 shows that the top 500 combinations of parameters \(\alpha \) and \(\beta \) deliver solutions that differ (in average) up to 4% with respect to the solutions obtained by the best combination. As an additional information, Fig. 5 displays the box plot of the distribution of \(\alpha \) and \(\beta \) for the top 50 combinations. The figure shows that the parameters have a small variability; they are concentrated around the median and present very few outliers (represented by dots in the chart). Analogous conclusions apply to the other heuristics and scenarios.

Fig. 4
figure 4

Ranking of SCIH2 with 500 different combinations of parameters \(\alpha \) and \(\beta \) when applied to instances with a clients’ spatial distribution of type R

Fig. 5
figure 5

Box plot of parameters \(\alpha \) and  \(\beta \) considering the top 50 combinations in SCIH2 applied to instances with a clients’ spatial distribution of type R

Table 2 presents the best combinations of parameters for each instance set and heuristic, which are used in all following evaluations. It is relevant to note that parameter \(\alpha _2\) takes value zero in all considered heuristics. This is probably due to the fact that, in the FSMVRPTWSC, the additional time consumed due the insertion of a new client can impair compliance with time window constraints, but there is no guarantee that this insertion will increase the cost of the route. An additional numerical experiment, not being reported here in details, showed that considering a single combination of \(\alpha \) and \(\beta \) for all the instances (independently of the spatial distribution of the clients) produces a deterioration of approximately 3% in the quality of the solutions found.

Table 2 Values of weights \(\alpha _1\), \(\alpha _2\), \(\alpha _3\), \(\alpha _4\), \(\beta _1\), \(\beta _2\), \(\beta _3\), and \(\beta _4\) for each heuristic and scenario

For a solution quality comparison of the proposed heuristics, other well-known methods for the FSMVRPTW were also evaluated. The Adapted Combined Savings (ACS) method, introduced by Dullaert et al. (2002), and the version \(MROS_{-\lambda -\eta }\) of the Savings Heuristic (SH) adapted by Liu and Shen (1999) were implemented. Parameters of ACS and SH were tunned considering all the 168 instances included in the comparison. Among the parameters suggested by the authors, the combination that produced the lowest average of the final value of the objective function was used in the comparison. Table 3 shows the results. The first two columns indicate the group of instances and the number of instances it includes, respectively. The next four columns present the average value of the total cost (Avg.) and the percentage of best solutions (%best) obtained by ACS, SH, SCIH1, and SCIH2. The best solution is the one that presents the smallest total cost compared to the solutions found by the other methods; and %best is the percentage of best solutions each method found (over the whole set of instances). The bold values in the table correspond to the best results for each set, i.e. the largest %best value or the smallest average result. All analyzed heuristics presented similar runtimes with an average CPU time per instance smaller than 0.1 s.

Table 3 Average total cost and percentage of best solutions obtained by ACS, SH, SCIH1, and SCIH2 heuristics in each data set

The figures in Table 3 show that, considering the measure %best and the average total cost, SCIH1 and SCIH2 are superior to the other methods analyzed, outperforming the benchmark SH and ACS methods. These results were expected, since SCIH1 and SCIH2 take into consideration specific features of the FSMVRPTWSC, and assess future opportunities related to the insertion of clients in the routes. ACS and SH heuristics showed an inferior performance in the tests, since these methods did not find any best result and obtained an average total cost 27% and 25% worse than the best average result, respectively.

Analyzing the best two methods, namely SCIH1 and SCIH2, it can be observed that both heuristics showed comparable performances. SCIH2 achieved the highest percentage of best solutions, approximately 60%; although, considering the 168 instances, the average total cost was 0.07% greater than the one obtained by SCIH1. The largest average cost difference was found in set R2a, where SCIH1 provided an average value 4.8% better than SCIH2. Aiming to identify statistically significant differences among the heuristics, statistical tests were conducted using the results (total cost) provided by each method for the 168 benchmark problems. First, using the Kolmogorov-Smirnov test, it was verified that the data do not follow a normal distribution. Next, by applying the Wilcoxon signed rank test, methods were compared one-on-one and the assumptions that say that SCIH1 and SCIH2 behave similarly and that they differ from SH and ACS were confirmed with a 1% significance level.

Analysis of optimal results

To improve the evaluation of the proposed heuristics, a comparative study was conducted with optimal solutions provided by the resolution of the MILP model introduced in Sect. 2. Due to the difficulty in obtaining optimal solutions for the instances in the original data set, a new set with small-sized instances was constructed. This set is composed of instances with the same characteristics of the 168 benchmark problems, i.e. three spatial distributions (R, C, and RC), a long and a short scheduling horizon (1 and 2), and different vehicle costs (a, b, and c), but with fewer clients. Preliminary tests were performed and the software CPLEX 12.6, using its standard parameters’ configuration and a suboptimality tolerance level of 0.5%, was not able to solve problems with 30 clients within the time limit of 2 h. Therefore, for each combination of characteristics, four different numbers of clients were used: 10, 15, 20, and 25, in a total of 72 test instances.

With the mentioned software configuration and time limit, all instances with 10 clients (18 instances), 72.2% of the instances with 15 clients (13 instances), 50% of the instances with 20 clients (9 instances), and 11% of the instances with 25 clients (2 instances) were optimally solved. Methods SCIH1, SCIH2, ACS, and SH were applied to these 42 small-sized instances. Figure 6 displays the results. In this chart, the x-axis shows the percentage difference between the solution values obtained by the methods and the known optimal value. The y-axis shows the proportion of instances for which the analyzed method has found solutions with values up to the corresponding deviation of the x-axis.

Fig. 6
figure 6

Chart with the cumulative percentage of instances for which the solution found by a constructive heuristic is under a percentage deviation from the optimal value

As shown in Fig. 6, SCIH1 has found the optimal results in 21% of the instances; in 45% of the instances the deviation from the optimal value was less than or equal to 5%; and in 67% of the instances, the maximum deviation from the optimal value was 10%. SCIH1 and SCIH2 showed similar performance, but SCIH2 was frequently outperformed by SCIH1. Optimal values were found by SCIH2 in almost 24% of the instances and the average deviation of this method from the optimal values was 10.3%; while the average deviation presented by SCIH1 was 8.4%. The combined analysis of Fig. 6, Table 3, and the statistical test suggests that the proposed heuristics show similar performance levels.

Figure 6 also shows that the ACS and SH heuristics were outperformed by the proposed methods. SH performed better than ACS. It obtained an average deviation from the optimal values of 12.3%; while the average deviation presented by ACS was 23.8%.

Local improvement strategy

Constructive heuristics are commonly used to provide initial solutions to local search strategies. In this context, it may be argued that, the smaller the improvement provided by the local search, the stronger the constructive heuristic that provided the initial solution. With this purpose in mind, a local search (LS) was implemented. Two commonly used moves, namely, relocate and cross (see, for example, Bräysy and Gendreau 2005; Vidal et al. 2013, and the references therein) were considered. The initial solution is given by the solution obtained by one of the proposed constructive heuristics; the best movement strategy is used to select the next neighbor solution, and the local search stops when no improving solution is found.

The relocate movement relocates a selected client by removing it from its current position and re-inserting it back in a different position of the same route or even in a different route. Figure 7 illustrates this movement. In the process of inserting the client back, every position in every route is considered; and the feasible insertion that causes the smallest increase in the objective function is selected. In case of a tie, the position/route that causes the least increase in the route’s length is chosen. The clients’ time windows and the capacity of the vehicle with largest capacity determine the feasibility of the insertion of a client in a route. Clients are selected for relocation one at a time; and the neighborhood is defined by the attempt of relocating a predefined number of clients. Clients selected for relocation are the ones that, when individually removed, cause the biggest reduction in the objective function; and, in case of ties, the clients that promote the biggest reduction in their route’s length are chosen.

The cross movement exchanges random sequences of clients of two different routes (Fig. 8 illustrates this movement). Two sequences (route, initial position in the route, and length of the sequence) are randomly selected. If exchanging the two sequences produces a feasible solution (i.e. a solution that satisfies the clients’ time windows and the capacity of the vehicle with largest capacity) then the objective function is evaluated. The neighborhood is defined by the attempt of exchanging a predefined number of random sequences.

Fig. 7
figure 7

Illustration of the relocate movement

Fig. 8
figure 8

Illustration of the cross movement

Preliminary experiments were done to determine the size of the neighborhoods (number of clients whose relocation is checked in the relocate movement and number of sequences exchanges in the cross movement). Then, a comparison between the LS associated with the relocate movement and the LS associated with cross movement was conducted by applying both combinations to the 168 benchmark instances. The best results, in terms of solutions’ quality, were obtained by the use of the relocate movement considering the possible reallocation of 40% of the clients in each neighborhood. Table 4 presents a comparison between the LS algorithm associated with the relocate movement and SCHI1, SCHI2, ACS, and SH methods. More specifically, the table shows the improvement obtained by the local search when the solution found by each one of the constructive heuristics is used as initial solution. For each set of instances, the table shows the average objective function’s value obtained by the constructive heuristic, the average objective function’s value obtained by the LS, and the average improvement (%imp). All combinations of constructive heuristic plus local search presented an average CPU time per instance smaller than 0.1 s. Figures in bold correspond to the best average results. Figures in the table show that an average improvement of approximately 1.5% is achieved by the local search strategy when using solutions provided by the proposed methods as initial solution. On the other hand, the LS algorithm, when applied to the solutions provided by ACS and SH, obtained improvements up to 26% (see ACS in the set of RC2c instances), with an average improvement of almost 9%. It is worth noting that, despite this improvement, the best average values of the objective function were obtained by combining the local search with the proposed heuristics SCHI1 and SCHI2.

Table 4 Performance of the local search that uses as initial guess the solution found by ACS, SH, SCIH1, and SCIH2 constructive heuristics

4.3 Study case

In this section, the application of the proposed heuristics in three instances based on a real-world problem of a Brazilian industry that produces cement and other civil construction materials is presented. In the company, the routing is executed daily. Every day, by the end of the working day, demands for the next day are already known. Stock levels for fulfilling the demands are verified, orders are determined, and the routing problem is solved. Clients’ time windows are from 7 am to 5 pm, since they are mostly construction sites. The time for servicing each client is 1.5 h. Table 5 presents an overview of the study case instance’s dimensions. The table shows the number of clients, the total demand, and the average distance of each client to the depot. Figure 9 illustrates the clients’ locations of instance 1. Table 6 presents the freight costs table. There are three different vehicles with capacities of 8, 14, and 20 ton each and five distance ranges. The fixed costs for each combination of distance range and vehicle are presented in monetary units. For routes with more than 150 km, the cost is given by the cost of the (100, 150] range plus one monetary unit per kilometer.

Table 5 Dimension overview of the study case instances
Table 6 Freight table for the study case instances
Fig. 9
figure 9

Clients’ location for instance 1 of the study case

The three instances were first solved by all analyzed constructive heuristics; and the solutions found were used as initial solution for the local search strategy with the relocate movement. The values of \(\alpha \) and \(\beta \) in SCIH1 and SCIH2 were the same as in the benchmark instances set R2, since the study case instances have a broad time window and the geographical distribution of the clients includes areas with spread out clients. Methods were run in the same computer environment described in Sect. 4.2, and the elapsed CPU time for solving each instance was always smaller than 0.1 s. Table 7 shows the results. The top half of the table shows the total cost and the number of routes in the solutions reported by the company (column “Reported”) and the total cost and the number of routes in the solutions obtained by the constructive heuristics, i.e. ACS, SH, SCIH1, and SCIH2. In the bottom half of the table the total cost and the number of routes in the solutions obtained after the application of the local search method are presented. Figures in the table show that the proposed heuristics, SCIH1 and SCIH2, provide the best total cost values. These methods obtained a total cost reduction of 12.7% and 13.8%, respectively, with respect to the solutions reported by the company. After the application of the local search strategy, as expected, the total cost provided by all constructive heuristics was improved. In particular, the total cost obtained by the local search associated with SCIH2 produced a 14.5% reduction with respect to the reported solutions.

It is worth mentioning that SH and ACS, despite generating total costs higher than the ones obtained by SCIH1 and SCIH2 proposed methods, obtained solutions with a smaller number of routes. This is probably due to the fact that these methods tend to over accumulate clients in long routes with large-capacity vehicles, as they are designed to make better use of the vehicle’s available capacity without recognizing that moving to higher distance ranges may significantly increase the cost. In average, only 4.7% of the routes in the ACS solutions are associated with the smallest vehicle’s type (8 ton); while, in the solutions generated by the SCIH2 heuristic, 29.6% of the routes are associated with the smallest vehicle’s type.

Table 7 Results of the study case instances

5 Conclusion

The Fleet Size and Mix Vehicle Routing Problem with Time Windows and Step Cost functions was addressed in this work. In the considered problem, freight charges are predefined in a table that only requires information on the type of vehicle and the distance the vehicle must travel—a convenient way to calculate and verify costs. In the literature, a wide range of variations of routing problem is studied. However, to the best of the authors’ knowledge, no research study has addressed this problem.

A mixed integer linear programming model and two sequential insertion heuristics were proposed to approach the problem. The heuristic methods were evaluated in a set of 168 instances based on benchmark instances from the literature. Moreover, small-sized instances were generated so they can be solved to optimality through the resolution of the MILP model. The numerical results showed that the proposed methods outperformed other well-known constructive heuristic methods that apply to the FSMVRPTW. The comparison with optimal solutions was also encouraging. The proposed heuristics delivered solutions that were, in average, 9.4% far from the optimal solution; and SCIH2 found an optimal solution in almost 24% of the small-sized instances. With the purpose of checking the strength of the constructive heuristics, solutions obtained by them were used as initial solutions for a local search, which was able to improve solutions in, in average, 1.5%. Additionally, a study case with three instances based on a real-world problem from the construction industry was performed. Results corroborated the effectiveness of the introduced methods in generating a cost reduction in the delivery of goods in real-world situations in which step cost functions are applied.

The short execution time of the proposed methodologies motivates its application in practical routing problems, e.g. in real-time routing software, or to construct initial solutions for more elaborate methods such as metaheuristics. Moreover, efficient constructive approaches that take into account properties of the problem at hand may be seen as the foundation of more sophisticated semi-enumerative approaches like beam search algorithms (see, for example, Birgin et al. 2015). It should also be pointed out that this work sets the ground for the study of vehicle routing problems from a new perspective, not the fleet owner’s but rather the transportation-provider clients’.