How to tackle a
complex Vehicle
Routing Problem
Hugo Larzábal
-Contents
Introduction
The problem
Solving approaches
Vehicle routing problems
About
baobab soluciones
. Not your usual consultants.
Founded in June 2011
A spin-off from the Universidad
Politécnica de Madrid (UPM)
Tailored Advanced Analytics
solutions
for Forbes Fortune 500
organizations from all industries.
Contents
Introduction
Vehicle routing problems
▪ Concept
Concept
Given a set of customers, which is
the optimal set of routes
for a fleet of
vehicles that ensures that all customers are visited?
Elements
Depot
Set of customers
Fleet of vehicles
Objectives
Minimize number of
routes
Minimize distance
covered
Minimize penalty for
poor quality routes
VRP variants
Homogenous/heterogeneous fleet
Capacitated
Time windows Pick up and delivery
LIFO pick up and delivery
Symmetrical/Asymmetrical distances Single/multiple depots
Limited carrying capacity for vehicles All the vehicles are similar/different
The products need to be picked up in one place and delivered in another The last product picked up need to be
delivered first
Sites must be visited within a time window
Distances from A to B and from B to A are similar/different
All the vehicles are starting at the same point/different point
Variants
Capacitated VRP
Limited carrying capacity for vehicles
Time windows within which deliveries must be
made
Goods need to be moved from pickup locations to
delivery locations
VRP with Time Windows
VRP with Pickup and Delivery
VRP
VRPTW
CVRP
VRPPD
CVRPPD
CVRPTW
Our problem
Two
synched
VRP problems
•
Actual trucks
•
Operator teams
Capacitated vehicles
Homogenous fleet
Mono depot
Bi-objective
•
Cost
Contents
Introduction
The problem
Vehicle routing problems
▪ Context: a 2-CVRPTW ▪ Inputs and outputs
Context
Several sites to be visited by a fleet of vehicles and
several teams.
At each site:
• A vehicle and a team must be present at the same time.
• They must perform certain tasks (loading the vehicle) and stay for a certain time at the site.
• The number of products at each site may vary (affects the time spent at the site and the capacity of the vehicle used).
• The tasks must be performed before a certain time.
• The clients want to be visited as late as possible.
Teams can walk from site to site or use a van.
Delivery at the depot must be done within a time
window.
Costs to minimize
•
Km costs for the vehicles.
•
Costs related to the
workforce (drivers and
workers)
Objectives
•
Minimize cost
Team1 Team2 Vehicle 1 Vehicle 2 Team4 Team3 Depot Van
Context: a 2-CVRPTW + VRPPDTW
Inputs and outputs
Items to be
picked up capacityVehicle Site and depot time windows Distances
Vehicles schedule Teams schedule Vans schedule
Objectives
Minimal total cost
Why is this problem hard to solve?
Vehicles capacity and sites time windows make it hard to find feasible solutions.
Costs and quality of service are conflicting goals.
The coordination of the vehicles and teams is complicated.
There is no obvious good strategy:
• Create routes by always going to the next closest site?
• Spread out the biggest clients in different routes?
Contents
Introduction
The problem
Vehicle routing problems
▪ Possible formulations and chosen approach ▪ 3-step resolution
▪ Problem decompositions
▪ Improving the solution further
Possible formulations
•
Time discretization
Easy to understand
Large number of variables:
T(route, site, time)= 0 | 1
•
Time slots
Slot variables:
slot(route, site, n) = 0 | 1 Start and end times:
start(route, n_slot) end(route, n_slot) Many unused slot variables
•
Tasks precedences:
Direct precedences General precedencesB
Site A
A
Site B
Vehicle 1 Vehicle 2C
B
B
A
B
C
Formulation with general precedences
• Route variables
site_in_route(vehicle, site) = 1 | 0
• Precedence variables
precedence(site_1, site_2) = 1 | 0
• Start and end variables start(site)
end(site)
• Time constraints
end(site A) + travel(A, B) <= start(site B) + M x (1-precedence(site A, site B))
Site B
Site C
Site A
site_in_route(v1, A) = 1 site_in_route(v2, A) = 0 site_in_route(v1, B) = 1 site_in_route(v2, B) = 0 site_in_route(v1, C) = 1 site_in_route(v2, C) = 0 Vehicle 1end(A) + travel(A, B) <= start(B) + M x (1 – 1) end(B) + travel(B, A) <= start(A) + M x (1 – 0)
always true since M is big
start(A) = t1 end(A) = t1 + duration(A) start(B) = t2 end(B) = t2 + duration(B) start(A) = t3 end(B) = t3 + duration(B) precedence(A, B) = 1 precedence(B, A) = 0 precedence(A, C) = 1 precedence(C, A) = 0 precedence(B, C) = 1 precedence(C, B) = 0
3-step resolution
Problem decomposition - 2 phase decomposition. - iterative decomposition.02
Complete problem Precedences formulation01
Solution improvementMILP based local search
03
First problem decomposition
Two-phase decomposition
Vehicle 1 Team 1 Team 2Site B
Site D
Site B
Site A
Site D
Vehicle 2Site C
Site C
Site A
Solve the vehicle problem first
Fix the vehicle solution and solve the team problem
Second Problem decomposition
Iterative decomposition
A B C D E F G HSecond Problem decomposition
Iterative decomposition
F A B C D E G H F ACreate some small groups of sites Solve the problem with the first group
Second Problem decomposition
Iterative decomposition
F G A B C D E H F A G BCreate some small groups of sites Solve the problem with the first group
only
Second Problem decomposition
Iterative decomposition
A B C D E F G H E C G F D H B ACreate some small groups of sites Solve the problem with the first group
only
Improving a solution with MILP based local search
A B C D E F G H E C G F D H B A J I J IChoose some sites randomly Free up those sites and fix everything
Improving a solution with MILP based local search
A B C F D G H E C G F D H A J I JChoose some sites randomly Free up those sites and fix everything
Improving a solution with MILP based local search
A B* C F D G H E* C G F D H A J I* JChoose some sites randomly Free up those sites and fix everything
else
Solve the problem again
B*
E*
I*
Improving a solution with MILP based local search
A B C D E F G H E C G F D H B A J I J IChoose some sites randomly
Free up those sites and fix everything else
Solve the problem again
Site local search
Choose two vehicles randomly Free up the corresponding sites and fix
everything else Solve the problem again
Contents
Introduction
The problem
Solving approaches
Vehicle routing problems
Results
Time Sites Precedence model 2-phase dec 2-phase dec iterative dec iterative dec 2-phase iterative dec 2-phase iterative dec 2-phase iterative dec 2-phase iterative dec
vehicle LS vehicle LS vehicle LS site LS site LS site LS
1 min
8 0,0% 0,0% 0,0% 30,2% 0,9% 30,1% 0,0% 0,0% 0,0%
20 time out 11,2% 0,0% infeasible infeasible 3,8% 0,3% 4,0% infeasible
40 time out 73,2% 30,3% 48,9% 33,6% 25,8% 29,9% 22,5% 14,1% 5 min 8 0,0% 0,0% 0,0% 30,2% 0,9% 30,1% 0,0% 0,0% 0,0% 20 4,8% 6,1% 0,0% 5,5% 5,5% 5,0% 0,3% 4,0% 2,2% 40 74,4% 30,2% 16,0% 21,1% 24,4% 18,6% 10,6% 14,8% 6,1% 10 min 8 0,0% 0,0% 0,0% 30,2% 0,9% 30,1% 0,0% 0,0% 0,0% 20 4,5% 6,1% 2,5% 5,5% infeasible 4,8% 0,3% 4,2% 2,0% 40 55,7% 25,6% 0,0% 18,8% 21,9% 16,9% 0,9% 14,9% 5,5% 30 min - - - -20 3,1% 0,5% 0,3% infeasible 5,5% 3,3% 2,5% 1,4% 0,3% 40 32,7% 21,7% 3,5% 13,4% 97,1% 14,8% 1,6% 14,4% 2,2%
Infeasible: decomposing the problem may lead to situations where no solution can be found. Time out: the solver did not find a solution in the allocated time.
Conclusions and highlights
Real-life vehicle routing problems can be
very hard
to solve.
MILP can be used to solve complex and large VRP:
• General precedence models are an effective way to solve small and medium instances.
• For large instances, problem decompositions and local search are useful to get good solutions in reasonable time.
• Gurobi allows us to make fast local searches by solving relatively small problems very quickly (seconds vs minutes).