You are on page 1of 14

Local Search

 Local search algorithms try to improve a given solution by modifying it

 Constructive Algorithms
 Improvement Algorithms

 Need to specify:

1. How to modify a solution (neighborhood of a solution)


2. How to search the neighborhood
3. Which solutions to select

 Given
 A solution x
 Modification rule R ( y=R(x) )

 Neighborhood of x: Set of all solutions that can be obtained by modifying x


with respect to R
 N(x) ={y: y=R(x)}
Example 1: Single machine, minimize total weighted tardiness

Jobs 1 2 3 4
wj 4 5 3 5
pj 12 8 15 9
dj 16 26 25 27

 Construct a solution by EDD heuristic:

1 3 2 4
12 27 35 44
0
Jobs Cj dj Tj wj wj Tj
1 12 16 4
2 35 26 5
3 27 25 3
4 44 27 5
j wj Tj=

 How do you modify this solution to decrease weighted tardiness?

1) Pairwise adjacent interchange: interchange 2 and 4 in the sequence

1 3 4 2
12 27 36 44
0
Jobs Cj dj Tj wj wj Tj
1 12 16 4
2 44 26 5
3 27 25 3
4 36 27 5
j wj Tj=
2) Change position of a job in the sequence:

Let job 4 be the 2nd job in the sequence

1 4 3 2
12 21 36 44

Jobs Cj dj Tj wj wj Tj
1 12 16 4
2 44 26 5
3 36 25 3
4 21 27 5
j wj Tj=

 Neighborhood of solution 1-3-2-4 with respect to Rule 1)

Size:

 Neighborhood of solution 1-3-2-4 with respect to Rule 2)

Size:
Neighborhood of a Job Shop Schedule:

 Job shop problem, minimize makespan

 Operation (i,j) : Operation of job j on machine i

 Critical path in a schedule consists of operations O1,O2,


…,Ok such that:

 Completion time of an operation Oi = Start time of the next


operation Oi+1 on the path
 The first operation on the path, O1, starts at t=0
 The last operation on the path, O1, ends at t=Cmax

Rule 1) Interchange a pair of adjacent operations on the critical


path

Note: Operations must be on the same machine and belong to


different jobs

Rule 2) One step look-back interchange:

1. Let (i,j) and (i,k) be adjacent operations on the critical path


2. Interchange (i,j) and (i,k) on machine i
3. Let (h,k) be the immediate predecessor of (i,k) for job k
4. Let (h,l) be the immediate predecessor operation of (h,k) on
machine h
5. Interchange (h,k) and (h,l) on machine h

Example 2: Job shop, 3 machines, 3 jobs, minimize makespan

Jobs Machine Sequence Processing Times


1 1,2,3 p11=5, p21=10, p31=4
2 3,1,2 p12=5, p22=8, p32=4
3 3,2,1 p13=7, p23=3, p33=5
MC 1 1 2 3

MC 2 3 2 1

MC 3 3 2 1

10 30 37
20
0 0 0
0
Makespan = 37

Apply Rule 1: Interchange (2,2) and (2,1)

MC 1 1 2 3

MC 2 3 1 2

MC 3 3 2 1

10 20 28 30
0 0 0 0
Makespan = 28

Apply Rule 2:

1. Interchange (1,1) and (1,2)

MC 1 2 1 3

MC 2 3 2 1

MC 3 3 2 1

10 20 30 36
0 0 0 0
Makespan = 36
1. Interchange (3,3) and (3,2)

MC 1 2 1 3

MC 2 3 2 1

MC 3 2 3 1

10 20 30 34
0 0 0 0
Makespan = 34

Local Search Algorithm

Notation:

At iteration k,
Sk : Current schedule
S0 : Best schedule so far
G(Sk ): Objective function value of schedule Sk
G(S0 ): Aspiration criterion

Initialize: Pick a starting schedule S1, set S0 = S1


Iteration k:
Select a candidate schedule from the neighborhood of Sk
[SPECIFY A RULE]
If G(Sc ) < G(Sk ), set Sk+1 = Sc
If G(Sc ) < G(S0 ), set S0 = Sc
If G(Sc ) >= G(Sk ), DECIDE TO MOVE TO Sc OR NOT

Repeat until STOPPING CRITERIA


Simulated Annealing
 Accepting or rejecting a move is decided probabilistically
 At the first iterations, “bad” moves are likely to be accepted
 In later iterations, “bad” moves are less likely to be
accepted

If G(Sc ) >= G(Sk ), move to Sc with probability

 G( S k )  G( S c ) 
P( Sk , Sc )  exp  
 k 

and with probability 1-P(Sk,Sc), reject Sc

where 1 >= 2 >= 3 >= … > 0 are cooling parameters

(usually k =ak for some a, 0 < a < 1 )

NOTE:
1. As  decreases, probability of acceptance also decreases
2. If G(Sc ) is much larger than G(Sk ), the acceptance
probability is small

STOPPING CRITERIA:

1. Stop at a give number of iterations OR


2. Stop when no improvement is obtained for a given number
of iterations
Tabu Search
 Decision to accept/reject a move is deterministic
 At each iteration a tabu-list of fixed size is kept
 Every time a move is made,
the reverse move is entered to the top of the tabu-list and
the bottom entry is deleted
 Tradeoff: small list => cycling may occur
large list => search is restricted

Example 3: Single machine, minimize total weighted tardiness

Jobs 1 2 3 4
pj 10 10 13 4
dj 4 2 1 12
wj 14 12 1 12

Move: adjacent pairwise interchanges


Tabu-list: pairs swapped within last two moves

Initialize: S1= 2-1-4-3, G(S1) = 500, S0= S1, Tabu-list is empty

k=2: Neighbors of S1:

Sequence 1-2-4-3 2-4-1-3 2-1-3-4


wjTj 480 436 652
Tabu No no no

Pick S2 = 2-4-1-3, S0= S2, G(S0)=436, Tabu={(1,4)}

k=3: Neighbors of S2:

Sequence 4-2-1-3 2-1-4-3 2-4-3-1


wjTj 460 500 608
Tabu No yes no

Pick S3 = 4-2-1-3, S0= S2, G(S0)=436,


Tabu={(2,4),(1,4)}
k=4: Neighbors of S3=4-2-1-3:

Sequence 2-4-1-3 4-1-2-3 4-2-3-1


wjTj 436 440 632
Tabu Yes No No

Pick S4 = 4-1-2-3, S0= S2, G(S0)=436,


Tabu={(1,2),(2,4)}

k=5: Neighbors of S4 = 4-1-2-3:

Sequence 1-4-2-3 4-2-1-3 4-1-3-2


wjTj 408 460 586
Tabu No yes no

Pick S5 = 1-4-2-3, S0= S4, G(S0)=408,


Tabu={(1,4),(1,2)}

The iterations continue until the stopping criteria: no more


moves are available or a preset maximum iterations is reached
Genetic Algorithms
WHAT IS DIFFERENT?

 Keeps a population of solutions:


At each iteration, a number of schedules are generated and
carried to the next step

WHY USE GENETIC ALGORITHMS?

 Traditional search methods


 require detailed knowledge of the problem being solved
 It is difficult to search ill-behaved solution spaces

 Genetic algorithms
 require less domain knowledge
 deal with codings instead of variables

HOW GENETIC ALGORITHMS WORK

 Simulates the natural evolutionary process


 Every individual (solution) in the population has a fitness (based
on objective value)
 In each generation (iteration), the most fit individuals (best
solutions) are allowed to produce children (new solutions)
 Takes the best features of each parent (crossover) or mutates
features of a single parent (to create the neighborhood of the
population)
 The most fit individuals reproduce; the least fit die

BASIC ELEMENTS:

 Representation
 Genetic Operators
 Selection and Evolution
 Termination
 Parameters Settings
Genetic Operators

Reproduction:
 Duplicates complete strings from the individuals already in
the population
 Based on fitness (evaluating functions), the ones with higher
values have higher probability to be duplicated

Crossover:
 Chooses two parents and exchanges the sub-string within
them
 There are many variations of this operator, such as one point,
n-points and uniform crossover

Selection and Evolution

 Decides which individuals survive to make up the next


generation, based mostly on fitness function

Parameter Settings

Population size, crossover rate, and mutation rate (For example,


high mutation rate will result in almost random search behavior)

Example 4: Single machine, minimize total weighted tardiness,


data of Example 3

Rules:
 Fitness = total weighted tardiness population size = 4
 At a generation, get 2 children from the two best schedules by
pairwise adjacent interchange
 Two worst schedules die

Initial population:

Sequence 2-1-4-3 4-1-3-2 3-1-4-2 4-2-1-3


wjTj 500 586 878 460

Keep 2-1-4-3 and 4-2-1-3, obtain 1-2-4-3 and 2-4-1-3 by interchanges


Population at iteration 2:

Sequence 2-1-4-3 1-2-4-3 2-4-1-3 4-2-1-3


wjTj 500 480 436 460

Keep 2-4-1-3 and 4-2-1-3, obtain 2-1-4-3 and 4-1-2-3 by interchanges

Population at iteration 3:

Sequence 2-1-4-3 4-1-2-3 2-4-1-3 4-2-1-3


wjTj 500 440 436 460
DISKUSI
&
TANYA JAWAB

You might also like