Anda di halaman 1dari 6

IntroductiontoGeneticAlgorithms

Inspiredbynaturalevolution:
Livingthingsevolvedintomoresuccessfulorganisms offspringexhibitsometraitsofeachparent hereditarytraitsaredeterminedbygenes geneticinstructionsarecontainedinchromosomes chromosomesarestrandsofDNA DNAiscomposedofbasepairs(A,C,G,T),whenin meaningfulcombinations,encodehereditarytraits
2

GeneticAlgorithms
Chapter4.1

IntroductiontoGeneticAlgorithms
M h i Mechanismsofevolutionarychange: f l ti h
crossover:therandomexchangeofparents chromosomesduringreproductionresultingin:
offspringthathavesometraitsofeachparent

IntroductiontoGeneticAlgorithms
Mechanisms of evolutionary change Mechanismsofevolutionarychange:
mutation:therareoccurrenceoferrorsduring theprocessofcopyingchromosomesresultingin
changesthatarenonsensical/deadly, producingorganismsthatcan'tsurvive changesthatarebeneficial, producing"stronger"organisms changesthataren'tharmfulorbeneficial, producingorganismsthataren'timproved

Crossoverrequiresgeneticdiversity among d theparentstoensuresufficientlyvaried offspring


3

IntroductiontoGeneticAlgorithms
M h i Mechanismsofevolutionarychange: f l ti h
naturalselection:thefittestsurviveina competitiveenvironmentresultinginbetter organisms
individualswithbettersurvivaltraits generallysurviveforalongerperiodoftime thisprovidesabetterchanceforreproducing andpassingthesuccessfultraitsontooffspring overmanygenerationsthespeciesimproves sincebettertraitswilloutnumberweakerones
5

IntroductiontoGeneticAlgorithms
Keepapopulationofindividuals thatarecompletesolutions(orpartialsolutions) Exploresolutionspacebyhaving theseindividualsinteractandcompete
interactionproducesnewindividuals competitioneliminatesweakindividuals

Aftermultiplegenerationsastrongindividual (i.e.,solution)shouldbefound
6

RepresentationofIndividuals
Someproblemshavesolutionsthat can be represented as a vector of values: canberepresentedasavector ofvalues:
e.g.,satisfiability problem (SAT):
determineifastatementinpropositionallogicissatisfiable
(P1 P2)(P1 P3)(P1 P4)(P3 P4)

GeneticAlgorithm
Create initial random population Evaluate E al ate fitness of each indi id al individual Termination criteria satisfied ?
no yes

eachelementcorrespondswithapropositionhaving atruthvalueofeithertrue(i.e.,1)orfalse(i.e.,0) vector: P1 P2 P3 P4 values: 1 0 1 1

stop

Select parents according to fitness Recombine parents to generate offspring Mutate offspring
7

Someproblemshavesolutionsthatcanbe representedasapermutation ofvalues:


e.g.,travelingsalespersonproblem(TSP)

Replace population by new offspring

GeneticAlgorithm(1version)
1. Let s1, , sN be the current population 2. Let p[i] = F(si)/f(sj) be the fitness probabilities 3. For k = 1; k < N; k+=2 Parent1 = randomly pick s with prob. p Parent2 = randomly pick another s with prob. p Randomly select a crossover point, and swap strings of parents 1 and 2 to generate children t[k] and t[k+1] 4. For 4 F k = 1 k < N k++ 1; <= N; Randomly mutate each position in t[k] with small prob. 5. New generation t replaces old generation s
9

Initialization:SeedingthePopulation
Initializationsetsthebeginningpopulation ofindividualsfromwhichfuturegenerations of individuals from which future generations areproduced Concerns:
sizeoftheinitialpopulation
experimentallydeterminedforproblem experimentally determined for problem

diversityoftheinitialpopulation(geneticdiversity)
acommonissueresultingfromthelackofdiversity isprematureconvergence onnonoptimalsolution
12

Initialization:SeedingthePopulation
Howisadiverseinitialpopulationgenerated?
uniformlyrandom:generateindividuals
randomlyfromasolutionspacewithuniformdistribution

Evaluation:RankingbyFitness
Evaluationrankstheindividualsbysome fitnessmeasurethatcorrespondswiththe fit th t d ith th qualityoftheindividualsolutions Forexample,givenindividuali:
classification: TSP: SAT: walkinganimation: (correct(i))2 distance(i) #ofTermsSatisfied(i) subjective rating
14

gridinitialization:chooseindividuals
atregular"intervals"fromthesolutionspace

nonclustering:requireindividualstobeapredefined"distance"
awayfromthosealreadyinthepopulation

localoptimization:useanothertechnique(e.g.HC)
tofindinitialpopulationoflocaloptima, doesn'tensurediversitybutguaranteessolution tobenoworsethanthelocaloptima
13

Selection:FindingtheFittest
Choosewhichindividualssurviveandpossibly reproduceinthenextgeneration Selectiondependsontheevaluation/fitness function
iftoodependentthen,likegreedysearch, anonoptimalsolutionmaybefound ifnotdependentenough,thenmaynot g convergetoasolutionatall

SelectionTechniques
ProportionalFitnessSelection:
each individual is selected proportionally eachindividualisselectedproportionally totheirevaluationscore eventheworstindividualhasachancetosurvive thishelpspreventstagnationinthepopulation

Twoapproaches:
rankselection:individualselectedwithaprobabilityproportional
p p y toitsrank inpopulationsortedbyfitness

Naturedoesn'teliminateall"unfit"genes; theyusuallybecomerecessiveforalongperiod oftime,andthenmaymutatetosomething useful


15

proportionalselection:individualselectedwithaprobability Fitness(individual) / Fitness for all individuals

17

SelectionTechniques
Proportionalselection example: Giventhefollowingfitnessvaluesforpopulation:

SelectionTechniques
Crowding: apotentialproblemassociatedwiththe selection
occurswhentheindividualsthataremostfit quicklyreproducesothatalargepercentage oftheentirepopulationlooksverysimilar f th ti l ti l k i il reducesdiversityinthepopulation mayhinderthelongrunprogressofthealgorithm
18 21

Sum the Fitness 5 + 20 + 11 + 8 + 6 = 50 Determine probabilities Fitness(i) / 50

Individual Fitness A B C D E 5 20 11 8 6

Prob. 10% 40% 22% 16% 12%

Alteration:ProducingNewIndividuals
Alterationisusedtoproducenewindividuals Crossover forvectorrepresentations:
pickoneormorepairsofindividualsasparents andrandomlyswaptheirsegments alsoknownas"cutandsplice"

Alteration:ProducingNewIndividuals
1pointcrossover:
pickadividingpointintheparents'vectors andswapthesegments

Example
givenparents:1101101101 and0001001000 crossover point: after the 4th digit crossoverpoint:afterthe4thdigit childrenproducedare: 1101 +001000 and0001 +101101
22 23

Parameters:
crossoverrate numberofcrossoverpoints positionsofthecrossoverpoints

Alteration:ProducingNewIndividuals
Npointcrossover:
generalization of 1 point crossover generalizationof1pointcrossover pickndividingpointsintheparents'vectors andsplicetogetheralternatingsegments

Alteration:ProducingNewIndividuals
Alterationisusedtoproducenewindividuals Mutation:
randomlychangeanindividual e.g.TSP:twoswap,twointerchange e.g.SAT:bitflip

Uniformcrossover:
thevalueofeachelementofthevectoris randomlychosenfromthevaluesinthe correspondingelementsofthetwoparents

Parameters:
mutationrate sizeofthemutation
25

Techniquesexistforpermutationrepresentations
24

GeneticAlgorithmsasSearch
Theproblemoflocalmaxima: individualsstuckataprettygoodbutnotoptimal solution
anysmallmutationgivesworsefitness crossovercanhelpthemgetoutofalocalmaximum p g mutationisarandomprocess,soitispossiblethatwe mayhaveasuddenlargemutationtogetthese individualsoutofthissituation
26

GeneticAlgorithmsasSearch
GAisakindofhillclimbingsearch Verysimilartoarandomizedbeamsearch OnesignificantdifferencebetweenGAsandHC isthat,itisgenerallyagoodideainGAstofill p thelocalmaximaupwithindividuals Overall,GAshavelessproblemswithlocal maximathanbackpropagationneuralnetworks
27

Summary
Easytoapplytoawiderangeofproblems:
optimizationlikeTSP optimization like TSP inductiveconceptlearning scheduling layout

Theresultscanbeverygoodonsomeproblems, andratherpooronothers and rather poor on others GAisveryslowifonlymutationisused; crossovermakesthealgorithmsignificantly faster


28