Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Vehicle Routing Problem Part 2: A CP Approach.

Similar presentations


Presentation on theme: "The Vehicle Routing Problem Part 2: A CP Approach."— Presentation transcript:

1 The Vehicle Routing Problem Part 2: A CP Approach

2 NICTA Copyright 2013From imagination to impact 2/64 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

3 NICTA Copyright 2013From imagination to impact 3/64 A CP Model for the VRP

4 NICTA Copyright 2013From imagination to impact 4/64 Model A (rich) vehicle routing problem n customers (fixed in this model) m routes (fixed in this model) fixed locations – where things happen – one for each customer + one for (each?) depot c commodities (e.g. weight, volume, pallets) – Know demand from each customer for each commodity Know time between each location pair Know cost between each location pair – Both obey triangle inequality

5 NICTA Copyright 2013From imagination to impact 5/64 Vocabulary A solution is made up of routes (one for each vehicle) A route is made up of a sequence of visits Some visits serve a customer (customer visit) (Some tricks) Each route has a “start visit” and an “end visit” Start visit is first visit on a route – location is depot End visit is last visit on a route – location is depot Also have an additional route – the unassigned route – Where visits live that cannot be assigned

6 NICTA Copyright 2013From imagination to impact 6/64 Referencing Customers Each customer has an index in N = {1..n} Customers are ‘named’ in CP by their index Routes Each route has an index in M = {1..m} Unassigned route has index 0 Routes are ‘named’ in CP by their index Visits Customer visit index same as customer index Start visit for route k has index n + k ; aka start k End visit for route k has index n + m + k ; aka end k

7 NICTA Copyright 2013From imagination to impact 7/64 Referencing Sets N = { 1.. n } – customers M = { 1.. m } – routes R = M  { 0 } – includes ‘unassigned’ route V = { 1.. n + 2m } – all visits V 0 = V  {0} - includes a ‘spare’ S = { n+1.. n+m } – start visits E = { n+m+1.. n+2m } – end visits V S = N  S – visits that have a sensible successor V E = N  E – visits that have a sensible predecessor

8 NICTA Copyright 2013From imagination to impact 8/64 Data We know (note uppercase) V i The ‘value’ of customer i D ik Demand by customer i for commodity k E i Earliest time to start service at i L i Latest time to start service at i Q jk Capacity of vehicle j for commodity k T ij Travel time from visit i to visit j C ij Cost (w.r.t. objective) of travel from i to j

9 NICTA Copyright 2013From imagination to impact 9/64 Basic 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  V E for i in V S s i = 0 for i in E Predecessor variables p i p i gives the index of the previous visit in the route p i  V S for i in V E p i = 0 for i in S Redundant – but empirical evidence for its use Route variables r i r i gives the index of the route (vehicle) that visits i r i  R

10 NICTA Copyright 2013From imagination to impact 10/64 7 Example Route 1 Route 2 Start visits End visits isisi pipi riri

11 NICTA Copyright 2013From imagination to impact 11/64 Other variables Accumulation Variables q ik Quantity of commodity k after visit i c i Objective cost getting to i For problems with time constraints a i Arrival time at i t i Start time at i (time service starts) d i Departure time at i Actually, only t i is required, but others allow for expressive constraints

12 NICTA Copyright 2013From imagination to impact 12/64 What can we model? Basic VRP VRP with time windows Multi-depot Heterogeneous fleet Open VRP (vehicle not required to return to base) – Requires anywhere location – Route end visits located at anywhere – distance i  anywhere = 0 Compatibility – Customers on different / same vehicle – Customers on/not on given vehicle Pickup and Delivery problems

13 NICTA Copyright 2013From imagination to impact 13/64 What can we model? Variable load/unload times – by changing departure time relative to start time Dispatch time constraints – e.g. limited docks – s i for i in S is load-start time Depot close time – Time window on end visits Fleet size and mix – Add lots of vehicles – Need to introduce a ‘fixed cost’ for a vehicle – C ij is increased by fixed cost for all i  S, all j  N

14 NICTA Copyright 2013From imagination to impact 14/64 What can’t we model Can’t handle dynamic problems – Fixed domain for s, p, r vars Can’t introduce new visits post-hoc – E.g. optional driver break must be allowed at start Can’t handle multiple visits to same customer – ‘Larger than truck-load’ problems – If qty is fixed, can have multiple visits / cust – Heterogeneous fleet is a pain Can’t handle time- or vehicle-dependent travel times/costs Soft Constraints

15 NICTA Copyright 2013From imagination to impact 15/64 Objective Want to minimize sum of objective ( c ij ) over used arcs, plus value of unassigned visits minimize

16 NICTA Copyright 2013From imagination to impact 16/64 Basic constraints Path ( S, E, { s i | i  V } ) AllDifferent ( { p i | i  V E } ) Accumulate obj. Accumulate time Time windows

17 NICTA Copyright 2013From imagination to impact 17/64 Constraints Load Consistency

18 NICTA Copyright 2013From imagination to impact 18/64 Solving Pure CP Assign to ‘successor’ variables Form chains of visits Decision 1: Which visit to insert (== variable choice) Decision 2: Where to insert it (== value choice) s 2 = 1 s 5 = 3 s 1 = s 7 = 2 ‘Rooted chain’ starts at Start ‘Free chain’ otherwise Can reason about free chains but rooted chains easier “ last(k) ” is last visit in chain starting at k

19 NICTA Copyright 2013From imagination to impact 19/64 Propagation – Cycles Subtour elimination Rooted chains are fine For free chains: – for any chain starting at j, remove j from s last(j) Some CP libraries have built-ins – Comet: ‘circuit’ – ILOG: Path constraint

20 NICTA Copyright 2013From imagination to impact 20/64 Propagation – Cycles ‘Path’ constraint Propagates subtour elimination Also propagates cost path (S, T, succ, P, z) – succ array implies path – ensures path from nodes in S to nodes in T through nodes in P – variable z bounds cost of path – cost propagated incrementally based on shortest / longest paths

21 NICTA Copyright 2013From imagination to impact 21/64 Propagation – Cost ‘Path’ constraint Maintains sets Path is consistent if it starts in S, ends in T, goes through P, and has bounds consistent with z Pos  P U S U T : Possibly in the path – If no consistent paths use i, then i  Pos Req  Pos: Required to be in the path – If there is a consistent path that does not need i, then i  Req Shortest path in Req  lower bound on z Longest path in Pos  upper bound on z == Shortest path with –ve costs Updated incrementally (and efficiently)

22 NICTA Copyright 2013From imagination to impact 22/64 Simulated Annealing shortcut leverages cost estimate from Path constraint std SA: – Generate sol – test delta obj against uniform rand var improved SA – generate random var first – calc acceptable obj – constrain obj Much more efficient

23 NICTA Copyright 2013From imagination to impact 23/64 Propagation – Capacity (assume +ve qtys) Rooted Chain For each visit i with p i not bound – For each route k in domain of r i If spare space on route k won’t allow visit i – Remove k from r i – Remove i from p end(k) – Remove i from s last(start(k)) Free chains As above (pretty much) Before increasing chain to load L – v = Count routes with free space ≥ L – c = Count free chains with load ≥ L – if c > v, can’t form chain Assume +ve qtys

24 NICTA Copyright 2013From imagination to impact 24/64 Propagation – Time Time Constraints: Rooted chains: For each route k – For each visit i in domain of s last(k) If vehicle can’t reach i before E i – Remove k from r i – Remove i from s last(start(k)) Free chains: Form “implied time window” from chain Rest is as above

25 NICTA Copyright 2013From imagination to impact 25/64 Savings Note: Clarke-Wright “Savings” method grows chains of visits Very successful early method Still used in many methods for an initial solution Very appropriate for CP

26 NICTA Copyright 2013From imagination to impact 26/64 Propagation – an alternative Alternative relies on knowledge of “incumbent” solution Use shared data structure Can use full insertion (insert into middle of ‘chain’) Var/value choice Propagators CP System Incumbent Solution

27 NICTA Copyright 2013From imagination to impact 27/64 Propagation Insertion ‘in the middle’ Propagators know incumbent solution Only propagate non-binding implications e.g. don’t “set” s 1 s 2 here: But 1 is removed from s 4, s 6 Can calculate earliest start, latest start to bound start time Can calculate feasible inserts, and update s vars appropriately Strong propagation for capacity, time constraints

28 NICTA Copyright 2013From imagination to impact 28/64 Insertion Allows for maximum propagation Allows constraints to influence solution progressively e.g. Blood delivery constraints – Delivery within 20 minutes of pickup – As soon as one is fixed implication flows to other e.g. Mutex (mutual exclusion) constraint – Either this request XOR that one – Used in line-haul – deliver direct xor use a cross-dock – As soon as one is used, r other = { 0 }

29 NICTA Copyright 2013From imagination to impact 29/64 Insertion Subtours – poor man’s AllDifferent Can use stronger subtour elimination (Pesant)  (i)  (j) i j 

30 NICTA Copyright 2013From imagination to impact 30/64 Local Search Can apply std local search methods VRPs – k-opt – Or-opt – exchange – … Step from solution to solution, so CP is only used as rule-checker – Little use of propagation But LNS is repeated insertion – Makes maximum use of propagation

31 NICTA Copyright 2013From imagination to impact 31/64 Large Neighbourhood Search revisited

32 NICTA Copyright 2013From imagination to impact 32/64 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

33 NICTA Copyright 2013From imagination to impact 33/64 Large Neighbourhood Search Destroy part of the solution (Select method) In CP terms, this means: Relax some variable assignments In CP-VRP terms, this means Relax some successor assignments, i.e. ‘Unassign” some visits.

34 NICTA Copyright 2013From imagination to impact 34/64 Large Neighbourhood Search Destroy part of the solution (Select method) Examples Remove a sequence of visits

35 NICTA Copyright 2013From imagination to impact 35/64 Large Neighbourhood Search Destroy part of the solution (Select method) Examples Choose longest (worst) arc in solution – Remove visits at each end – Remove nearby visits Actually, choose r th worst r = n * (uniform(0,1)) y y ~ 6 – = – = 0.531

36 NICTA Copyright 2013From imagination to impact 36/64 Large Neighbourhood Search Destroy part of the solution (Select method) Examples Dump visits from k routes (k = 1, 2, 3) – Prefer routes that are close, – Better yet, overlapping

37 NICTA Copyright 2013From imagination to impact 37/64 Large Neighbourhood Search Destroy part of the solution (Select method) Examples Choose first visit randomly Then, remove “related” visits – Based on distance, time compatibility, load

38 NICTA Copyright 2013From imagination to impact 38/64 Large Neighbourhood Search Destroy part of the solution (Select method) Examples Dump visits from the smallest route – Good if saving vehicles – Sometimes fewer vehicles = reduced travel

39 NICTA Copyright 2013From imagination to impact 39/64 Large Neighbourhood Search Destroy part of the solution (Select method) Parameter: Max to dump – As a % of n ? – As a fixed number e.g. 100 for large problems Actual number is uniform rand (5, max)

40 NICTA Copyright 2013From imagination to impact 40/64 Large Neighbourhood Search Destroy part of the solution (Select method) Examples Remove a sequence of visits Choose longest (worst) arc in solution – Remove visits at each end – Remove nearby visits Dump visits from k routes (k = 1, 2, 3) Choose first visit randomly – Remove “related” visits – Based on distance, time compatibility, load Dump visits from the smallest route (if saving vehicles) Parameter: Max to dump (as a % of n ?) nx y = = 0.531

41 NICTA Copyright 2013From imagination to impact 41/64 Large Neighbourhood Search Re-create solution Use different insert methods Insert methods differ by choice of: – Which visit to insert – Where to insert it Where to insert: Usually in position that increases cost by least Which to insert: Examples: – Random Choose visit to insert at random – Minimum insert cost Choose visit that increasess cost by the least – Regret, 3-Regret, 4-Regret Choose visit with maximum difference between first and next best insert position

42 NICTA Copyright 2013From imagination to impact 42/64 Regret

43 NICTA Copyright 2013From imagination to impact 43/64 Regret

44 NICTA Copyright 2013From imagination to impact 44/64 Regret

45 NICTA Copyright 2013From imagination to impact 45/64 Regret

46 NICTA Copyright 2013From imagination to impact 46/64 Regret

47 NICTA Copyright 2013From imagination to impact 47/64 Regret Regret = C(insert in 2 nd -best route) – C(insert in best route) = f (2, i ) – f (1,i ) K-Regret = ∑ k=1,K ( f ( k,i ) – f (1,i ) )

48 NICTA Copyright 2013From imagination to impact 48/64 Large Neighbourhood Search If the solution is better, keep it Can use Hill-climbing Can use Simulated Annealing Can use Threshold Annealing … Repeat Can use fail limit (limit on number of infeasibilities found) Can use Restarts Can use limited number of iterations

49 NICTA Copyright 2013From imagination to impact 49/64 Large Neighbourhood Search Big Advantage: We can tailor Select / Insert e.g. Routing with Equipment Some tasks need equipment Pickup /drop-off equipment at sub-depots Modelled as a PDP with special compatibility constraints Special Destroy methods Remove visits if equipment not used much Destroy routes with equip needed by unassigned visits Special Insert Methods Add multiple equips if some tasks need them Insert hardest to satisfy visits first

50 NICTA Copyright 2013From imagination to impact 50/64 Large Neighbourhood Search Learning (Ropke & Pisinger) Learn which Select methods are performing well Learn which Insert methods are performing well Select according to “success” Success = – New best solution – New incumbent solutions – Solution not previously seen

51 NICTA Copyright 2013From imagination to impact 51/64 Advanced techniques Randomized Adaptive Decomposition Partition problem into subproblems Work on each subproblem in turn Decomposition ‘adapts’ – Changes in response to incumbent solution

52 NICTA Copyright 2013From imagination to impact 52/64 Advanced techniques – Re-create solution Complete search If subproblem is small (e.g. selected < 10 visits), use complete search Good for highly constrained problems

53 NICTA Copyright 2013From imagination to impact 53/64 Advanced techniques – Re-create solution Limited Discrepancy Search Heuristic order

54 NICTA Copyright 2013From imagination to impact 54/64 Advanced techniques Limited Discrepancy Search

55 NICTA Copyright 2013From imagination to impact 55/64 Advanced techniques Limited Discrepancy Search

56 NICTA Copyright 2013From imagination to impact 56/64 Advanced techniques Limited Discrepancy Search

57 NICTA Copyright 2013From imagination to impact 57/64 Advanced techniques 2-LDS

58 NICTA Copyright 2013From imagination to impact 58/64 Advanced techniques 2-LDS

59 NICTA Copyright 2013From imagination to impact 59/64 Advanced techniques 2-LDS

60 NICTA Copyright 2013From imagination to impact 60/64 Advanced techniques 2-LDS

61 NICTA Copyright 2013From imagination to impact 61/64 Advanced techniques 2-LDS

62 NICTA Copyright 2013From imagination to impact 62/64 Advanced techniques Limited Discrepancy Search Structured incomplete search Budget of discrepancies ‘Spend’ a discrepancy by going against the heuristic

63 NICTA Copyright 2013From imagination to impact 63/64 Solving VRPs CP is “natural” for solving vehicle routing problems – Real problems often have unique constraints – Easy to change CP model to include new constraints – New constraints don’t change core solve method – Infrastructure for complete (completish) search in subproblems LNS is “natural” for CP – Insertion leverages propagation

64 NICTA Copyright 2013From imagination to impact 64/64 Playtime 2 Solve some VRPs using Comet Some differences between presentation and example: Single commodity/capacity Homogeneous fleet ‘capacity’ in model == ‘q’ here Capacity enforced by domain, not constraint Only start time modelled explicitly – arrival time implicit – duration fixed Successor of end visit for route k is start of route k+1 – s last(k) = n + k + 1 No ‘unassigned’ route


Download ppt "The Vehicle Routing Problem Part 2: A CP Approach."

Similar presentations


Ads by Google