chapter14ga.ppt

advertisement
IOE/MFG 543
Chapter 14: General purpose
procedures for scheduling in practice
Section 14.5: Local search – Genetic
Algorithms
1
Genetic Algorithms


Keep a population (or a generation) of
solutions
Selected members of the population
survive and reproduce offspring
– The offspring inherit characteristics from
both parents
– A mutation can occur such that the
offspring has a feature that neither
parent has
2
Minimization of x2 via a
simple GA

Gene representation of an individual
– Use binary encoding, e.g.,
I=1000100111=29+25+22+21+20=551
– 10 binary digits => I {0,1,…,1023}
– Suppose we know x[-2,2]
 Let

x=(I-512)/256 => x[-2,1.996]
Fitness of an individual
F(x)=1/(1+x2)
3
Simple GA (1)
Initial population


Use a population size of 10
Randomly generate 10 individuals
10
1 0
2 0
3 0
4 1
5 1
6 1
7 1
8 0
9 0
10 1
9
0
0
0
0
0
1
0
1
1
1
8
1
0
1
0
1
0
1
0
0
1
7
0
1
1
1
1
1
0
0
0
0
Bit
6 5
1 0
1 1
1 0
0 1
0 0
1 1
0 0
0 0
1 0
1 0
4
0
0
1
1
0
1
0
0
1
1
3
1
1
0
1
0
0
0
1
0
1
2
1
1
0
1
1
0
1
1
1
1
1
0
1
1
1
1
0
0
0
0
1
I
166
119
233
607
707
888
642
262
298
943
x
-1.35
-1.54
-1.09
0.37
0.76
1.47
0.51
-0.98
-0.84
1.68
F(x)
0.35
0.30
0.46
0.88
0.63
0.32
0.79
0.51
0.59
0.26
5.09
4
Simple GA (2)
Choosing the parents
F(x)
P
SP
U
Pick
1
0.35
0.07
0.069
0.192
3
2
0.30
0.06
0.128
0.654
7
3
0.46
0.09
0.218
0.264
4
4
0.88
0.17
0.390
0.384
4
5
0.63
0.12
0.514
0.853
9
6
0.32
0.06
0.577
0.957
10
7
0.79
0.16
0.733
0.886
9
8
0.51
0.10
0.833
0.540
6
9
0.59
0.12
0.949
0.043
1
0
0.26
0.05
1.000
0.092
2
5.09
5
Simple GA (3)
Crossover
Parent
3
7
4
4
9
10
9
6
1
2
0
1
1
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
0
1
0
0
1
0
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
1
1
1
1
1
0
0
1
1
0
0
0
1
0
1
1
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
0
0
1
1
0
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
0
0
1
Bits
1
2
2
6
5
6
Simple GA (4)
Offspring
1
2
3
4
5
6
7
8
9
10
1
0
1
1
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
1
0
1
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
0
0
1
1
0
0
1
0
0
1
1
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
0
0
1
1
0
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
0
0
1
7
Simple GA (5)
Mutation

Change each bit with probability
pm=0.05
1
2
3
4
5
6
7
8
9
10
1
0
1
1
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
1
0
1
1
1
0
0
1
1
0
0
1
0
0
1
1
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
0
1
1
8
Simple GA (6)
Second generation
1
2
3
4
5
6
7
8
9
10
1
0
1
1
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
1
0
1
1
1
0
0
1
1
0
0
1
0
0
1
1
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
0
1
1
I
745
130
607
543
810
431
862
296
103
183
x
0.91
-1.49
0.37
0.12
1.16
-0.32
1.37
-0.84
-1.60
-1.29
F(x)
0.55
0.31
0.88
0.99
0.42
0.91
0.35
0.58
0.28
0.38
5.69
9
GA and
scheduling

Encoding of a sequence
– Easier to use job numbers than bits


Mutation can be done by an interchange of
two jobs
A crossover can lead to an infeasible
sequence
1-2-3-4-5 gives
5-4-3-2-1
– repair
– random keys
– other methods
1-2-3-2-1 and
5-4-3-4-5
10
Random keys
(see Bean, 1994)


Generate n U(0,1) random numbers for
each parent
Example
– Generate .29, .96, .17, .84 and .49
– P1=(.29,.96,.17,.84,.49)=(4,1,5,2,3)
– P2=(.73,.14,.43,.54,.38)=(5,1,3,2,4)
(.29,.96,.17,.84,.49) gives
(.29,.96,.17,.54,.38)
(.73,.14,.43,.54,.38)
(.73,.14,.43,.84,.49)
– C1=(4,1,5,2,4)
C2=(2,5,4,1,3)
11
GA example:
1||SwjTj
Jobs
1
2
3
4
wj
4
5
3
5
pj
12
8
15
9
dj
16
26
25
27


Use random keys and population size 6
Fitness = 1/wjTj
12
GA example
Initial population
1
2
3
4
5
6
0.206
0.646
0.682
0.26
0.653
0.661
1
2
3
4
5
6
Random keys
0.781 0.32
0.901 0.218
0.688 0.089
0.258 0.279
0.828 0.281
0.528 0.75
Fitness
0.008
0.006
0.007
0.007
0.008
0.006
0.041
P
0.182
0.135
0.177
0.171
0.185
0.150
0.864
0.749
0.893
0.835
0.24
0.311
4
3
3
3
2
2
C
0.182
0.317
0.494
0.665
0.850
1.000
Sequence
2
3
1
4
2
4
4
2
1
3
3
1
U
0.195
0.350
0.719
0.309
0.808
0.360
1
2
1
1
4
4
wjTj
133
179
137
142
131
161
Select
2
3
5
2
5
3
13
GA example
Crossover and mutation
2
Parents
Swap at
0.646 0.901 0.218 0.749
3
Mutation
0 0 0 0
3
5
0.682 0.688 0.089 0.893
0.653 0.828 0.281 0.24
4
0
0
0
0
1
0
1
0
2
5
0.646 0.901 0.218 0.749
0.653 0.828 0.281 0.24
4
0
0
0
0
0
0
0
0
3
0.682 0.688 0.089 0.893
0
0
0
0
14
GA example
Generation 2
1
2
3
4
5
6


Random keys
0.646 0.901 0.218
0.682 0.688 0.439
0.653 0.828 0.281
0.646 0.901 0.218
0.653 0.828 0.281
0.682 0.688 0.089
0.893
0.317
0.24
0.749
0.24
0.893
3
2
2
3
2
3
Sequence
1
1
1
1
1
2
4
3
3
4
3
4
2
4
4
2
4
1
wjTj Fitness
179 0.006
131 0.008
131 0.008
179 0.006
131 0.008
137 0.007
0.041
Very little improvement and the population
is converging!?
Instead of mutation do immigration
– Replace an individual with a new randomly
generated individual
15
GA algorithm
1.
2.
Generate an initial population
Evaluate the fitness and select
individuals for reproduction

3.
Generate new individuals

4.
Randomly, always keep the best few?
Crossover, mutation, immigration
Stop of stopping criteria are satisfied.
Otherwise go to 2
16
GA design criteria




Schedule representation
Population size
Fitness function
Selection procedure
– Probability based on fitness or ranking
– Tournament


Crossover, mutation and immigration
probability
Stopping criteria
17
Download