1 IOE/MFG 543 Chapter 14: General purpose procedures for scheduling in practice Section 14.4: Local search (Simulated annealing and tabu search)
2 Introduction Constructive vs. improvement type algorithms Constructive vs. improvement type algorithms Constructive type Constructive type –Construct the schedule by, e.g., adding one job at the time Improvement type Improvement type –Start with some complete schedule –Try to obtain a better schedule by manipulating the current schedule
3 General local search algorithm G(S) is the value of the objective under schedule S G(S) is the value of the objective under schedule S 1.Let k=1. Start with a schedule S 1 and let the best schedule S 0 =S 1 2.Choose a schedule S c from the neighborhood of S k N(S k ) 3.If S c is accepted let S k+1 = S c, otherwise let S k+1 = S k. If G(S k+1 )<G(S 0 ) let S 0 =S k+1 4.Let k=k+1. Terminate the search if the stopping criteria are satisfied. Otherwise return to 2.
4 Local search example 1|| w j T j Jobs1234 wjwj 4535 pjpj djdj
5 Local search example (2) Schedule representation Let the vector S=(j 1,…,j n ) represent the schedule Let the vector S=(j 1,…,j n ) represent the schedule –j k =j if j is the kth job in the sequence Use EDD to construct the initial schedule Use EDD to construct the initial schedule S 1 = … The total weighted tardiness The total weighted tardiness –Let G(S) be w j T j under schedule S => G(S 1 )= …
6 Local search example (3) Neighborhood structure Manipulating S 1 Manipulating S 1 1.Pairwise adjacent interchange 2.Try to move a job to a different location in the sequence Rules 1 and 2 above define two types of neighborhoods N 1 and N 2 Rules 1 and 2 above define two types of neighborhoods N 1 and N 2 N 1 (S 1 )=… N 1 (S 1 )=… N 2 (S 1 )=… N 2 (S 1 )=…
7 Local search example (4) Choosing S c Assume we use N 1 Assume we use N 1 Methods for choosing S c from N 1 (S k ) Methods for choosing S c from N 1 (S k ) 1.Randomly 2.Move the job forward that has the highest contribution to the objective Follow rule 2 Follow rule 2 Interchange jobs … and … S c = (,,, ) G(S c ) =
8 Local search example (5) Acceptance criteria Is G(S c ) < G(S k )? Is G(S c ) < G(S k )? Should we consider accepting S c if G(S c ) ≥ G(S k ) ? Should we consider accepting S c if G(S c ) ≥ G(S k ) ? In this example we only accept if we get an improvement in the objective In this example we only accept if we get an improvement in the objective
9 Local search example (6) Stopping criteria Max number of iterations Max number of iterations No or little improvement No or little improvement –We would terminate the search since we did not improve the current schedule Local optimal solution Local optimal solution –No solution S in N(S k ) satisfies G(S)<G(S k )
10 Local search example (7) Continuing S 2 =S 1 =(1,3,2,4) S 2 =S 1 =(1,3,2,4) –Swap 3 and 2 => G(1,2,3,4) = 115 S 3 =(1,2,3,4) S 3 =(1,2,3,4) –Swap 4 and 3 => G(1,2,4,3) = 67 S 4 =(1,2,4,3) S 4 =(1,2,4,3) –Swap 4 and 2 => G(1,4,2,3) = 72 S 5 =S 4 S 5 =S 4 –Swap 2 and 1 => G(2,1,4,3) = 83 STOP and return (1,2,4,3) as the solution STOP and return (1,2,4,3) as the solution
11 Local search example (8) Total enumeration j1j1 j2j2 j3j3 j4j4 wjTjwjTj j1j1 j2j2 j3j3 j4j4 wjTjwjTj
12 Local search Design criteria i.The representation of the schedule ii.The design of the neighborhood iii.The search process within the neighborhood iv.The acceptance-rejection criteria v.Stopping criteria
13 Simulated Annealing (SA) Annealing: Heating of a material (metal) to a high temperature and then cooling it at a certain rate to achieve a desired crystalline structure Annealing: Heating of a material (metal) to a high temperature and then cooling it at a certain rate to achieve a desired crystalline structure SA: Avoids getting stuck at a local minimum by accepting a worse schedule S c with probability SA: Avoids getting stuck at a local minimum by accepting a worse schedule S c with probability P(S k,S c )= exp ( - G(S c )-G(S k ) ) kkkk
14 SA: Temperature parameter k ≥ 0 is the temperature (also called cooling parameter) k ≥ 0 is the temperature (also called cooling parameter) Initially the temperature is high making moves to a worse schedule more likely Initially the temperature is high making moves to a worse schedule more likely ~50% chance of accepting a slightly worse schedule seems to work well As the temperature decreases the probability of accepting a worse schedule decreases As the temperature decreases the probability of accepting a worse schedule decreases –Often, k =Ta k for some.9 0
15 SA algorithm 1.Set k=1 and select 1. Select S 1 and set S 0 =S 1. 2.Select S c (randomly) from N(S k ). i.If G(S 0 )<G(S c )<G(S k ) set S k+1 =S c and go to 3 ii.If G(S c )<G(S 0 ) set S 0 =S k+1 =S c and go to 3 iii.If G(S c )>G(S k ), generate a uniform random number U k from a Uniform(0,1) distribution (e.g., rand() in Excel) If U k ≤P(S k,S c ), set S k+1 =S c ; otherwise set S k+1 =S k. 3.Select k+1 ≤ k. Set k=k+1. Stop if stopping criteria are satisfied; otherwise go to 2.
16 SA example: 1|| w j T j Jobs1234 wjwj 4535 pjpj djdj
17 SA example Iteration 1 Step 1: S 0 =S 1 =(1,3,2,4). G(S 1 )=136. Let T=10 and a=.9 => 1 =9 Step 1: S 0 =S 1 =(1,3,2,4). G(S 1 )=136. Let T=10 and a=.9 => 1 =9 Step 2. Select randomly which jobs to swap, suppose a Uniform(0,1) random number is V 1 =.24 => swap first two jobs Step 2. Select randomly which jobs to swap, suppose a Uniform(0,1) random number is V 1 =.24 => swap first two jobs –Sc=(3,1,2,4), G(S c )=174, P(S k,S c )=1.5% –U 1 =.91 => Reject S c Step 3: Let k=2 Step 3: Let k=2
18 SA example Iteration 2 Step 2. Select randomly which jobs to swap, suppose a Uniform(0,1) random number is V 2 =.46 => swap 2 nd and 3 rd jobs Step 2. Select randomly which jobs to swap, suppose a Uniform(0,1) random number is V 2 =.46 => swap 2 nd and 3 rd jobs –Sc=(1,2,3,4), G(S c )=115 => S 3 =S 0 =S c Step 3: Let k=3 Step 3: Let k=3
19 SA example Iteration 3 Step 2. V 3 =.88 => swap jobs in 3 rd and 4 th position Step 2. V 3 =.88 => swap jobs in 3 rd and 4 th position –Sc=(1,2,4,3), G(S c )=67 => S 4 =S 0 =S c Step 3: Let k=4 Step 3: Let k=4
20 SA example Iterations 4 and 5 Step 2: V 4 =.49 => swap jobs in 2 nd and 3 rd position Step 2: V 4 =.49 => swap jobs in 2 nd and 3 rd position –S c =(1,4,2,3), G(S c )=72, 4 =10(.9) 4 =6.6 –P(S k,S c )=47%, U 4 =.90 => S 5 =S 4 Step 3: Let k=5 Step 3: Let k=5 Step 2: V 5 =.11 => swap 1 st and 2 nd jobs Step 2: V 5 =.11 => swap 1 st and 2 nd jobs –S c =(2,1,4,3), G(S c )=83, 5 =10(.9) 5 =5.9 –P(S k,S c )=7%, U 5 =.61 => S 6 =S 5 Step 3: Let k=6 Step 3: Let k=6 Are you bored yet? Are you bored yet?
21 Tabu (taboo?) search Tabu search tries to model human memory processes Tabu search tries to model human memory processes A “tabu-list” is maintained throughout the search A “tabu-list” is maintained throughout the search –Moves according to the items on the list are forbidden
22 Tabu search algorithm 1.Set k=1. Select S 1 and set S 0 =S 1. 2.Select S c from N(S k ). i.If the move S k S c is on the tabu list set S k+1 =S k and go to 3 ii.If S k S c is not on the tabu list set S k+1 =S c. Add the reverse move to the top of the tabu list and delete the entry on the bottom. If G(S c )<G(S 0 ), set S 0 =S c. 3.Set k=k+1. Stop if stopping criteria are satisfied; otherwise go to 2.
23 Tabu search example: 1|| w j T j Jobs1234 wjwj 4535 pjpj djdj Determine S c by the best schedule in the neighborhood that is not tabu Determine S c by the best schedule in the neighborhood that is not tabu Use tabu-list length = 2 Use tabu-list length = 2 –The tabu list is denoted by L
24 Tabu search example Iteration 1 Step 1: S 0 =S 1 =(1,3,2,4). G(S 1 )=136. Set L={}. Step 1: S 0 =S 1 =(1,3,2,4). G(S 1 )=136. Set L={}. Step 2. N(S 1 )= {(3,1,2,4), (1,2,3,4), (1,3,4,2)} with respective cost = {174, 115, 141} => S c =S 0 =S 2 =(1,2,3,4). Set L={(3,2)}, i.e., swapping 3 and 2 is not allowed Step 2. N(S 1 )= {(3,1,2,4), (1,2,3,4), (1,3,4,2)} with respective cost = {174, 115, 141} => S c =S 0 =S 2 =(1,2,3,4). Set L={(3,2)}, i.e., swapping 3 and 2 is not allowed Step 3: Let k=2 Step 3: Let k=2
25 Tabu search example Iteration 2 Step 2. Step 2. –N(S 2 )= {(2,1,3,4), (1,3,2,4), (1,2,4,3)} –with respective costs = {131, -, 67} => S c =S 3 =(1,2,4,3) –Set S 0 =S c –Set L={(3,4),(3,2)} Step 3: Let k=3 Step 3: Let k=3
26 Tabu search example Iteration 3 Step 2 Step 2 –N(S 3 )= {(2,1,4,3), (1,4,2,3), (1,2,3,4)} –with respective costs = {83, 72, -} => S c =S 4 =(1,4,2,3) –Set L={(2,4),(3,4)} Step 3: Let k=4 Step 3: Let k=4
27 Tabu search example Iteration 4 Step 2 Step 2 –N(S 4 )= {(4,1,2,3), (1,2,4,3), (1,4,3,2)} –with respective costs = {92, -, 123} => S c =S 5 =(4,1,2,3) –Set L={(1,4),(2,4)} Step 3: Let k=5 Step 3: Let k=5
28 Tabu search example Iteration 5 Step 2 Step 2 –N(S 5 )= {(1,4,2,3), (4,2,1,3), (4,1,3,2)} –with respective costs = {-, 109, 143} => S c =S 6 =(4,2,1,3) –Set L={(2,1),(4,1)} Step 3: Let k=6 Step 3: Let k=6