# Vehicle Routing Problem for Multiple Product Types, Compartments, and Trips with Soft Time Windows

Authors: P. Kabcome; T. Mouktonglang
Journal: International Journal of Mathematics and Mathematical Sciences
 (2015)

---

## Abstract

This paper presents a mathematical model to solve the vehicle routing problem with soft time windows (VRPSTW) and distribution of products with multiple categories. In addition, we include multiple compartments and trips. Each compartment is dedicated to a single type of product. Each vehicle is allowed to have more than one trip, as long as it corresponds to the maximum distance allowed in a workday. Numerical results show the effectiveness of our model.


---

## Body

## 1. Introduction

The vehicle routing problem (VRP) is a well-known problem in the operation research and combinatorial optimization presented by Dantzig and Ramser [1]. The VRP is also an important problem in the fields of transportation, distribution, and logistics. The context is planning the route to deliver goods from a central depot to customers who have placed orders for such goods. The objective of the VRP is to minimize the total route cost. According to the importance of the VRP, there are so many literatures which refer to the models and the solution of the VRP. Many papers present the different views of the problem, the different features of the system, and the different approaches to solve the problem (see [2–6] and references therein).The vehicle routing problem with time windows (VRPTW) is a variant of the VRP (Figure1). A solution of the VRPTW is a set of routes consisting of sequences of customers. Each route is assigned to arrive within their time windows. In addition, if a vehicle arrives before (or after) the lower (or upper) bound of the customer’s time window, the vehicle cannot deliver goods to the customer (see [7–12]). An exception of VRPTW problem is that the time windows can be violated if the penalty is paid. In this case, it is called the vehicle routing problem with soft time windows (VRPSTW). In VRPSTW, each customer i has a desirable time window with the highest satisfaction as ai,bi and a hard time window LBi,UBi. A soft time window is shown in Figure 2. In the intervals LBi,ai and bi,UBi the service is allowed for some penalty fee. The interested reader may find more information in [13–16].Figure 1
Service time interval in VRPTW.Figure 2
Service time interval in VRPSTW.The vehicle routing problem with multiple trips (VRPMT) is another variant of the classical VRP. Each vehicle can be scheduled for more than one trip, as long as it corresponds to the maximum distance allowed in the workday [17–20].The vehicle routing problem with multiple compartments (VRPMC) is also a special case of the VRP. Each compartment of the vehicle has a limit and is dedicated to a single type of products [21, 22].Many papers present the different views of VRP; there has not been any VRP mathematical model for multiple compartments, trips, and time windows. Several papers presented VRP for single product type. However, in [23], the author presents a model on distributing multiple items for customer.In this paper, we address the mathematical model for the VRP for multiple product types, compartments, and trips with soft time windows (VRPMPCMTSTW). The proposed VRP can be regarded as the extension to three problems which are(i)
the vehicle routing problem with multiple compartments,(ii)
the vehicle routing problem with multiple trips,(iii)
the vehicle routing problem with soft time windows.The summary of the three mentioned problems is presented in Table1. It is clear that our mathematical model solves the classical VRP since it is a special case for the VRP with multiple compartments, trips, and time windows. The time window cases are studied because they are more practical and the soft time window cases are further investigated due to the feasibility of the problem and, in some cases, due to the fact that it reduces the total cost.Table 1
Comparison of the problems.
VRP
VRPMC
VRPMT
VRPSTW
This study
Vehicle
Heter/homo
Single
Heter/homo
Heter/homo
Heter/homo
Compartment
Single
Multiple
Single
Single
Multiple
Trip
Single
Single
Multiple
Single
Multiple
Time window
Not considered
Not considered
Not considered
Considered
ConsideredIn this paper, we present our mathematical models in three cases to see the development process of our study. In the first case, we consider the VRP for multiple product types, compartments, and trips where there is not a time window (model 1). Then we consider the case with time window (model 2) and, finally, the case with soft time window (model 3).From the above content, model 3 generalizes all previous models mentioned in this paper. It is worth pointing out that another goal of the formulation is to try to formulate the mathematical models which are feasible and solvable by available solvers in a reasonable time. In this research, all models are solved by using AIMMS 3.13 on a personal computer. The remainder of the paper is organized as follows. In Section2, the problem is defined. Also the assumptions, notations, and mathematical models are presented. Section 3 contains the computational results of our formulations. We use the same set of data from [23] to examine the feasibility and solutions of the model. Finally, in Section 4, we summarize our conclusion and provide pointers for further research.


## 2. Problem Formulation

In this section, we present a mathematical model for the vehicle routing problem for multiple product types, compartments, and trips with soft time windows. The following notations are introduced to formulate the mathematical model.Sets (Indexes). Let G(N,A) be a directed graph where N is a set of vertices and A is a set of arcs (i,j) representing the connections between the depot and customers and among the customers, where i≠j. Indeed, letN={o,d,1,2,3,…,n} be a node set (o is origin and d is destination),N∗=N∖{o,d},A(i,j):i,j∈N,i≠j be the arc set,K={1,2,3,…,v} be a set of vehicles,P={1,2,3,…,p} be a set of product types,T={1,2,3…,t} be a set of compartments,R={1,2,3,…,r} be a set of trips.Parameters. Letdsi,j be a distance between customers i and j,ti,j be a time (hour) from customers i to j (e.g., ti,j=dsi,j/v when v means traveling speed of each vehicle),dmi,p be the demand of the customer i in product p,Cpk,t be the capacity of a compartment t in the vehicle k,M be an arbitrary big number (e.g., M=∑k∑tCpk,t),TCk be the fixed cost per kilometer of running of each vehicle,LCk,p be the cost per unit travel per unit of load of product type by the vehicle,si be a service time at the customer i,ai be the lower bound of soft time window for the node i,bi be the upper bound of soft time window for the node i,LBi be the lower bound of hard time window for the node i,UBi be the upper bound of hard time window for the node i,Pl be penalty cost per hour for the earliness,Pu be penalty cost per hour for the lateness.Decision Variables. Consider(1)Xk,r,i,j=1,ifvehiclektravelsdirectlyfromnodeitojintripr;0,otherwise,XTk,r,i,j,p is the quantity of product type p to be transported from node i to node j by vehicle k in trip r,XLk,r,i,p is the quantity of product type p to be disposed at node i by vehicle k in trip r,Wk,r,i is the starting time of service in node i by the vehicle k in trip r,Wlk,r,i=max{ai-Wk,r,i,0} is the violation degree of a lower bound of soft time window,Wuk,r,i=max{Wk,r,i-bi,0} is the violation degree of an upper bound of soft time window, and(2)Uk,r,t,p=1,ifavehiclekdeliversaproductpinacompartmenttinatripr;0,otherwise.The problem is solved under the following assumptions:(1)
Every customer can be served by one and only one vehicle.(2)
Every vehicle starts and ends only at the central depot.(3)
The total demand on one particular route must not exceed the capacity of the vehicle.(4)
Each customer must be served in the related hard time window.(5)
A service (wait) time in each customer is allowed.(6)
The hard time windows must not be violated.(7)
The soft time windows can be violated at a fixed cost.Mathematical Model. The vehicle routing problem for multiple product types, compartments, and trips (model 1) can then be stated mathematically as follows:(3)min∑k∑r∑i,j∈Adsi,jXk,r,i,jTCk+∑k∑r∑p∑i,j∈AXTk,r,i,j,pdsi,jLCk,p(4)subject to:∑jXk,r,i,j-∑jXk,r,i,j=-1,i=o;1,i=d;0,otherwise;∀i∈N,∀k∈K,∀r∈R,(5)∑k∑r∑jXk,r,i,j=1;∀i∈N∗,(6)∑jXk,r,i,j≤1;∀i∈N∗,∀k∈K,∀r∈R,(7)∑j∈N∗XTk,r,o,j,p≤∑tUk,r,t,pCpk,t;∀k∈K,∀r∈R,∀p∈P,(8)∑kXLk,r,i,p=dmi,p;∀i∈N∗,∀p∈P,(9)∑k∑r∑jXTk,r,i,j,p=∑j∈N∗dmj,p;∀i∈N∗,∀p∈P,(10)∑iXTk,r,i,n,p-XLk,r,n,p=∑jXTk,r,n,j,p;∀i∈N∗,∀k∈K,∀r∈R,∀p∈P,(11)XTk,r,i,j,p≤Xk,r,i,jM;∀i,j∈N,∀k∈K,∀r∈R,∀p∈P,(12)XTk,r,i,d,p=0;∀i∈N,∀k∈K,∀r∈R,∀p∈P,(13)Xk,i,i=0;∀i∈N,∀k∈K,(14)Xk,o,d=0;∀k∈K,(15)∑pUk,r,t,p≤1;∀t∈T∀k∈K.We minimize objective function (3) which consists of two components. The first component represents traveling cost. It depends on distances covered by vehicles and the fixed costs per unit distance. The second component is defined as the fleet cost which is equal to the sum of the costs related to the loading and distance. Constraints (4) are the flow conservation of a vehicle. That is, for i=o, every vehicle starts only once at the depot and no arc terminates at node o, and also, for i=d, every vehicle ends only once at the depot and no arc originates from node d, and i∈N∗ indicate that exactly one vehicle enters and leaves each customer node. Constraints (5) require the fact that each customer is serviced exactly once. Constraints (6) state that all customers must be assigned to at most one vehicle. Constraints (7) ensure that the total number of quantity transported does not exceed the vehicle’s capacity. Constraints (8) state that the sum of the quantities of product type disposed at a customer by all the vehicles must be equal to the demand for product p. Constraints (9) represent the sum of quantities of the product type to be transported by the vehicle to the customer from the depot node (o). It should in total be greater than the total sum of the demands at all customers. Constraints (10) state that the quantity of product transported to a customer minus the quantity disposed at that customer must be equal to the quantity transported to the next customer by the vehicle. Constraints (11) represent the transported quantity. That is, variable XTk,i,j,p=0 if route segment (i,j) is not used by vehicle k; otherwise it should not exceed the total tonnage capacity of vehicle k. Constraints (12) state that each vehicle must not load at the depot. Constraints (13) and (14) are the flow conservation constraints which describe the vehicle path. Constraints (15) define a limit for each compartment to be dedicated to a single type of product.This model can be extended to the model called vehicle routing problem for multiple product types, compartments, and trips with time windows (model 2). In the next model, we include the time windows for each node. Consider(16)Wk,r,i+ti,j+si-Wk,r,jXk,r,i,j≤0;∀i,j∈N,∀k∈K,∀r∈R.Constraints (16) ensure feasibility of the time schedule; that is, Wk,r,j must be greater than or equal to Wk,r,i+ti,j+si whenever the vehicle k travels from i to j. By rewriting constraints (16), they can be replaced with the following constraints:(17)Wk,r,i-Wk,r,j+bi+ti,j+si-ajXk,r,i,j≤bi-aj;∀i,j∈N,∀k∈K,∀r∈R.(18)ai≤Wk,r,i≤bi;∀i∈N∗,∀k∈K,∀r∈R.Constraints (18) ensure that the starting time of a service does not violate the given hard time window.Proposition 1.
Constraints(19)Wk,r,i+ti,j+si-Wk,r,j≤1-Xk,r,i,jmax⁡0,bi+ti,j-aj;∀i,j∈N,∀k∈K,∀r∈Rare valid for model 2. Moreover, any Wk,r,i,Wk,r,j,Xk,r,i,j that satisfies constraints (19) satisfies constraints (17).Proof of Proposition1 is straightforward and, thus, we omit it.The vehicle routing problem for multiple product types, compartments, and trips with time windows can be stated as follows:(20)min∑k∑r∑i,j∈Adsi,jXk,r,i,jTCk+∑k∑r∑p∑i,j∈AXTk,r,i,j,pdsi,jLCk,psubject to:4–15,18,19(21)Wk,r+1,o≥Wk,r,d;∀k∈K.Constraints (18) assure that the starting time of services does not violate the given hard time windows. Constraints (21) assure that the starting time in next trip of each vehicle is satisfied.Finally we consider the complete the generalization of all models mentioned in this paper. We include soft time windows for each time window allowing the vehicle to enter the depot earlier or later with some penalties. The vehicle routing problem for multiple product types, compartments, and trips with soft time windows (model 3) can then be stated mathematically as(22)min∑k∑r∑i,j∈Adsi,jXk,r,i,jTCk+∑k∑r∑p∑i,j∈AXTk,r,i,j,pdsi,jLCk,p+∑k∑r∑iPlWlk,r,i+PuWuk,r,isubject to:4–15,22,(23)Wk,r,i+ti,j+si-Wk,r,j≤1-Xk,r,i,jmax⁡0,UBi+ti,j-LBj;∀i,j∈N,∀k∈K,∀r∈R,LBi≤Wk,r,i≤UBi;∀i∈N∗,∀k∈K,∀r∈R,(24)Wlk,r,i≥ai-Wk,r,i;∀i,j∈N∗,∀k∈K,Wuk,r,i≥Wk,r,i-bi;∀i,j∈N∗,∀k∈K.The objective function differs from models 1 and 2 by adding the third component. The objective function is to minimize the sum of the cost of traveled distances, total of costs related to loading products, and the total penalties of the outrage from soft time windows. We then replaced constraints (19) and (18) by constraints (23). Constraints (24) determine the violation degree of the lower and upper bound of soft time windows for each node.


## 3. Numerical Results

Leto,1,2,3,…,15,d be nodes where o and d are the same nodes. First of all, we consider test problems in order to observe the feasibility and solvability of the models. We test our models on the sets of 5, 10, and 15 customers. We use the same set of data from [23] to examine the feasibility and solutions of the model. Clearly, our models are more general than the one in [23]. However, we use this data set as a special case. Second of all, we randomly generate demands, service times, time windows of the customers, and distances between nodes as in Tables 2–6. The demands of customers are given in Tables 4–6.Table 2
Distance from a nodei to a node j.
d
s
i
,
j
o
,
d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
o
0
5
11
10
8
7
10
12
14
16
18
14
8
2
14
15
1
5
0
6
8
8
8
6
8
10
12
14
18
20
24
8
6
2
11
6
0
4
7
9
5
10
12
20
25
4
5
6
8
5
3
10
8
4
0
6
10
7
9
12
11
10
8
3
8
10
12
4
8
8
7
6
0
6
5
10
15
10
12
8
6
4
4
6
5
7
8
9
10
6
0
5
12
8
9
10
8
5
12
11
9
6
10
6
5
7
5
5
0
3
6
9
12
15
14
12
16
11
7
12
8
10
9
10
12
3
0
10
12
14
16
18
14
8
2
8
14
10
12
12
15
8
6
10
0
6
8
10
12
14
18
20
9
16
12
20
11
10
9
9
12
6
0
6
6
8
8
10
12
10
18
14
25
10
12
10
12
14
8
6
0
5
13
18
22
20
11
14
18
4
8
8
8
15
16
10
6
5
0
4
8
12
14
12
8
20
5
3
6
5
14
18
12
8
13
4
0
6
9
12
13
2
24
6
8
4
12
12
14
14
8
18
8
6
0
1
2
14
14
8
8
10
4
11
16
8
18
10
22
12
9
1
0
3
15
15
6
5
12
6
9
11
2
20
12
20
14
12
2
3
0Table 3
The time windows for each nodei.
o
,
d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
a
i
6
10
16
13
15
8
10
8
13
10
11
9
9
9
10
10
b
i
20
11
20
16
17
9
12
10
14
17
14
11
12
10
15
17Table 4
The demand at the nodei for five customers.
d
m
i
,
p
o
,
d
1
2
3
4
5
p
1
0
100
200
200
300
50
p
2
0
100
100
70
30
20Table 5
The demand at the nodei for ten customers.
d
m
i
,
p
o
,
d
1
2
3
4
5
6
7
8
9
10
p
1
0
50
100
120
40
30
60
80
50
130
40
p
2
0
100
90
70
30
20
50
30
40
60
80Table 6
The demand at the nodei for fifteen customers.
d
m
i
,
p
o
,
d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
p
1
0
20
100
30
40
10
30
30
60
10
20
40
20
100
20
40
p
2
0
80
60
70
30
20
40
40
10
20
70
20
50
10
50
30We assume that there are two vehicle types:v1 and v2 and two product types: p1and p2. For a general number of vehicles and products, some modifications can be easily done. We define our compartment in Table 7. We only allow a maximum of two trips per day for each vehicle. Obviously, for more general maximum number of trips per day, a small modification can be easily done as well too. For the parameters related to cost function, we let the unit penalty of the earliness Pe be 100 units and we let unit penalty of lateness Pl be 200 units. The cost of travel and loading are shown in Tables 8 and 9. Let also the lower bound of hard time window for the node i be LBi=ai-0.5. The upper bound of hard time window for the node i is UBi=bi+1 and the service time for each node si is 10 unit times and v is 20-unit distance per unit time.Table 7
The capacity for compartmentt of vehicle k.
C
k
,
t
t
1
t
2
t
3
v
1
200
200
100
v
2
300
300
200Table 8
The fixed cost of travellingTCk per k.m. and the capacity Cpk of vehicle k.
v
1
v
2
T
C
k
10
6
C
p
k
500
800Table 9
The cost of loading for productp by each vehicle k.
L
C
k
,
p
p
1
p
2
v
1
10
6
v
2
4
8All models have been coded and solved by AIMMS 3.13 [24]. They were run on a computer equipped with a processor Intel Core i5 at 2.3 GHz and 2 GB of RAM memory. The optimal solutions are obtained in Tables 10–12. The average run time for each case is included in Tables 10–12. As one can see, our model can be executed by an available solver on a personal computer in a reasonable time. We present the detailed optimal results of model 3 in the case of 15 customers for the effectiveness of the model. The optimal solutions are presented in Tables 13–16.Table 10
The solution for five customers.
Model 1
Model 2
Model 3
Objective value
60346
61016
60476
Loading cost
59860
60500
59860
Travel cost
486
516
486
Penalty cost
—
—
130
Vehicle 1
Trip 1
o
→
1
→
d
o
→
5
→
d
o
→
5
→
d
Trip 2
o
→
5
→
d
o
→
1
→
d
o
→
1
→
d
Vehicle 2
Trip 1
o
→
3
→
2
→
d
o
→
4
→
3
→
d
o
→
4
→
d
Trip 2
o
→
4
→
d
o
→
2
→
d
o
→
3
→
2
→
d
Times (seconds)
0.37
0.27
0.5Table 11
The solution for ten customers.
Model 1
Model 2
Model 3
Objective value
106574
110744
109130
Loading cost
105620
109780
107840
Travel cost
954
964
1010
Penalty cost
—
—
280
Vehicle 1
Trip 1
o
→
5
→
10
→
d
o
→
7
→
d
o
→
6
→
7
→
d
Trip 2
o
→
4
→
d
o
→
1
→
6
→
8
→
d
o
→
1
→
10
→
d
Vehicle 2
Trip 1
o
→
6
→
8
→
9
→
d
o
→
5
→
9
→
10
→
d
o
→
5
→
9
→
8
→
d
Trip 2
o
→
1
→
2
→
3
→
7
→
d
o
→
3
→
2
→
4
→
d
o
→
3
→
2
→
4
→
d
Times (seconds)
28
5
11Table 12
The solution for fifteen customers.
Model 1
Model 2
Model 3
Objective value
74548
107098
83228
Loading cost
73540
105900
81760
Travel cost
1008
1198
1078
Penalty cost
—
—
390
Vehicle 1
Trip 1
o
→
4
→
5
→
d
o
→
5
→
7
→
d
o
→
5
→
12
→
11
→
d
Trip 2
o
→
12
→
3
→
10
→
d
o
→
1
→
6
→
3
→
14
→
d
o
→
1
→
10
→
d
Vehicle 2
Trip 1
o
→
1
→
2
→
11
→
9
→
d
o
→
13
→
12
→
11
→
10
→
9
→
8
→
d
o
→
13
→
14
→
15
→
7
→
6
→
8
→
9
→
d
Trip 2
o
→
13
→
14
→
15
→
7
→
6
→
8
→
d
o
→
4
→
2
→
15
→
d
o
→
3
→
2
→
4
→
d
Times (seconds)
287
1320
1599Table 13
The service time at nodei by a vehicle k in a trip r.
Vehicle 1
Trip 1
5
→
12
→
11
→
d
7.75
8.5
9.2
10.4
Trip 2
1
→
10
→
d
11.15
12.35
20
Vehicle 2
Trip 1
13
→
14
→
15
→
7
→
6
→
8
→
9
→
d
9
9.55
10.2
10.8
11.45
12.5
13.3
14.6
Trip 2
3
→
2
→
4
→
d
15.6
16.3
17.15
20Table 14
The violation degree of the bound for soft time at nodei.
W
l
k
,
r
,
i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Vehicle 1
Trip 1
0.25
0.5
Trip 2
Vehicle 2
Trip 1
0.5
0.45
Trip 2
W
u
k
,
r
,
i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Vehicle 1
Trip 1
Trip 2
0.15
Vehicle 2
Trip 1
0.8
Trip 2
0.15Table 15
The load of the productp in a compartment t of vehicle k.
U
k
,
r
,
t
,
p
Product 1
Product 2
Vehicle 1, trip 1
Compartment 1
1
Compartment 2
1
Compartment 3
1
Vehicle 1, trip 2
Compartment 1
1
Compartment 2
1
Compartment 3
1
Vehicle 2, trip 1
Compartment 1
1
Compartment 2
1
Compartment 3
1
Vehicle 2, trip 2
Compartment 1
1
Compartment 2
1
Compartment 3
1Table 16
The quantity of productp moved from node i to node j and delivered at node i for fifteen customers.
X
T
k
,
r
,
i
,
j
,
p
Product 1
Product 2
Moved fromi to j
Delivered atj
Moved fromi to j
Delivered atj
Vehicle 1, trip 1
o–5
70
10
90
20
5–12
60
20
70
50
12-11
40
40
20
20
Vehicle 1, trip 2
o-1
40
20
150
80
1–10
20
20
70
70
Vehicle 2, trip 1
o–13
290
100
200
10
13-14
190
20
190
50
14-15
170
40
140
30
15–7
130
30
110
40
7-6
100
30
70
40
6–8
70
60
30
10
8-9
10
10
20
20
Vehicle 2, trip 2
o–3
170
30
160
70
3-2
140
100
90
60
2–4
40
40
30
30From the numerical examples, it is to be expected that the optimal values for the case where time windows are allowed are less than the case where the time windows are not allowed. Detailed results on each problem can be found in Tables10, 11, and 12 for the of cases models 1 and 2. However, there are a few cases where the time windows do not have any effect. In these cases, the optimal values for both cases should be coincided. As for the case with soft time windows, together with the penalty, we expect that the optimal value of the soft time windows case should obviously be less than the (hard) time windows since the feasible solution set for the soft time windows is strictly larger than the feasible solution set or the time windows. The results of this experiment are shown in Tables 10, 11, and 12 in cases of models 2 and 3.


## 4. Conclusion

In this paper, we present a mathematical model for the vehicle routing problem for multiple product types, compartments, and trips with soft time windows. We have verified our feasibilities and attended the optimal solution for the problems. We use the software package AIMMS to solve the problems on a personal computer. The run times are acceptable. Numerical results show the effectiveness of our model.



---

*Source: 126754-2015-07-29.xml*