# The Vehicle Routing Problem Using CP in the real world.

## Presentation on theme: "The Vehicle Routing Problem Using CP in the real world."— Presentation transcript:

The Vehicle Routing Problem Using CP in the real world

NICTA Copyright 2011From imagination to impact 2/58 Outline Session 1 What is the vehicle routing problem (VRP)? ‘Traditional’ (Non-CP) solution methods A simple CP model Playtime Session 2 A CP model for the VRP Large Neighbourhood Search revisited Propagation More Playtime

NICTA Copyright 2011From imagination to impact 3/58 What is the Vehicle Routing Problem Given a set of customers, and a fleet of vehicles to make deliveries, find a set of routes that services all customers at minimum cost

NICTA Copyright 2011From imagination to impact 4/58 Vehicle Routing Problem

NICTA Copyright 2011From imagination to impact 5/58 Vehicle Routing Problem

NICTA Copyright 2011From imagination to impact 6/58 Why study the VRP? The logistics task is 9% of economic activity in Australia Logistics accounts for 10% of the selling price of goods

NICTA Copyright 2011From imagination to impact 7/58 Vehicle Routing Problem For each customer, we know Quantity required The cost to travel to every other customer For the vehicle fleet, we know The number of vehicles The capacity We must determine which customers each vehicle serves, and in what order, to minimise cost

NICTA Copyright 2011From imagination to impact 8/58 Vehicle Routing Problem Objective function In academic studies, usually a combination: First, minimise number of routes Then minimise total distance or total time In real world A combination of time and distance Must include vehicle- and staff-dependent costs Usually vehicle numbers are fixed

NICTA Copyright 2011From imagination to impact 9/58 Vehicle Routing Problem Might be more than one ‘capacity’ – e.g. limited weight and volume Might be more than one type of vehicle – Different capacities and costs – ‘Heterogeneous Vehicles’

NICTA Copyright 2011From imagination to impact 10/58 MIP formulation Data c ij : Cost of travel from i to j q i : Demand at i Decision var: x ijk : Travel direct from i to j on vehicle k Depot

NICTA Copyright 2011From imagination to impact 11/58 Vehicle Routing Problem In a classic 2-echelon routing problem: Stage 1: Production/warehouse to distribution depots Stage 2: Distribution depots to end customer VRP is primarily concerned with Stage 2 Strategic decision Also study dynamic version

NICTA Copyright 2011From imagination to impact 12/58 History: Travelling Salesman Problem A travelling salesman has to visit a number of cities. He knows the cost of travel between each pair. What order does he visit the cities to minimise cost? Long and well-studied problem (since the 60’s) A sub-problem in many others Used in chip fabrication and many other real-world problems TSP = VRP with 1 vehicle of infinite capacity In vehicle routing - having decided which vehicle will visit which customers, each vehicle route is a travelling salesman problem

NICTA Copyright 2011From imagination to impact 13/58 Travelling Salesman Problem Exact solution are found regularly for problems with 200-300 cities, and occasionally for problems with 1000 nodes. Some larger problems solved (24,798 cities, towns and villages in Sweden) But – no constraints on the solution Even one constraint, and the whole method is unusable

NICTA Copyright 2011From imagination to impact 14/58 Routing with constraints Each new twist (business rule, practice, limitation) changes which solutions are good, and which are even acceptable The types of constraints that must be observed may impact on the way the problem is solved Many types of constraint studied – but usually in isolation We will look at a few that have been studied in the literature

NICTA Copyright 2011From imagination to impact 15/58 Time window constraints Vehicle routing with Constraints Time Window constraints – A window during which service can start – E.g. only accept delivery 7:30am to 11:00am – Additional input data required Duration of each customer visit Time between each pair of customers (Travel time can be vehicle-dependent or time- dependent) – Makes the route harder to visualise

NICTA Copyright 2011From imagination to impact 16/58 Time Window constraints

NICTA Copyright 2011From imagination to impact 17/58 Pickup and Delivery problems Most routing considers delivery to/from a depot (depots) Pickup and Delivery problems consider FedEx style problem: pickup at location A, deliver to location B Load profile:

NICTA Copyright 2011From imagination to impact 18/58 Pickup and Delivery problems PDPs have two implied constraints: – pickup is before delivery – pickup and delivery are on the same vehicle Usually, completely different methods used to solve this sort of problem Can be quite difficult Standard VRP is in effect a PDP with all stuff picked up at (delivered to) a depot. Not usually solved that way

NICTA Copyright 2011From imagination to impact 19/58 Pickup and Delivery problem Interesting variants Dial-a-ride problem: – Passenger transport – Like a multi-hire taxi – Pickup passenger A, pickup passenger B, drop off B, pickup up C, drop off A, …. – Ride-time constraints ( e.g. max 1.4 x direct travel time ) PDP can be used to model cross-docking – Pick up at Factory, Deliver to DC; Pickup at DC, Deliver to customer – Constraint: “Deliver to DC” before “Pickup at DC”

NICTA Copyright 2011From imagination to impact 20/58 Fleet size and mix Heterogonous vehicles – Vehicles of different capacities, costs, speeds etc Fleet size and mix problem – Decide the correct number of each type of vehicle – Strategic decision Can be the most important part of optimization

NICTA Copyright 2011From imagination to impact 21/58 Other variants Orienteering problem Not all visits need to be completed Each visit has a reward Given a time limit, how many visits can I cover to maximize my reward?

NICTA Copyright 2011From imagination to impact 22/58 Other variants Profitable tour problem Not all visits need to be completed Known profit for each visit Choose a subset that gives maximum return (profit from visits – routing cost)

NICTA Copyright 2011From imagination to impact 23/58 Other variants Inventory Routing “Vendor managed inventories” Supplier determines when visit occurs More visits  higher transportation costs Fewer visits  higher stockout and holding costs Balance transportation cost against holding/stockout cost Delivery Freq

NICTA Copyright 2011From imagination to impact 24/58 Other variants Period Routing Routing with periodical deliveries Same routes every week / fortnight Deliver to different customers with different frequencies: patterns 3-part problem – Choose pattern for each cust – Choose qty for each delivery – Design route for each day MTWTF ?? ?? ??? ?????

NICTA Copyright 2011From imagination to impact 25/58 VRP meets the real world Many groups now looking at real-world constraints Rich Vehicle Routing Problem Attempt to model constraints common to many real-life enterprises – Multiple Time windows – Multiple Commodities – Heterogeneous vehicles – Compatibility constraints Goods for customer A can’t travel with goods from customer B Goods for customer A can’t travel on vehicle C

NICTA Copyright 2011From imagination to impact 26/58 VRP meets the real world Other real-world considerations Fatigue rules and driver breaks Vehicle re-use Ability to change vehicle characteristics (composition) – Add trailer, or move compartment divider Use of limited resources – e.g limited docks for loading, hence need to stagger dispatch times Variable loading / unloading times

NICTA Copyright 2011From imagination to impact 27/58 VRP meets the real world Yet more constraints Only two types of product on each vehicle ‘Grand tour’ constraint – Customers visited in ‘patterns’ (Period Routing) – Grand tour includes all visits – Skip visit if not required that day – Each day must be feasible (incl. time windows) Meet ferry Blood transport (dynamic time window) Promiscuous driver constraint

NICTA Copyright 2011From imagination to impact 28/58 VRP meets the real world New data sources Routing with time-of-day dependent travel times – Uses historical data to forecast travel time at different times of day Routing with dynamic travel times – Uses live traffic information feed to update expected travel time dynamically

NICTA Copyright 2011From imagination to impact 29/58 VRP meets the real world Stochastic Routing What if things don’t go according to plan? Sources of uncertainty – Uncertainty in existence (do I even need to visit) – Uncertainty in quantity (how much is actually required) – Uncertainty in travel times (traffic) – Uncertainty in duration (maintenance engineer) Optimal solution can be brittle – If something is not quite right, whole solution falls apart

NICTA Copyright 2011From imagination to impact 30/58 VRP meets the real world E.g. garbage collection Wet rubbish is heavy On rainy days, trucks may have more load than usual (uncertainty in quantity) Need stops near dump in case they have to double back = Recourse.

NICTA Copyright 2011From imagination to impact 31/58 Solution Methods

NICTA Copyright 2011From imagination to impact 32/58 Solving VRPs VRP is hard NP Hard in the strong sense Exact solutions only for small problems (20-50 customers) Most solution methods are heuristic Most operate as – Construct – Improve

NICTA Copyright 2011From imagination to impact 33/58 ILP Advantages Can find optimal solution Disadvantages Only works for small problems One extra constraint  back to the drawing board

NICTA Copyright 2011From imagination to impact 34/58 ILP – Column Generation 8976994532 111100… 201101… 300000… 410110… 510000… Columns represent routes Rows represent customers Column/route cost c k Array entry a ik = 1 iff customer i is covered by route k

NICTA Copyright 2011From imagination to impact 35/58 Column Generation Decision var x k : Use column k? Column only appears if feasible ordering is possible Cost of best ordering is c k Best order stored separately Master problem at right

NICTA Copyright 2011From imagination to impact 36/58 Column Generation Subproblem i.e. shortest path with side constraints If min is –ve add to master problem CP!

NICTA Copyright 2011From imagination to impact 37/58 Heuristic methods - Construction Insert methods Order is important:

NICTA Copyright 2011From imagination to impact 38/58 Heuristic methods - Construction Savings method (Clarke & Wright 1964) Calculate S ij for all i, j Consider cheapest S ij If j can be appended to i – merge them to new i – update all S ij else – delete S ij Repeat i j

NICTA Copyright 2011From imagination to impact 39/58 Improvement Methods 2-opt (3-opt, 4-opt…) Remove 2 arcs Replace with 2 others

NICTA Copyright 2011From imagination to impact 40/58 Improvement methods Large Neighbourhood Search = Destroy & Re-create Destroy part of the solution – Remove visits from the solution Re-create solution – Use insert method to re-insert customers – Different insert methods lead to new (better?) solutions If the solution is better, keep it Repeat

NICTA Copyright 2011From imagination to impact 41/58 Improvement methods Variable Neighbourhood Search Consider multiple neighbourhoods – 1-move (move 1 visit to another position) – 1-1 swap (swap visits in 2 routes) – 2-2 swap (swap 2 visits between 2 routes) – 2-opt – 3-opt – Or-opt size 2 (move chain of length 2 anywhere) – Or-opt size 3 (chain length 3) – Tail exchange (swap final portion of routes

NICTA Copyright 2011From imagination to impact 42/58 Improvement methods Variable Neighbourhood Search Consider multiple neighbourhoods Find local minimum in smallest neighbourhood Advance to next-largest neighbourhood Search current neighbourhood – If a change is found, return to smallest neighbourhood – Otherwise, advance to next-largest

NICTA Copyright 2011From imagination to impact 43/58 Improvement methods Path Relinking Applies where-ever a population of solutions is available Take one (good) solution A Take another (good) reference solution B Gradually transform solution A into solution B – pass through new solutions “between” A and B – new solutions contain traits of both A and B – should be good!

NICTA Copyright 2011From imagination to impact 44/58 Improvement methods Genetic Programming Simulated Natural Selection

NICTA Copyright 2011From imagination to impact 45/58 Genetic Programming Generate a population of solutions (construct methods) Evaluate fitness (objective) Create next generation: – Choose two solutions from population – Combine the two (two ways) – (Mutate) – Produce offspring (calculate fitness) – (Improve) – Repeat until population doubles Apply selection: – Bottom half “dies” Repeat

NICTA Copyright 2011From imagination to impact 46/58 Genetic Programming 14623895107 1 82549367 125 132 61973210485 197 864325 160 198

NICTA Copyright 2011From imagination to impact 47/58 Genetic Programming 14623895107 1 82549367 125 132 61973210485 197 864325 160 198 11082395 74 128

NICTA Copyright 2011From imagination to impact 48/58 Genetic Programming 14623895107 1 82549367 125 132 61973210485 197 864325 160 198 11082595 74 146239378 128 206

NICTA Copyright 2011From imagination to impact 49/58 Genetic Programming 14623895107 1 82549367 125 132 61973210485 160 11082595 74 128

NICTA Copyright 2011From imagination to impact 50/58 Genetic Programming Split Solution representation does not include route delimiters Routes are determined using “Split” routine – Solves shortest path problem on an auxiliary graph – O(mn 2 ) Allows freer movement in solution space

NICTA Copyright 2011From imagination to impact 51/58 Scaling Solving problems with tens of thousands of nodes Decompose problem – Split into smaller problems Limit search – Only consider inserting next to nearby nodes – Only consdier inserting into nearby routes

NICTA Copyright 2011From imagination to impact 52/58 Solution Methods.. and the whole bag of tricks Tabu Search Simulated Annealing Ants Bees ….

NICTA Copyright 2011From imagination to impact 53/58 A CP Model for the TSP

NICTA Copyright 2011From imagination to impact 54/58 Model Classic TSP n customers (fixed in this model) fixed locations – where things happen – one for each customer + one for the depot Know distance/cost C(i,j) between each location pair – Obeys triangle inequality Each customer has an index in N = {1..n} Customers are ‘named’ in CP by their index

NICTA Copyright 2011From imagination to impact 55/58 Variables Successor variables: s i s i gives direct successor of i, i.e. the index of the next visit on the route that visits i s i  N

NICTA Copyright 2011From imagination to impact 56/58 Constraints AllDifferent ( s ) 2 4 1 5 3 6 isisi 14 21 36 42 53 65

NICTA Copyright 2011From imagination to impact 57/58 1 Constraints AllDifferent ( s ) Circuit ( s ) 2 4 5 3 6 isisi 14 23 36 42 51 65

NICTA Copyright 2011From imagination to impact 58/58 Objective Objective is minimise( sum i in N ( C( i, s i ) ) )

NICTA Copyright 2011From imagination to impact 59/58 Playtime Now you have a try…

NICTA Copyright 2011From imagination to impact 60/58

Download ppt "The Vehicle Routing Problem Using CP in the real world."

Similar presentations