© J. Christopher Beck 20081 Lecture 17: Tabu Search.

Presentation on theme: "© J. Christopher Beck 20081 Lecture 17: Tabu Search."— Presentation transcript:

© J. Christopher Beck 20081 Lecture 17: Tabu Search

© J. Christopher Beck 2008 2 Outline Review: Local Search & Crystal Maze Tabu Search Tabu & 1-machine JSP Example C.5.4 Tabu & JSP N1 neighborhood

© J. Christopher Beck 2008 4 Core Ideas of Local Search Start with some (random?) assignment of variables Look in “neighborhood” formed by making a small change to the assignment Choose best neighbor Repeat

© J. Christopher Beck 2008 5 Crystal Maze Place the numbers 1 through 8 in the nodes such that: Each number appears exactly once ? ? ? ? ? ? ?? –No connected nodes have consecutive numbers

© J. Christopher Beck 2008 6 Random Initial Solution ? ? ? ? ? ? ?? 1 4 3 25 6 7 8

© J. Christopher Beck 2008 7 Random Initial Solution ? ? ? ? ? ? ?? 1 4 3 25 6 7 8 “Broken” constraint Cost = # of broken constraints

© J. Christopher Beck 2008 8 What Should We Do Now? Move: Swap two numbers Which two numbers? Randomly pick a pair The pair that will lead to the biggest decrease in cost Cost: number of broken constraints

© J. Christopher Beck 2008 9 What Should We Do Now? Move: Swap two numbers Which two numbers? Randomly pick a pair The pair that will lead to the biggest decrease in cost Cost: number of broken constraints

© J. Christopher Beck 2008 10 Random Initial Solution ? ? ? ? ? ? ?? 1 4 3 25 6 7 8

© J. Christopher Beck 2008 11 Cost Difference Table 12345678 10000-2-3-2 201 -2-3 300000 4000 0 5001 60 0 700 80

© J. Christopher Beck 2008 12 Cost Difference Table 12345678 10000-2-3-2 201 -2-3 300000 4000 0 5001 60 0 700 80

© J. Christopher Beck 2008 13 Current State ? ? ? ? ? ? ?? 1 4 3 25 6 7 8

© J. Christopher Beck 2008 14 Swap 1 & 7: Cost 3 ? ? ? ? ? ? ?? 7 4 3 25 6 1 8

© J. Christopher Beck 2008 15 New Cost Difference Table 12345678 100002030 20020111 30001 1 400111 50120 6000 701 80

© J. Christopher Beck 2008 16 Current State ? ? ? ? ? ? ?? 7 4 3 25 6 1 8

© J. Christopher Beck 2008 17 Swap 3 & 8: Cost 2 ? ? ? ? ? ? ?? 7 4 8 25 6 1 3

© J. Christopher Beck 2008 18 Swap 6 & 7: Cost 1 ? ? ? ? ? ? ?? 6 4 8 25 7 1 3

© J. Christopher Beck 2008 19 Moves Initial State: Cost 6 Swap 1 & 7: Cost 3 Swap 3 & 8: Cost 2 Swap 6 & 7: Cost 1

© J. Christopher Beck 2008 20 Cost Difference Table 12345678 101112211 20122131 30114 12 402131 50212 6011 701 80

© J. Christopher Beck 2008 21 Now what? There are no improving moves to make! So far, we have been “hill- climbing” moves cost

© J. Christopher Beck 2008 22 Tabu Search Idea Local search but: Keep a small list of the moves that are “tabu”: you can’t (un)do them List has a limited length and the oldest entries “fall off” when the list is full

© J. Christopher Beck 2008 23 Tabu Search Start with some (maybe random) initial state Look at the moves in the “neighborhood” and take the best one Remember the last k moves (“tabu list”) so you don’t undo them

© J. Christopher Beck 2008 24 Tabu Search & 1-Machine Example C.5.4, min  w j T j Tabu List Size = 2 Jobs1234 pjpj 10 134 djdj 42112 wjwj 14121 J j, p j, d j, w j J1, 10, 4, 14

© J. Christopher Beck 2008 25 TS Step 1: Find Initial Solution Arbitrarily choose (2, 1, 4, 3) J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12 10 202437 J j, p j, d j, w j

© J. Christopher Beck 2008 26 TS Step 2: Evaluate Neighborhood & Select Move Neighborhood: swap Adjacent pairwise interchange J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 480 J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12  wjTj = 436 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 652 Choose (1,4)

© J. Christopher Beck 2008 27 TS Step 3: Add Move to Tabu List J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12  wjTj = 436 Tabu: ((1, 4)) Best so far: (2, 4, 1, 3): 436

© J. Christopher Beck 2008 28 TS Step 2: Evaluate Neighborhood & Select Move J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 460 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12  wjTj = 500 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 608 Choose (4,2) J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12  wjTj = 436 Tabu: ((1, 4))

© J. Christopher Beck 2008 29 TS Step 3: Add Move to Tabu List Tabu: ((2,4) (1, 4)) J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 460 Best so far: (2, 4, 1, 3): 436

© J. Christopher Beck 2008 30 TS Step 2: Evaluate Neighborhood & Select Move J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 436 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12  wjTj = 440 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 632 Choose (1,2) Tabu: ((2,4) (1, 4)) J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 460

© J. Christopher Beck 2008 31 TS Step 3: Add Move to Tabu List Tabu: ((1,2), (2,4)) J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 440 Best so far: (2, 4, 1, 3): 436

© J. Christopher Beck 2008 32 TS Step 2: Evaluate Neighborhood & Select Move J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 460 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12  wjTj = 408 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 586 Choose (1,4) Tabu: ((1,2), (2,4)) J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 J4, 4, 12, 12  wjTj = 440

© J. Christopher Beck 2008 33 TS Step 3: Add Move to Tabu List Tabu: ((1,4), (1,2))  wjTj = 408 Best so far: (1,4,2,3): 408 J4, 4, 12, 12 J3, 13, 1, 1J1, 10, 4, 14J2, 10, 2, 12 And so on until a bound on the number of iterations (actually 408 is optimal, but TS has no way of knowing)

© J. Christopher Beck 2008 34 Tabu Search Framework Find initial solution (something quick) Until N moves are done Evaluate neighborhood Choose best non-tabu neighbor Update tabu list Return best solution found

© J. Christopher Beck 2008 35 Tabu Search Framework To completely define a TS algorithm, you must define How the initial solution is found Format and length of tabu list How to generate a neighborhood from a given state

© J. Christopher Beck 2008 36 TS & JSP J0 J1 J2 J0 J1 J2

© J. Christopher Beck 2008 37 TS & JSP How might you find a first solution? What could your tabu list format be? Can you define a neighborhood?

© J. Christopher Beck 2008 38 The N1 Neighborhood for JSP J0 J1 J2

© J. Christopher Beck 2008 39 The N1 Neighborhood for JSP J0 J1 J2 Pick a critical path Neighborhood: all swaps on the chosen CP

© J. Christopher Beck 2008 40 Tabu Example JSP Run Tabu on JSP from previous lectures JobsProcessing times 0 J0R0[15]  J0R1[50]  J0R2[60] 1 J1R1[50]  J1R0[50]  J1R2[15] 2 J2R0[30]  J2R1[15]  J2R2[20]