chapter14localsearch.ppt

advertisement
IOE/MFG 543
Chapter 14: General purpose
procedures for scheduling in practice
Section 14.4: Local search (Simulated
annealing and tabu search)
1
Introduction


Constructive vs. improvement type
algorithms
Constructive type
– Construct the schedule by, e.g., adding
one job at the time

Improvement type
– Start with some complete schedule
– Try to obtain a better schedule by
manipulating the current schedule
2
General local search
algorithm

1.
2.
3.
4.
G(S) is the value of the objective under
schedule S
Let k=1. Start with a schedule S1 and let
the best schedule S0=S1
Choose a schedule Sc from the
neighborhood of Sk N(Sk)
If Sc is accepted let Sk+1 = Sc, otherwise let
Sk+1= Sk. If G(Sk+1)<G(S0) let S0=Sk+1
Let k=k+1. Terminate the search if the
stopping criteria are satisfied. Otherwise
return to 2.
3
Local search example
1||SwjTj
Jobs
1
2
3
4
wj
4
5
3
5
pj
dj
12
8
15
9
16
26
25
27
4
Local search example (2)
Schedule representation

Let the vector S=(j1,…,jn) represent
the schedule
– jk=j if j is the kth job in the sequence

Use EDD to construct the initial
schedule
 S1= …

The total weighted tardiness
– Let G(S) be SwjTj under schedule S
=> G(S1)= …
5
Local search example (3)
Neighborhood structure

Manipulating S1
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 N1 and N2
N1(S1)=…

N2(S1)=…

6
Local search example (4)
Choosing Sc


Assume we use N1
Methods for choosing Sc from N1(Sk)
1. Randomly
2. Move the job forward that has the highest
contribution to the objective

Follow rule 2
 Interchange jobs … and …
 Sc = ( , , , )
 G(Sc) =
7
Local search example (5)
Acceptance criteria



Is G(Sc) < G(Sk)?
Should we consider accepting Sc if
G(Sc) ≥ G(Sk) ?
In this example we only accept if we
get an improvement in the objective
8
Local search example (6)
Stopping criteria


Max number of iterations
No or little improvement
– We would terminate the search since we
did not improve the current schedule

Local optimal solution
– No solution S in N(Sk) satisfies
G(S)<G(Sk)
9
Local search example (7)
Continuing

S2=S1=(1,3,2,4)
– Swap 3 and 2 => G(1,2,3,4) = 115

S3=(1,2,3,4)
– Swap 4 and 3 => G(1,2,4,3) = 67

S4=(1,2,4,3)
– Swap 4 and 2 => G(1,4,2,3) = 72

S5=S4
– Swap 2 and 1 => G(2,1,4,3) = 83

STOP and return (1,2,4,3) as the solution
10
Local search example (8)
Total enumeration
j1
j2
j3
j4
1
1
2
4
2
4
1
1
2
4
2
1
2
4
1
1
4
2
2
4
1
2
4
3
4
2
4
2
1
1
3
3
3
3
3
2
3
3
3
3
3
3
4
2
4
1
1
4
SwjTj
67
72
83
92
109
109
115
123
131
131
133
136
j1
j2
j3
j4
2
3
1
3
4
4
2
3
3
4
3
3
3
2
3
4
3
1
3
2
4
3
1
1
4
4
4
2
2
3
1
1
1
1
2
4
1
1
2
1
1
2
4
4
2
2
4
2
SwjTj
137
137
141
142
142
143
161
161
170
170
174
179
11
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
12
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
SA: Avoids getting stuck at a local
minimum by accepting a worse
schedule Sc with probability
G(Sc)-G(Sk)
P(Sk,Sc)= exp(bk
)
13
SA: Temperature
parameter


bk ≥ 0 is the temperature (also called
cooling parameter)
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
– Often, bk=Tak for some .9<a<1 and T>0
14
SA algorithm
1.
2.
Set k=1 and select b1.
Select S1 and set S0=S1.
Select Sc (randomly) from N(Sk).
i.
ii.
iii.
3.
If G(S0)<G(Sc)<G(Sk) set Sk+1=Sc and go to 3
If G(Sc)<G(S0) set S0=Sk+1=Sc and go to 3
If G(Sc)>G(Sk), generate a uniform random number Uk
from a Uniform(0,1) distribution (e.g., rand() in Excel)
If Uk≤P(Sk,Sc), set Sk+1=Sc; otherwise set Sk+1=Sk.
Select bk+1≤ bk.
Set k=k+1.
Stop if stopping criteria are satisfied; otherwise
go to 2.
15
SA example:
1||SwjTj
Jobs
1
2
3
4
wj
4
5
3
5
pj
12
8
15
9
dj
16
26
25
27
16
SA example
Iteration 1


Step 1: S0=S1=(1,3,2,4). G(S1)=136. Let
T=10 and a=.9 => b1=9
Step 2. Select randomly which jobs to swap,
suppose a Uniform(0,1) random number is
V1= .24 => swap first two jobs
– Sc=(3,1,2,4), G(Sc)=174, P(Sk,Sc)=1.5%
– U1=.91 => Reject Sc

Step 3: Let k=2
17
SA example
Iteration 2

Step 2. Select randomly which jobs to
swap, suppose a Uniform(0,1) random
number is V2= .46 => swap 2nd and
3rd jobs
– Sc=(1,2,3,4), G(Sc)=115
=> S3=S0=Sc

Step 3: Let k=3
18
SA example
Iteration 3

Step 2. V3= .88 => swap jobs in 3rd
and 4th position
– Sc=(1,2,4,3), G(Sc)=67
=> S4=S0=Sc

Step 3: Let k=4
19
SA example
Iterations 4 and 5

Step 2: V4= .49 => swap jobs in 2nd and 3rd
position
– Sc=(1,4,2,3), G(Sc)=72, b4=10(.9)4=6.6
– P(Sk,Sc)=47%, U4=.90 => S5=S4


Step 3: Let k=5
Step 2: V5= .11 => swap 1st and 2nd jobs
– Sc=(2,1,4,3), G(Sc)=83, b5=10(.9)5=5.9
– P(Sk,Sc)=7%, U5=.61 => S6=S5


Step 3: Let k=6
Are you bored yet?
20
Tabu (taboo?) search


Tabu search tries to model human
memory processes
A “tabu-list” is maintained throughout
the search
– Moves according to the items on the list
are forbidden
21
Tabu search algorithm
1.
2.
i.
Set k=1. Select S1 and set S0=S1.
Select Sc from N(Sk).
ii.
3.
If the move SkSc is on the tabu list set
Sk+1=Sk and go to 3
If SkSc is not on the tabu list set Sk+1=Sc.
Add the reverse move to the top of the tabu
list and delete the entry on the bottom.
If G(Sc)<G(S0), set S0=Sc.
Set k=k+1.
Stop if stopping criteria are satisfied;
otherwise go to 2.
22
Tabu search example:
1||SwjTj
Jobs
1
2
3
4
wj
4
5
3
5
pj
12
8
15
9
dj
16
26
25
27


Determine Sc by the best schedule in the
neighborhood that is not tabu
Use tabu-list length = 2
– The tabu list is denoted by L
23
Tabu search example
Iteration 1



Step 1: S0=S1=(1,3,2,4). G(S1)=136.
Set L={}.
Step 2. N(S1)= {(3,1,2,4), (1,2,3,4),
(1,3,4,2)} with respective cost = {174,
115, 141} => Sc=S0=S2=(1,2,3,4).
Set L={(3,2)}, i.e., swapping 3 and 2
is not allowed
Step 3: Let k=2
24
Tabu search example
Iteration 2

Step 2.
– N(S2)= {(2,1,3,4), (1,3,2,4), (1,2,4,3)}
– with respective costs = {131, - , 67}
=> Sc=S3=(1,2,4,3)
– Set S0=Sc
– Set L={(3,4),(3,2)}

Step 3: Let k=3
25
Tabu search example
Iteration 3

Step 2
– N(S3)= {(2,1,4,3), (1,4,2,3), (1,2,3,4)}
– with respective costs = {83, 72, -}
=> Sc=S4=(1,4,2,3)
– Set L={(2,4),(3,4)}

Step 3: Let k=4
26
Tabu search example
Iteration 4

Step 2
– N(S4)= {(4,1,2,3), (1,2,4,3), (1,4,3,2)}
– with respective costs = {92, -, 123}
=> Sc=S5=(4,1,2,3)
– Set L={(1,4),(2,4)}

Step 3: Let k=5
27
Tabu search example
Iteration 5

Step 2
– N(S5)= {(1,4,2,3), (4,2,1,3), (4,1,3,2)}
– with respective costs = {-, 109, 143}
=> Sc=S6=(4,2,1,3)
– Set L={(2,1),(4,1)}

Step 3: Let k=6
28
Download