1 IOE/MFG 543 Chapter 14: General purpose procedures for scheduling in practice Section 14.5: Local...
-
date post
19-Dec-2015 -
Category
Documents
-
view
224 -
download
4
Transcript of 1 IOE/MFG 543 Chapter 14: General purpose procedures for scheduling in practice Section 14.5: Local...
11
IOE/MFG 543IOE/MFG 543
Chapter 14: General purpose Chapter 14: General purpose procedures for scheduling in procedures for scheduling in practicepracticeSection 14.5: Local search – Section 14.5: Local search – Genetic AlgorithmsGenetic Algorithms
22
Genetic AlgorithmsGenetic Algorithms
Keep a Keep a population population (or a (or a generation) of solutionsgeneration) of solutions
Selected members of the Selected members of the population population survivesurvive and and reproduce reproduce offspringoffspring– The offspring inherit characteristics The offspring inherit characteristics
from both parentsfrom both parents– A A mutationmutation can occur such that the can occur such that the
offspring has a feature that neither offspring has a feature that neither parent hasparent has
33
Minimization of xMinimization of x2 2 via a via a simple GAsimple GA Gene representation of an Gene representation of an
individualindividual– Use binary encoding, e.g., Use binary encoding, e.g.,
I=1000100111=2I=1000100111=299+2+255+2+222+2+211+2+200=551=551– 10 binary digits => I 10 binary digits => I {0,1,…,1023} {0,1,…,1023} – Suppose we know xSuppose we know x[-2,2][-2,2]
Let x=(I-512)/256 => xLet x=(I-512)/256 => x[-2,1.996][-2,1.996]
Fitness of an individualFitness of an individualF(x)=1/(1+xF(x)=1/(1+x22))
44
Simple GA (1)Simple GA (1)Initial populationInitial population Use a population size of 10Use a population size of 10 Randomly generate 10 individualsRandomly generate 10 individuals
Bit10 9 8 7 6 5 4 3 2 1 I x F(x)
1 0 0 1 0 1 0 0 1 1 0 166 -1.35 0.352 0 0 0 1 1 1 0 1 1 1 119 -1.54 0.303 0 0 1 1 1 0 1 0 0 1 233 -1.09 0.464 1 0 0 1 0 1 1 1 1 1 607 0.37 0.885 1 0 1 1 0 0 0 0 1 1 707 0.76 0.636 1 1 0 1 1 1 1 0 0 0 888 1.47 0.327 1 0 1 0 0 0 0 0 1 0 642 0.51 0.798 0 1 0 0 0 0 0 1 1 0 262 -0.98 0.519 0 1 0 0 1 0 1 0 1 0 298 -0.84 0.59
10 1 1 1 0 1 0 1 1 1 1 943 1.68 0.265.09
55
Simple GA (2)Simple GA (2)Choosing the parentsChoosing the parents
F(x) P P 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
66
Simple GA (3)Simple GA (3)CrossoverCrossover
ParenParentt Bits3 0 0 1 1 1 0 1 0 0 1 17 1 0 1 0 0 0 0 0 1 04 1 0 0 1 0 1 1 1 1 1 24 1 0 0 1 0 1 1 1 1 19 0 1 0 0 1 0 1 0 1 0 2
10 1 1 1 0 1 0 1 1 1 19 0 1 0 0 1 0 1 0 1 0 66 1 1 0 1 1 1 1 0 0 01 0 0 1 0 1 0 0 1 1 0 52 0 0 0 1 1 1 0 1 1 1
77
Simple GA (4)Simple GA (4)OffspringOffspring
1 1 0 1 1 1 0 1 0 0 12 0 0 1 0 0 0 0 0 1 03 1 0 0 1 0 1 1 1 1 14 1 0 0 1 0 1 1 1 1 15 1 1 0 0 1 0 1 0 1 06 0 1 1 0 1 0 1 1 1 17 1 1 0 1 1 1 1 0 1 08 0 1 0 0 1 0 1 0 0 09 0 0 0 1 1 0 0 1 1 0
10 0 0 1 0 1 1 0 1 1 1
88
Simple GA (5)Simple GA (5)MutationMutation Change each bit with probability Change each bit with probability
ppmm=0.05 =0.05 1 1 0 1 1 1 0 1 0 0 12 0 0 1 0 0 0 0 0 1 03 1 0 0 1 0 1 1 1 1 14 1 0 0 0 0 1 1 1 1 15 1 1 0 0 1 0 1 0 1 06 0 1 1 0 1 0 1 1 1 17 1 1 0 1 0 1 1 1 1 08 0 1 0 0 1 0 1 0 0 09 0 0 0 1 1 0 0 1 1 1
10 0 0 1 0 1 1 0 1 1 1
99
Simple GA (6)Simple GA (6)Second generationSecond generation
I x F(x)1 1 0 1 1 1 0 1 0 0 1 745 0.91 0.552 0 0 1 0 0 0 0 0 1 0 130 -1.49 0.313 1 0 0 1 0 1 1 1 1 1 607 0.37 0.884 1 0 0 0 0 1 1 1 1 1 543 0.12 0.995 1 1 0 0 1 0 1 0 1 0 810 1.16 0.426 0 1 1 0 1 0 1 1 1 1 431 -0.32 0.917 1 1 0 1 0 1 1 1 1 0 862 1.37 0.358 0 1 0 0 1 0 1 0 0 0 296 -0.84 0.589 0 0 0 1 1 0 0 1 1 1 103 -1.60 0.28
10 0 0 1 0 1 1 0 1 1 1 183 -1.29 0.385.69
1010
GA and GA and schedulingscheduling Encoding of a sequenceEncoding of a sequence
– Easier to use job numbers than bitsEasier to use job numbers than bits Mutation can be done by an Mutation can be done by an
interchange of two jobsinterchange of two jobs A crossover can lead to an infeasible A crossover can lead to an infeasible
sequencesequence1-2-3-4-5 gives1-2-3-4-5 gives 1-2-3-2-1 and1-2-3-2-1 and5-4-3-2-1 5-4-3-2-1 5-4-3-4-55-4-3-4-5– repairrepair– random keysrandom keys– other methodsother methods
1111
Random keys Random keys (see Bean, 1994)(see Bean, 1994) Generate n U(0,1) random numbers for Generate n U(0,1) random numbers for
each parenteach parent ExampleExample
– Generate .29, .96, .17, .84 and .49Generate .29, .96, .17, .84 and .49
– PP11=(.29,.96,.17,.84,.49)=(4,1,5,2,3)=(.29,.96,.17,.84,.49)=(4,1,5,2,3)
– PP22=(.73,.14,.43,.54,.38)=(5,1,3,2,4)=(.73,.14,.43,.54,.38)=(5,1,3,2,4)
(.29,.96,.17,.84,.49) gives(.29,.96,.17,.84,.49) gives(.29,.96,.17,.54,.38)(.29,.96,.17,.54,.38)
(.73,.14,.43,.54,.38) (.73,.14,.43,.54,.38) (.73,.14,.43,.84,.49)(.73,.14,.43,.84,.49)
– CC11=(4,1,5,2,4) C=(4,1,5,2,4) C22=(2,5,4,1,3)=(2,5,4,1,3)
1212
GA example:GA example:1||1||wwjjTTjj
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 6Use random keys and population size 6 Fitness = 1/wFitness = 1/wjjTTjj
1313
GA exampleGA exampleInitial populationInitial population
Random keysRandom keys SequenceSequence wjTj
1 0.206 0.781 0.32 0.864 4 2 3 1 1332 0.646 0.901 0.218 0.749 3 1 4 2 1793 0.682 0.688 0.089 0.893 3 2 4 1 1374 0.26 0.258 0.279 0.835 3 4 2 1 1425 0.653 0.828 0.281 0.24 2 1 3 4 1316 0.661 0.528 0.75 0.311 2 3 1 4 161
Fitness P CC U SelectSelect1 0.008 0.182 0.182 0.195 22 0.006 0.135 0.317 0.350 33 0.007 0.177 0.494 0.719 54 0.007 0.171 0.665 0.309 25 0.008 0.185 0.850 0.808 56 0.006 0.150 1.000 0.360 3
0.041
1414
GA exampleGA exampleCrossover and Crossover and mutationmutation
Parents Swap at Mutation2 0.646 0.901 0.218 0.749 3 0 0 0 0
3 0.682 0.688 0.089 0.893 0 0 1 15 0.653 0.828 0.281 0.24 4 0 0 0 0
2 0.646 0.901 0.218 0.749 0 0 0 05 0.653 0.828 0.281 0.24 4 0 0 0 0
3 0.682 0.688 0.089 0.893 0 0 0 0
1515
GA exampleGA exampleGeneration 2Generation 2
Very little improvement and the Very little improvement and the population is converging!?population is converging!?
Instead of mutation do Instead of mutation do immigrationimmigration– Replace an individual with a new randomly Replace an individual with a new randomly
generated individualgenerated individual
Random keysRandom keys SequenceSequence wjTj Fitness1 0.646 0.901 0.218 0.893 3 1 4 2 179 0.0062 0.682 0.688 0.439 0.317 2 1 3 4 131 0.0083 0.653 0.828 0.281 0.24 2 1 3 4 131 0.0084 0.646 0.901 0.218 0.749 3 1 4 2 179 0.0065 0.653 0.828 0.281 0.24 2 1 3 4 131 0.0086 0.682 0.688 0.089 0.893 3 2 4 1 137 0.007
0.041
1616
GA algorithmGA algorithm
1.1. Generate an initial populationGenerate an initial population2.2. Evaluate the fitness and select Evaluate the fitness and select
individuals for reproductionindividuals for reproduction Randomly, always keep the best few?Randomly, always keep the best few?
3.3. Generate new individualsGenerate new individuals Crossover, mutation, immigrationCrossover, mutation, immigration
4.4. Stop of stopping criteria are Stop of stopping criteria are satisfied. Otherwise go to 2satisfied. Otherwise go to 2
1717
GA design criteriaGA design criteria
Schedule representationSchedule representation Population sizePopulation size Fitness functionFitness function Selection procedureSelection procedure
– Probability based on fitness or rankingProbability based on fitness or ranking– TournamentTournament
Crossover, mutation and immigration Crossover, mutation and immigration probabilityprobability
Stopping criteriaStopping criteria