EVA I - Department of Theoretical Computer Science and...

125
EVA I NAIL 025 – 2016/17 Roman Neruda ENGLISH VERSION 13-01-2017

Transcript of EVA I - Department of Theoretical Computer Science and...

Page 1: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EVAINAIL025–2016/17RomanNerudaENGLISHVERSION–13-01-2017

Page 2: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

INTRODUCTIONTopics,sources,outlines.

ROMANNERUDA:EVA1-2013/14 2

Page 3: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Literature

•  Mitchell,M.:Introduc)ontoGene)cAlgorithms.MITPress,1996.

•  Eiben,A.EandSmith,J.E.:Introduc)ontoEvolu)onaryCompu)ng,Springer,2007.

•  MichalewiczZ.:Gene)cAlgorithms+DataStructures=Evolu)onPrograms(3ed),Springer,1996

•  Holland,J.:Adapta)oninNaturalandAr)ficialSystems,MITPress,1992(2nded).

•  Goldberg,D.:Gene)cAlgorithmsinSearch,Op)miza)onandMachineLearning,Addison-Wesley,1989.

ROMANNERUDA:EVA1-2013/14 3

Page 4: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Topics•  Evolu\onmodels,popula\on,recombina\on.•  Gene\calgorithms.encoding,operators,selec\on,crossover,

muta\on.•  Naturalselec\on,simula\on,objec\vefunc\on,roule_ewheel,

tournament,eli\sm.•  Representa\onalschemata,schematatheorem,buildingblocks

hypothesis.•  Prisonner‘sdilemma,strategies,equilibria,evolu\onarystability.•  Evolu\onstrategies,coopera\on,meta-parameters.•  Differen\alevolu\on,CMA-ES.•  EAandcombinatorialproblems,NP-hardtasks,TSP,...•  Machinelearninganddatamining,evolu\onofrule-basedsystems,

Michiganvs.Pi_sburgh.•  Learningclassifiersystems,bucketbrigadealgorithm,Q-learning.

ROMANNERUDA:EVA1-2013/14 4

Page 5: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EVOLUTIONARYALGORITHMSBiologicalmo\va\on,basicparts

ROMANNERUDA:EVA1-2013/14 5

Page 6: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Darwinevolu\ontheory•  1859–Ontheoriginof

species•  Limitedenvironment

resources•  Reproduc\onisthekey

tolife•  Be_erfi_ed(adapted)

individualshavebiggerchancestoreproduce

•  Successfulphenotypetraitsarereproduced,modified,recombined

ROMANNERUDA:EVA1-2013/14 6

Page 7: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Mendelgene\cs•  1856-Versucheüber

Pflanzenhybriden•  Geneasabasichereditaryunit•  Everydiploidindividualhas

twopairsofallels,oneistransmi_edtooffspringindependentlyofothers.

•  It‘scomplicated:–  Polygeny–moregenes

influenceonetrait–  Pleiotropy–onegene

influencesmoretraits–  MitochondrialDNA–  Epigene\cs

ROMANNERUDA:EVA1-2013/14 7

Page 8: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

DNA•  1953–Watson&Crick–double

helixstructureofDNA•  Molecular-biologicalview:

–  Howisthegene\cinforma\onstoredinalivingorganism

–  Howisitinheri_ed•  DNAconsistsof4nucleo\des/

bases–adenin,guanin,cytosin,thymin

•  Codon–atrippletofnucleo\desencoding1outof23aminoacids(redundancy)

•  These23aminoacidsarethebasicbuildingstructureofcarbohydratesinalllivingorganisms

ROMANNERUDA:EVA1-2013/14 8

Page 9: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Moleculargene\cs•  Crossover•  Muta\on•  Transcrip\on:DNA->RNA•  Transla\on:RNA->protein•  GENOTYPE->PHENOTYPE•  One-direc\on,complex

mapping•  Lamarckism:

–  Thereisaninversemappingfromphenotypetogenotype

–  Acquiredtraitscanbeinherited

ROMANNERUDA:EVA1-2013/14 9

Page 10: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EA-summary

•  Naturalevolu\on:environment,individuals,fitness

•  Ar\ficialevolu\on:problem,candidatesolu\ons,qualityofasolu\onmeasure

•  Easarepopula\on-basedstochas\csearchalgorithms

•  Recombina\onandmuta\oncreatevariability•  Selek\onleadsthesearchintherightdirec\on

ROMANNERUDA:EVA1-2013/14 10

Page 11: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

GeneralEA

•  EAsarerobustmeta-algorithms

•  Nofreelunchtheorem–thereisnoonebestalgorithm

•  Itpaystocreatedomain-specificvariantsofEAs–  Representa\on–  Operators

ROMANNERUDA:EVA1-2013/14 11

Page 12: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

GeneralEA•  Createini\alpopula\on

P(0)atrandom•  InacyclecreateP(t+1)

fromP(t):–  Parentalselec\on–  Recombina\on,andmuta\on

–  NewindividualsP‘(t+1)arecreated

–  Environmentalselec\onchoosesP(t+1)basedonP(t)aP‘(t+1)

ROMANNERUDA:EVA1-2013/14 12

Page 13: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Gene\calgorithms

•  1975-Holland•  Binaryencodedindividuals•  Roule_e-wheelselec\on•  1-pointcrossover•  Bitwisemuta\ons•  Inversion•  SchamatatheorytoexplainthemechanismhowGAswork

ROMANNERUDA:EVA1-2013/14 13

Page 14: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Evolu\onaryprogramming

•  1965–Fogel,OwensaWalsh•  Evolu\onoffiniteautomata•  Nodis\nc\onbetweengenotypeandphenotype

•  Focusonmuta\ons•  Nocrossover,usually•  Tournamentselec\on

ROMANNERUDA:EVA1-2013/14 14

Page 15: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Evolu\onatystrategies

•  1964-Rechenberg,Schwefel•  Op\miza\onofrealnumbervectorsindifficultcomputa\onalmathproblems

•  Floa\ngpointencodingofindividuals•  Muta\onisthebasicoperator•  Themuta\onstepisheuris\callycontrolledorudergoesanadapta\on(evolving)

•  Determinis\cenvironmentalselec\on

ROMANNERUDA:EVA1-2013/14 15

Page 16: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Gene\cprogramming

•  1992–Koza•  Evolu\onofindividualsrepresen\ng(LISP)trees

•  Used(notonly)toevolvecomputerprograms•  Specificoperatorsofcrossover,muta\on,ini\aliza\on

•  Furtherapplica\ons(neuroevolu\on,evolvinghw,…)

ROMANNERUDA:EVA1-2013/14 16

Page 17: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

SIMPLEGENETICALGORITHMHollandSGA,binaryreprezenta\on,operatorsandtheirvariants

ROMANNERUDA:EVA1-2013/14 17

Page 18: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

GA

•  Gene\calgorithms–70sUSA,Holland,DeJong,Goldberg,…

•  TheoriginalproposalisnowadayscalledSGA(simpleGA)– Minimalsetofoperators,thesimplestindividualencoding,researchoftheore\calproper\es

•  Gradually,theSGAhasbeenenrichedof–ortransformedto–furtheroperators,encodings,waysofdealingwithpopula\ons,etc.

ROMANNERUDA:EVA1-2013/14 18

Page 19: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

SGA-basics•  t=0;Generateatrandom

ini\alpopulationP(0)ofnl-bitgenes(individuals)

•  StepfromP(t)toP(t+1):–  Computef(x)foreachxfromP(t)

–  Repeatn/2times:•  Selectapairx,yfromP(t)•  Crossoverx,ywithprobabilitypC

•  MutateeverybitofxandywithprobabilitypM

•  Insertx,ytoP(t+1)

ROMANNERUDA:EVA1-2013/14 19

Page 20: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Selec\on

•  RouleGewheelselec)on:– Selec\onmechanismisbasedontheindividualfitnessvalue

– Expectednumberofindividualselec\onsočekávanýshouldbepropor\onalonthera\oofitsfitnessandanaveragefitnessofthepopula\on

– Roulettewheelselec\on:eachindividualhasanallocatedsliceofaroule_ewheelcorrespondingtoitsfitness,thewheelisspunn-times

ROMANNERUDA:EVA1-2013/14 20

Page 21: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Křížení

•  VGAjekříženíhlavnímoperátorem•  Rekombinujevlastnos\rodičů•  Doufáme,žerekombinacepovedeklepšífitness

•  Jednobodovékřížení:– náhodnězvolímebodkřížení,– vyměnímeodpovídajícíčás\jedinců– PravděpodobnostpCtypickyvrozsahudese\n

ROMANNERUDA:EVA1-2013/14 21

Page 22: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Muta\on

•  InsimpleGA,muta\onoperatorislessimportant,actsasamechanismagainststuckinlocalextrema

•  (Onthecontrary,inEPneboearlyES,muta\onistheonlysourceofvariability)

•  Bit-stringmuta\on:– WithprobabilitypM,everybitoftheindividualischanged

–  pMissmall(eg.tochange1bitinindividualonaverage)

ROMANNERUDA:EVA1-2013/14 22

Page 23: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Inversionandother

•  TheoriginalHolland’sSGAproposalcontainsanothergene\coperator–inversion

•  Inversion– Reversingapartofthebitstring– BUTwithkeepingthemeaningofbits– Morecomplicatedtechnically–  Inspira\oninnature– Didnotproventobebeneficial

ROMANNERUDA:EVA1-2013/14 23

Page 24: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

SCHEMATHEORYSchematheorem,buildingblockshypothesis,implicitparalelism,k-armbandit

ROMANNERUDA:EVA1-2013/14 24

Page 25: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Schemata•  Individualisawordinalphabet{0,1}•  Schemaisawordinalphabet{0,1,*}–  (*=don'tcare)

•  Schemarepresentsasetofindividuals•  Schemawithr*represents2rindividuals•  Individualwithlengthmisrepresentedby2mschemata

•  Thereis3mschemataoflengthm•  Inpopula\onofnindividualsthereisbetween2mandn.2mschematarepresented

ROMANNERUDA:EVA1-2013/14 25

Page 26: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Proper\esofschemata

•  OrderofschemaS:o(S)– Numberof0and1(fixedposi\ons)

•  DefininiglengthofschemaS:d(S)– Distancebetweenthefirstandthelastfixedposi\on

•  FitnessoftheschemaS:F(S)– Averagefitnessoftheindividualsinapopula\onthatcorrespondtotheschemaS

– NotethatfitnessofSdependsonthecontextofapopula\on.

ROMANNERUDA:EVA1-2013/14 26

Page 27: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Theschematheorem•  Short(w.r.t.defininglength),above-average(w.r.t.fitness),low-orderschemataincreaseexponen)allyinsuccessivegenera)onsofGA.(Holland)

•  Buildingblocshypothesis:– GAseekssubop\malsolu\onofthegivenproblembyrecombina\onofshort,low-orderabove-averageschemata(calledbuildingblocks).

–  “justasachildcreatesmagnificentfortressthrougharrangementofsimpleblocksofwood,sodoesaGAseeknearop\malperformance...”

ROMANNERUDA:EVA1-2013/14 27

Page 28: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ProofofTST

•  Popula\onP(t),P(t+1),...nindividualsoflengthm

•  Whathappenstoapar\cularschemaSduring:–  Selection–  Crossover– Muta\on

•  C(S,t)...Numberofindividualsrepresen\ngschemaSinpopulationP(t)

•  Wewilles\mateC(S,t+1)inthreesteps

ROMANNERUDA:EVA1-2013/14 28

Page 29: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ProofofTST

•  Selec\on:– Anindividualprobabilityofselec\onis:ps(v)=F(v)/F(t),whereF(t)=ΣF(u),{uinP(t)}– Probabilityofselec\onodschemaS:ps(S)=F(S)/F(t)– Thus:C(S,t+1)=C(S,t)nps(S)– Orequivalently:C(S,t+1)=C(S,t)F(S)/Fprum(t)WhereFprum(t)=F(t)/n…isaveragefitnessinP(t)

ROMANNERUDA:EVA1-2013/14 29

Page 30: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ProofofTST

•  ...S\llselec\on:– So,wehave:C(S,t+1)=C(S,t)F(S)/Fprum(t)–  Iftheschemawere“above-average”ofe%:– F(S,t)=Fprum(t)+eFprum(t),fort=0,...– C(S,t+1)=C(S,t)(1+e)– C(S,t+1)=C(S,0)(1+e)t–  I.e.thenumberofabove-averageschematagrowsexponen\ally(inconsecu\vepopula\ons(andwithselec\ononly)).

ROMANNERUDA:EVA1-2013/14 30

Page 31: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ProofofTST

•  Crossover:– Probabilitythataschemawillbedestroyed/surviveacrossover:

– pd(S)=d(S)/(m-1) – ps(S)=1–d(S)/(m-1)– Crossingoverwithprobabilitypc:– ps(S)>=1–pc.d(S)/(m-1)

•  Selec\onandcrossovertogether:– C(S,t+1)>=C(S,t).F(S)/Fprum(t)[1-pc.d(S)/(m-1)]

ROMANNERUDA:EVA1-2013/14 31

Page 32: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ProofofTST•  Muta\on:–  1bitwillnotsurvive:pm–  1bitwillsurvive:1–pm– ASchemawillsurvive(pm<<1):–  ps(S)=(1–pm)o(S)–  ps(S)=…roughly…=1–pm.o(S),forsmallpm

•  Selec\on,crossoverandmuta\ontogether:•  C(S,t+1)>=C(S,t).F(S)/Fprum(t)[1-pc.d(S)/(m-1)-pm.o(S)]

•  QED.

ROMANNERUDA:EVA1-2013/14 32

Page 33: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ConsequencesofTSTandBBH

•  Encodingma_ers•  Sizema_ers•  Prematureconvergenceharms•  WhenGAsucks:–  (111*******),(********11)areabove-average– ButF(111*****11)<<F(000*****00)–  Idealis(1111111111);GAhashard\mesfindingit– Theselec\oncondi\onmightbeimproved

ROMANNERUDA:EVA1-2013/14 33

Page 34: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Implicitparalelism

•  GAworkswithindividuals,butimplicitlyitevolvesmuchmoreschemata:2mton.2m.

•  Buthowmanyschemataisprocessedefficiently:– Holland(andothers):(Undercertaincircumstances,suchasn=2m,schematastayabove-average,...)Numberofschematathatreallygrowexponen\allyisintheorderofn3.

•  Itwasjokinglycommentedastheonlycasewherecombinatorialexplosionisonourside.

ROMANNERUDA:EVA1-2013/14 34

Page 35: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Explora\onvs.Exploita\on

•  OriginalHollandmo\vace:GAis“adap\veplan”lookingforequilibriumbetween:– explora)on(findingnewareasforsearch)– exploita)on(u\lizingcurrentknowledge)

•  Justexplora\on:randomwalks,notu\lizingpreviousknowledge

•  Justexploita\on:stuckinginlocalop\ma,rigidity

ROMANNERUDA:EVA1-2013/14 35

Page 36: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

1-armedbandit

ROMANNERUDA:EVA1-2013/14 36

Page 37: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

2-armedbandit

•  Ncoins,2-armedbandit(armspayoffshaveexpectedvaluesm1,m2andvariancess1,s2).N-ncoinsisallocatedtothebe_erarm,ncoinstotheworseone.

•  Goal:tomaximizeoutcome/tominimalizeloss.•  Analy\calsolu\on:toallocateexponen\allymoretrialstothecurrentlywinningarm

•  N-n*=O(exp(cn*));–  cdependsonm1,m2,s1,s2;andn*istheop\malvalue

ROMANNERUDA:EVA1-2013/14 37

Page 38: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

BanditandSGA

•  GAalsoallocatesexponen\allymoretrials(slotsinpopula\on)tothemoresuccessfulschemata

•  Itthussolvestheexplora\onvs.exploita\onproblemintheop\malway

•  Schemataplaysmanymul\-armedbanditgames–  Thewinningprizeisnumberofslotsinpopupla\on–  Itishardtoes\matethefitnessofascheme–  FirstpeoplethoughtthatSGAplays3m–armedbandit,– Whereallschemataarecompe\ngarms…

ROMANNERUDA:EVA1-2013/14 38

Page 39: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

…butit’scomplicated•  Actually,muchmoregamesisplayedinparallel•  Schemata“compete”for“conflic\ng”fixedposi\onsinagene

•  Schemataoforderkalwayscompeteforthosekfixedposi\ons–theyplay2k–armedbandit

•  So,thebestofthosegamesgettheexponen\alslotsinpopula\on

•  But,itdependsifwecanes\matethefitnessofaschemeinapar\cularpopula\onwell(whichcanbeaproblem)

ROMANNERUDA:EVA1-2013/14 39

Page 40: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Thus,abadtaskforSGAis...•  =2;forx~111*...*•  f(x)=1;forx~0*...*•  =0;otherwise.•  Forschematawenowhave:–  F(1*...*)=1/2;–  F(0*...*)=1

•  But,theSGAes\matesF(1*...*)~2,•  Becauseschemata111*...*willbemuchmorecommoninapopula\on

•  SGAheredoesnotsampleschemataindependently,soitdoesnotes\matetheirrealfitness.

ROMANNERUDA:EVA1-2013/14 40

Page 41: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Problems

•  Thearmsinbanditareindependent,buttheSGAdoesnotsampleschemataindependently

•  Selec\ondoesnotworkideally,asintheTST,itisdynamicandithassta\s\calerrors.

•  SGAmaximizesitson-lineperformance,theyshouldbesuitableforadap\vetasks(Itisapi_ytostoparunningSGA;-)

•  (Paradoxically,maybe)themostcommonapplica\onofGAistoletthem“only”findtheonebestsolu\on.

ROMANNERUDA:EVA1-2013/14 41

Page 42: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Sta\cBBH

•  GrafensteGe,91:PeopleconsiderthatGAconvergestosolu)onswithactualsta)s)caveragefitness;andnot(asitreallyhappens)tothosethatexistinpopula)ons,i.e.withthebestobservedfitness

•  Then,peoplecanbedisappointed:– Collateralconvergence– Largefitnessvariance

ROMANNERUDA:EVA1-2013/14 42

Page 43: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Collateralconvergence

•  WhenGAconvergessomewhere,theschemataarenolongersampleduniformly,butwithabias

•  If,e.g.asheme111***...*isgood,itwillspreadinapopula\ona�erfewgenera\ons,i.e.almostallindividualswillhavethisprefix.

•  Butthen,almosteverysampleofascheme***000...*arealsosamplesofascheme111000*...*.

•  Thus,theGAwillnotes\mateF(***000*...*)correctly.

ROMANNERUDA:EVA1-2013/14 43

Page 44: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Largefitnessvariance

•  GAwillnotes\matefitnessofaschemewellinthecaseifthesta\caveragefitnesshasalargevariance.

•  Suchasthescheme1*...*fromourevilexample.•  Thevarianceofitsfitnessislarge,sotheGAwillprobablyconvergetothosepartsofasearchspacewherethefitnessisbig.

•  Whichinturnwillbiasfurthersamplingofthescheme.So,thesta\cfitnessisnotes\matedwell,again.

ROMANNERUDA:EVA1-2013/14 44

Page 45: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

REPRESENTATIONANDOPERATORSIntegerandfloa\ngpointrepresenta\onsoperators,selec\on

ROMANNERUDA:EVA1-2014/15

Page 46: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Encoding•  Binary–  Classic(Holland)–  Therearenicetheore\calresults(be_erthanschematatheory,wewillseenextsemestr)

– Hollandargumen:binarystringsoflength100arebeGerthandecimalofleghth30becausetheyencoderoughlythesameinforma)onbuthavemoreschemta(2100>230).

–  ButweknowschemataarenotthatimportantasHollandthought

–  Theimportantfactoristhatbinarzencodingissome\mesunnaturalforagivenproblem.

ROMANNERUDA:EVA1-2014/15

Page 47: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Otherencodings•  Alphabetswithmoresymbols•  Integers•  Floa\ngpoint

•  Yetanotherexamples:–  Permuta\ons,–  Trees(programs),–  Matrices,–  Neuralnetworks(differentways),–  Finiteautomata–  Graphs,–  A-lifeagents…

ROMANNERUDA:EVA1-2014/15

Page 48: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Selec\on-overview•  Roule>e-wheelselecDon–  tradi\onal,fitness-propor\onal

•  SUS(stochasDcuniversalsampling)–  Justonerandomposi\oninaroule_ewheel,otherposi\onsareshi�soverangle1/n

–  „morefairroule_e“–why?•  Turnament–  k-tournament– comparingkrandomlyselectedindividuals,thewinnerischosenbyselec\on

–  Typically,kisasmallnumber,like2,3,5–  Canbeusedincaseswherefitnessisnotexplicitlygiven(agameisplayed,orasimula\onisinvolved)

ROMANNERUDA:EVA1-2014/15

Page 49: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Integerencoding•  Muta\on:–  „unbiased“–newrandomvaluefromthewholedomain

–  „biased“–newvaluerepresentsarandomshi�(normaldistribu\on)fromtheoriginalvalue

•  Crossover:– One-point,mul\pe-point,…– Uniform–ineverygenewethrowacoinfromwhichparentthevalueischosen

–  Bewareofordinalrepresenta\onsincaseswheretheorderdoesnotmakesense(then,probably,thebiasedmuta\ondoesnotmakesense)

ROMANNERUDA:EVA1-2014/15

Page 50: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Floa\ngpointencoding

•  Historically,thefirsta_emptswereencodingrealnumbersintobit-stringrepresenta\ons

•  Notusedo�entoday,exceptforthecaseswhenalimitedprecisionmakesgoodsense(compressionofasearchspace,explicitcontrolovertheaccuracyoftherepresenta\on)

•  Commonprac\cetodayistoencoderealvaluesasfloa\ngpointrepresenta\on,andtheoperatorstakethisintoaccount

ROMANNERUDA:EVA1-2014/15

Page 51: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Floa\ngpointoperators

•  Muta\on– biased– Unbiased

•  Crossover– Structural

•  One-point,uniform,...

– Arithme\c•  Combina\onofvalues

ROMANNERUDA:EVA1-2014/15

Page 52: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Arithme\ccrossover

•  Simpleaverageofparents‘values•  Variants:– Someotherconvexcombina\on:

•  z=a*x+(1-a)*y,where0<a<1– Howmanyvaluesfromanindividualtocross:

•  Typicallyallofthem•  Some\mesjustonechosenatrandom•  Some\mesacombina\onwith1-pointcrossover

ROMANNERUDA:EVA1-2014/15

Page 53: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EVOLUTIONOFCOOPERATIONPrisonersandtheirdilemma,Nash,vonNeumann,Axelrod,Dawkins

ROMANNERUDA:EVA1-2014/15

Page 54: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Altruismvs.darwinism?•  Darwinismisinherentlycompe\\v–survivalofthefi_est

–  socialdarwinism– backingthelaissez-faire(„letitbe“)capitalism–  AndrewCarnegie,TheGospelofWealth,1900Whilethelawofcompe))on

maybesome)meshardfortheindividual,itisbestfortherace,becauseitensuresthesurvivalofthefiGestineverydepartment.Weacceptandwelcome,therefore,ascondi)onstowhichwemustaccommodateourselves,greatinequalityofenvironment;theconcentra)onofbusiness,industrialandcommercial,inthehandsofthefew;andthelawofcompe))onbetweenthese,asbeingnotonlybeneficial,butessen)altothefutureprogressoftherace.

•  Butthereisalotofcoopera\onbothinnatureandsociety•  Themainproblemofevolu\onary(social)biology:•  HowcanaltruisDcbehaviorbeevolved,whenit(by

definiDon)decreasesafitnessofanindividual?

ROMANNERUDA:EVA1-2014/15

Page 55: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Theoriesofevolu\onofaltruism•  Groupselec\on

–  Evolu\oncanworkongroupsofindividuals(Darwin)–  Howtoexplainindividualswhocheatanddonothelp

•  Kinselec\on–  Preserva\onofalmostiden\calgenesincloserela\ves–  Howtoexplainaltruismofstrangers,evenotherspecies

•  Dawkins,selfishgene–  Theunitofevolu\onisagene,notanindividual– Wilson:„theorganismisonlyDNA'swayofmakingmoreDNA.“

•  Trivers,1971:reciprocalaltruism– Mutualbenefitsforbothorganisms(evendifferentspecies)–  Shadowofthefuture,paralellwithiteratedprisonersdilemma

ROMANNERUDA:EVA1-2014/15

Page 56: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Prisoner’sdilema

ROMANNERUDA:EVA1-2014/15

i/j D C

D 2/2 0/5

C 5/0 3/3

i/j D C

D P/P S/T

C T/S R/R

• Tempta)on>Reward>Penalty>Suckerspayoff• R>P:mutualcoopera)onisbeGerthanmutualdecep)on• T>RaP>S:decep)onisadominantstrategyforbothplayers• (50s-RANDcorp.)

Page 57: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Nash

•  Astrategysisdominantforagenti,ifitgivesbe_erorthesameresultthananyotherstrategyofanagentiagainstallstrategiesofagentj

•  StrategiessiandsjareinNashequilibrium,if:–  Ifagentiplaysstrategysi,agentjdoesbestwithstrategysj–  Ifjplayssj,idoesbestwithsi

•  Or,siandsjarethebestmutualanswerstoeachother•  ThisisNashequilibriumofpurestrategies

•  ButnoteverygamehasaNashequilibriuminpurestrategies•  AndsomegameshavemoreNashequilibria

ROMANNERUDA:EVA1-2014/15

Page 58: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

NashandPareto•  Mixedstrategies–random

selec\onamongpurestrategies–  Nashtheorem:Everygamewith

finitenumberofstrategieshaveNashequilibriuminmixedstrategies.

•  Thesolu\onisPareto-op)mal/efficient–  Ifthereisnootherstrategywhich

wouldimproveagentoutcomewithoutworseningsomeotheragentoutcome

–  Thesolu\onisnotPareto-efficinet:ifanoutcomeofoneagentcenbeimprovedwithoutdecreasingotheragent‘soutcome

ROMANNERUDA:EVA1-2014/15

Page 59: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Thus…

•  Forra\onalagentsthereisnodilemma/oristhere?– DDisNashequiilibrium– DDistheonlysolu\onthatisnotPareto-op\mal– CCisasolu\onmaximizingcommonoutcome

•  Tragedyofthecommons•  Whatisra\onal,andarepeoplera\onal?•  Shadowoffuture–iteratedversion–Axelrod

ROMANNERUDA:EVA1-2014/15

Page 60: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Iteratedprisoner‘sdilemma•  Playersplaymoregames,

theyremembertheresults/acitonsoftheoponent,andcanmodifytheirstrategiesaccordingtothehistory

•  T>R>P>S,•  2R>T+S–itdoesnotpayoff

toalternateCandD•  IfthegameisplayedN-

\mes(andtheplayersknowtheN)itcanbeprovedbyinduc\on,thebeststrategyis„deceiveallthe\me“.

ROMANNERUDA:EVA1-2014/15

Page 61: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Axelrodtournaments•  Thefirsttournament:

–  14strategiesplusRANDOM,200games,everybodyplayedwitheverybody(ncludititself),5xrepeat

•  TFT=TitForTatstrategy–  Startcooperate,thencopyoponent‘smoves

•  Thesecondtournament:–  62strategiíes–everybodyknewtheresultsofprevioustournament–TFT

winsagain

•  Thethird„ecological“tournament–  Resemblingthegenera\onsofGA,ini\alpopula\onwasthesecond

tournamentstrategies,therewere1000genera\ons–  Thenumberofindividualsinthenextgenera\onwaspropor\onalto

numberofvictoriesinthepreviousgenera\on–  Aaaaand,theTFTwinsagain!

ROMANNERUDA:EVA1-2014/15

Page 62: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Whatdoesitmeanforstrategies?•  4importantproper\esofsuccessfulstrategies:–  Niceness–donotdeceivefirst–  Provocability–quicklypunishdecep\on–  Forgiveness–butquicklycalmdown–  Clarity–besimple,soothersunderstandyou

•  Thereisnotasinglestrategythatwouldwinagainstallstrategies

•  Itisnecessarytobesuccessfulagainstverydiversestrategies(ALL-D,TFTT,RANDOM,TRIGGER)

•  Itisalsogoodtolearnplaywellagainstitself•  A_emptstobeatTFTbymoredecep\ondidnothelp

ROMANNERUDA:EVA1-2014/15

Page 63: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Whatdoesitmeanforcoopera\on?

•  Inenvironmentsthatsupportcoopera\on…–  Payoffsfavorcoopera\on,–  ThereisabigprobabilityofiteratedPD(shadowofthefuture)

•  …thecoopera\onisusuallyevolved–  Butnotalways,suchasintheALL-Dworld

•  Ra\onality,intelligence,consciousnes,…isnotnecessaryforcoopera\on,justbiggerfitnessvalues

•  Ini\alcoopera\oncanemergeatrandom,andthenitcansurvive

ROMANNERUDA:EVA1-2014/15

Page 64: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Twentyyearsa�er•  Inenvironmentswithnoise,thePavlovstrategy(win-stay,lose-shi�)issuccessfu

•  IfthepayoffRorP=>C,•  ifTorS=>D

•  A�er20yearsthetournamentwasrepeatedwithmorestrategiesfromeachteam

•  Thewinningstrategieswerecoopera\ngasateam•  Fewmoves(10)tahůtorecognizetheoponent,thenallstrategieshelpedonefatherstrategyfromtheteamtogetbe_erscore

•  Theteamswereevenfigh\ngtheorganizers(falseteamstogetmoreslotsinthetournament…)

ROMANNERUDA:EVA1-2014/15

Page 65: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EVOLUTIONARYSTRATEGIESMo\va\on,popula\oncycle,floa\ngpointmuta\ons,meta-evolu\on

ROMANNERUDA:EVA1-2014/15

Page 66: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Evolu\onatystrategies•  Rechenberg,Schwefel,60s•  Op\miza\onofrealfunc\onofmanyparameters•  'evolu\onofevolu\on'•  Evolvedindividual:– Gene)cparameters-affec\ngthebehavior–  Strategicparameters-affec\ngevolu\on

•  Newindividualisacceptedonlyifitisbe_er•  Moreindividualsasparents•  Todaysmostsuccessful(andcomplex)isCMA-ES(correla\onmatrixadapta\on-ES)

ROMANNERUDA:EVA1-2014/15

Page 67: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ESnota\on•  Importantparameters:– Mnumberindividualsinpopula\on–  Lnumberofnewindividuals–  Rpočet'rodičů'

•  Specialselec\onrelatednota\on:–  (M+L)ES–Mindividualstoanewgenera\onisselectedfromM+Loldandnewindividuals

–  (M,L)ES–Mindividualstoanewgenera\onisselectedonlyfromLnewindividuals•  Usually,the(M,L)strategiesaremorerobust– lesspronetostuckinlocalop\ma

•  Theindividual:C(i)=[Gn(i),Sk(i)],k=1,orn,or2n

ROMANNERUDA:EVA1-2014/15

Page 68: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ESpopula\oncycle

•  n=0;Ini\alizeatrandomapopula\onPnofMindividuals

•  EvaluatethefitnessvaluesofindividualsinPn•  Un\lthesolu\onisnotgoodenough:–  RepeatL\mes:

•  chooseRparents,•  Crossthemover,mutate,evaluatethenewindividual

–  ChooseMnewindividuals(dependingontheEStype)–  ++n

ROMANNERUDA:EVA1-2014/15

Page 69: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ESindividualandmuta\on•  C(i)=[Gn(i),Sk(i)]•  Skarestandarddevia\onsofbiasedfloa\ngpointmuta\ons•  k=1:

–  OnecommonstddevforallevolvedparametersG’s•  k=n:

–  Non-correlatedmuta\ons,nindividualnormaldistribu\ons–  Eachparameterhasitsownstddev–  Geometricly,themuta\onsarewithinanellipseparalleltoaxes

•  k=2n:–  Rota\onsarealsoincluded,theellipseisnotparalleltoaxes–  correlatedmuta\ons,theycorrespondtomuta\onsfromn-

dimensionalnormaldistribu\on–  nparametersforrota\ons,nforstddevs2n

ROMANNERUDA:EVA1-2014/15

Page 70: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ESmuta\ons•  Gene\cparameters:

–  Addingrandomnumberfromnormaldistrbu\onwithcorrespondingdevia\on,androta\on,respec\velly

•  Standarddevia\ons:–  Increaseordecreaseaccordingtothesuccessofthemuta\on–  Originally,theso-called1/5rule(heuris\c,„thebestcaseiswhenthemuta\onhas20%successrate“,thus,thestddevisincreasedforlowersuccessrates,anddecreasedwhenthesuccessrateishigher

–  MorecommonnowistoaddarandomnumberdrawnfromN(0,1)

•  Rota\on:–  AddarandomnumberdrawnfromN(0,1)

ROMANNERUDA:EVA1-2014/15

Page 71: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EScrossover

•  Uniform•  „Gangbang“ofmoreparents– Local(R=2)– Global(R=M)

•  Twoversions:– Discrete– Arithme\c(average)

ROMANNERUDA:EVA1-2014/15

Page 72: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

DIFFERENTIALEVOLUTIONAlterna\ve,geometricallymo\vatedEVA

ROMANNERUDA:EVA1-2014/15

Page 73: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

DE–schemeandini\aliza\on

•  InicializaDon:randomparametervalues•  MutaDon:„shi�“accordingtotheothers•  Crossover:uniform„withasafeguard“•  SelecDon:comparisonandpossiblereplacementbyabe_eroffspring

ROMANNERUDA:EVA1-2014/15

DE – schéma a inicializace

• Inicializace: náhodné hodnoty parametrů• Mutace: „posun“ podle ostatních• Křížení: uniformní „s pojistkou“• Selekece: porovnání a případné nahrazení

lepším potomkem

ROMAN NERUDA: EVA1 - 2013/14 61

Mutace Křížení SelekceInicializace

Page 74: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Muta\on

•  Everyindividualinapopula\onundergoesmuta\on,crossover,andselec\on

•  Foranindividualxi,pwechoosethreedifferentindividualsxa,p,xb,p,xc,patrandom

•  Defineadonorv:vi,p+1=xa,p+F.(xb,p-xc,p)•  Fisamuta\onparameter,avaluefrominterval<0;2>

ROMANNERUDA:EVA1-2014/15

Page 75: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Crossover

•  Uniformcrowwoveroforiginalindividualwithadonor

•  ParameterCcontrolstheprobabilityofachange•  Atleastoneelementmustcomefromadonor•  Probevectorui,p+1:•  uj,i,p+1=vj,i,p+1;iffrandji<=Corj=Irand•  uj,i,p+1=xj,i,p+1;iffrandji>CandjǂIrand•  randjiispseudorandomnumberfrom<0;1>•  Irandpseudorandomintegerfrom<1;2;...;D>

ROMANNERUDA:EVA1-2014/15

Page 76: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Selec\on

•  Comparefitnessofxandv,selectthebe_er:– xi,p+1=ui,p+1;ifff(ui,p+1)<=f(xi,p)– xi,p+1=xi,p;otherwise–  fori=1,2,...,N

•  Muta\on,crossover,andselec\onisrepeatedun\lsometermina\oncriterionissa\sfied(typically,thefitnessofthebestindividualisgoodenough)

ROMANNERUDA:EVA1-2014/15

Page 77: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

PARTICLESWARMOPTIMIZATIONIndividualisapar\clefloa\nginaswarminthefitnesslandscape

ROMANNERUDA:EVA1-2014/15

Page 78: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

PSO•  Popula\on-basedsearchheuris\c•  Eberhart,Kennedy,1995•  Inspira\onofswarmsofinsect/fish•  Individualistypicallyafloa\ngpointvector•  Itiscalledapar/cle•  Nocrossover•  Nomuta\onasweknowit•  Individualsaremovinginaswarmthroughtheirparameter

space•  Thealgorithmisusinglocalandglobalmemory:

–  pBest– eachpar\cleremembersaposi\onwiththebestfitness–  gBest– bestpBestamongallpar\cles

ROMANNERUDA:EVA1-2014/15

Page 79: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

PSOalgorithm•  Ini\alizeeachpar\cle•  Do•  Foreachpar\cle•  Computefitnessofpar\cle•  Ifthefitnessisbe_erthanthebestfitnessseensofar(pBest)•  pBest:=fitness;•  End

•  SetgBesttothebestpBest•  Foreachpar\cle•  computethespeedofpar\clebyequa\on(a)•  updateposi\onofpar\clebyequa\on(b)•  End•  Whilemaximumitera\onsorminimumerrornotsa\sfied

ROMANNERUDA:EVA1-2014/15

Page 80: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

PSOmovementequa\ons

•  v:=v++c1*rand()*(pbest-present)++c2*rand()*(gbest-present)(a)

•  present=persent+v(b)•  vispar\clespeed,presentispar\cleposi\on•  pbestbestposi\onofapar\cleinhistory•  gbestbestglobalposi\oninhistory•  rand()randomnumberfrom(0,1).•  c1,c2constants(learningrates)o�enc1=c2=2.

ROMANNERUDA:EVA1-2014/15

Page 81: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

PSOdiscussion

•  CommonwithGA:– Startwithrandomconfigura\on,haveafitness,usestochas\cupdatemethods

•  DifferentfromGA:– Nogene\coperators– Par\cleshavememories– Theexchangeofinforma\ongoesonlyfromthebe_erpar\clestotherest

ROMANNERUDA:EVA1-2014/15

Page 82: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EVOLUTIONARYMACHINELEARNINGMichiganvs.Pi_sburg,machinelearning,reinforcmentlearning

ROMANNERUDA:EVA1-2014/15

Page 83: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Machinelearning–asubset•  Learnrulesbasedonthetrainingexamples– Datamining– Expertsystems– Agent,robotslearning(reinforcementlearning)

•  Basicevolu\onaryapproaches:– Michigan(Holland):individualisonerule

•  HollandLCS:learningclassifiersystems

– Pi>sburgh:individualisasetofrules

ROMANNERUDA:EVA1-2014/15

Page 84: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Michigan•  Hollandin80s:learningclassifiersystems•  Theindividualisarule•  Thewholepopula\onworksasanexpertorcontrolsystem

•  Therulesaresimple:–  Le�-handside:featureistrue/not/don‘tcare(0/1/*)–  Right-handside:ac\oncodeorclassifica\oncategory

•  Ruleshaveweights(reflec\ngtheirsuccess)•  Theweightmakestheirfitness•  Theevolu\ondoesnothavetobegenera\onalROMANNERUDA:EVA1-2014/15

Page 85: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Michigan-LCS•  Evolu\onhappensonlyfrom\meto\meand/oronpartofpopula\on

•  Theproblemofreac\vness(lackofinnermemory)–  Theright-handsideoftherulecontains–besidestheac\on/classifica\oncode–otherinnerfeatures,called„messages“

–  Thele�-handsideoftherulehasspecialfeaturestointerceptthemessages,called„receptors“

–  Thesystemhasabufferofmessagesandithastorealizeanalgorithmtodistributearewardamongchainsofrules

ROMANNERUDA:EVA1-2014/15

Page 86: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

LCS–bucketbrigade•  Onlysomerulesleadtoac\ons

thattriggerrewardfromtheenvironment,

•  Therewardshouldbedistributedtothechainofsuccessfulrulesleadingtothereward

•  Ruleshavetogiveuppartoftheirstrenght(likepayingmoneytotakepartintheac\on)iftheycompeteforachancetobeapplied

•  ThetechnicalwayitisdoneiscalledBucketbrigadealgoritm

•  Inprac\ceitisdifficulttoballancetheeconomyofrules,hardlyusedtoday

ROMANNERUDA:EVA1-2014/15

LCS – bucket brigade• Jen některá pravidla vedou

k akci, za kterou následuje odměna/trest od prostředí,

• Rozdělění odměny – pro celý řetěz úspěšných pravidel

• Pravidla musejí dát část své síly (jakoby peněz), když chtějí soupeřit o možnost být v cestě k řešení

• Bucket brigade algoritm, v praxi komplikované a těžkopádné, ekonomika odměn se těžko vyvažuje

ROMAN NERUDA: EVA1 - 2013/14 74

Prostředí

Detektory Efektory

Matchující pravidla Množina akcí

Populace pravidel

GA BucketBrigade

Buffer zprávExterní stavy | Interní zprávy | Akce

Výběr akce

Odměna

Page 87: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Z(ero)CS

•  (Wilson,1994)simplifyLCS– Nointernalmessages– Nocomplicatedmechanismofrewardredistribu\on

•  Rulesarejustbitmap(and*)representa\ons:–  IF(inputs)THEN(outputs)

•  Coveroperator:–  Ifthereisnoruleforcurrentsitua\on/example,itisgeneratedadhoc

–  Randomlysome*areaddedandarandomoutputisselected

ROMANNERUDA:EVA1-2014/15

Page 88: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ZCScontd.

•  Howtherewardisdisr\buted/thestrengthofrulesismodified:–  Rulesnotapplicabletogivensitua\on:nothing–  Rulesapplicabletoinputbutwithdifferentoutput:decresethestrenghtbymul\plyingbyconstant0<T<1

–  Allrules’strenghtsaredecreasedbyasmallconstantB–  Thisamountiddistributeduniformlyamongtherulesthatansweredcorrectlyinthepreviousstep(decreasedbyafactor0<G<1)

–  Finally,theanswerofthesystemisdecreasedbyBanduniformelydistributedamongrulesthatanswerdcorrectlyinthisstep

ROMANNERUDA:EVA1-2014/15

Page 89: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

XCS–improvedZCS

•  ConsofZCS:–  ZCSdoesnottendtoevolveacompleterulesystemcoveringallcases

–  Rulesatthebeginningofthechainsareseldomrewardedandtheyarenotsurviving

–  Rulesleadingtoac\onswithsmallrewardscandieofftoo,althoughtheyareimportant

•  XCS:–  Separatefitnessfromexpectedoutcome/rewardoftherule

–  Basefitnessonthespecificityoftherule

ROMANNERUDA:EVA1-2014/15

Page 90: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Pi_

•  Individualsaresetsofrules,completesystems•  Theevalua\onismorecompicated– Rulepriori\es,conflicts– Falseposi\ves,falsenega\ves

•  Gene\coperatorsaremorecomplicated– Typically,dozenormoreoperatorsworkingossetsofrules,individualrules,termsintherules,...

•  Emphasisonrichdomainrepresenta\on(sets,enumera\ons,intervals,...)

ROMANNERUDA:EVA1-2014/15

Page 91: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

GIL,exampleofPi_aproach•  Binaryclassifica\ontasks•  Theindividualclassifiesimplicitlytooneclass(noright-handsideoftherules)

•  Eachindividualisadisjunc\onofcomplexes•  Complexisconjunc\onofselectors(from1variable)

•  Selectorisadisjunc\onofvaluesfromthevariabledomain

•  Representa\onbyabitmap:•  ((X=A1)AND(Z=C3))OR((X=A2)AND(Y=B2))•  [001|11|0011OR010|10|1111]

ROMANNERUDA:EVA1-2014/15

Page 92: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

GILcontd.•  Operatorsontheindividuallevel:–  Swapofrules,copyofrules,generaliza\onofrule,dele\onofrule,specializa\onofrule,inclusionofoneposi\veexampletotherule

•  Operatorsonthecomplexlevel:–  Splitofcomplexon1selector,generaliza\onofselector(replacingby11...1),specializa\onofgeneralizedselector,inclusionofonenega\veexample

•  Operatorsonselectors:– Muta\on0<->1,extension0->1,reduc\on1->0,

ROMANNERUDA:EVA1-2014/15

Page 93: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

MULTI-OBJECTIVEOPTIMIZATIONMul\-Objec\veEvolu\onaryAlgorithms(MOEA),Paretovafronta,NSGAII

ROMANNERUDA:EVA1-2014/15

Page 94: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Problem•  Insteadofonefitness(objec\vefunc\on),thereisavector

ofthemfi,i=1...n•  Forthesakeofsimplicity,weconsiderminimiza\oncase,

sowetrytoachieveminimalvaluesofallfi,whichisdifficult

•  Defini\onsofdominance(ofindividual,orasolu\on):–  Individualxweaklydominatesindividualy,ifffi(x)<=fi(y),proi=1..n

–  xdominatesy,iffitweaklydominateshim,andthereexistsj:n(x)<n(y)

–  xandyareuncomparable,whenneitherxdominatesy,norydominatesx

–  xdoesnotdominatey,ifeitherweaklydominatesx,ortheyareuncomparable

ROMANNERUDA:EVA1-2014/15

Page 95: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Paretofront

•  Paretofrontisasetofindividualsnotdominatedbyanyotheridividual

ROMANNERUDA:EVA1-2014/15

Page 96: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Thesimpleway

•  HowtosolveMOEAinasimple(simplis\c?)way:•  Aggregatethefitness:–  i.e.weightedsumofallfi,resul\nginonevalueoff– Andsolveitasastandardone-objec\veop\miza\on–  Thisoneissome\mes,inthecontextofMOEA,calledSOEA(singleobjec\veEA),butisisnothingnewtous,actuallyweweredoingonlySOEAsofar

•  Nevertheless,wedonotknowhowtosetweightsforindividualfi‘s.

ROMANNERUDA:EVA1-2014/15

Page 97: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

VEGA(VectorEvaluatedGA)•  OneofthefirstMOEAs,1985•  Idea:–  Popula\onofNindividualsissortedaccordingtoeachofthenobjec\vefunc\ons

–  ForeachiweselectN/nbestindividualsw.r.t.fi–  Thesearecrossedover,mutatedandselectedtonextgenera\on

•  Thisapproachinfact,haslotsofdisadvantages:–  Itisdifficulttopreserveadiversityofthepopula\on–  Ittendstoconvergetoop\malsolu\onsforindividualobjec\vesfi

ROMANNERUDA:EVA1-2014/15

Page 98: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

NSGA(non-dominatedsor\ngGA)•  1994,anideaofdominanceisusedforfitness•  Thiss\lldoesnotguaranteesufficientspredofpopula\on,itmustbedealtwithsomeotherway(niching)

•  Algorhitm:–  Popula\onPisdividedintoconsequentlycontructedfrontsF1,F2,...•  F1isasetofallnon-dominatedindividualsfromP•  F2isasetofallnon-dominatedindividualsfromP-F1•  F3…fromP-(F1disjunctedwithF2)•  ...

ROMANNERUDA:EVA1-2014/15

Page 99: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

NSGAcontd.•  Foreachindividualwecomputeanichingfaktor,asasum

ofsh(i,j)overallindividualsjfromthesamefront,where:–  sh(i,j)=1-[d(i,j)/dshare]^2,ford(i,j)<dshare–  sh(i,j)=0otherwise

•  d(i,j)isdistanceifromj•  dshareisaparameterofthealgorithm

•  Individualsfromthefirstfrontreceivesome„dummy“fitness,thatisdividedbyanichingfactor

•  Individualsfromthesecondfrontrecieveadummyfitnesssmallerthatthefitnessoftheworstindividualfromthefirstfront,anditisagaindividedbytheirnichingfactor

•  ...Forallfronts

ROMANNERUDA:EVA1-2014/15

Page 100: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

NSGAII

•  2000,repairingsomedrawbacksofNSGA:–  Necessitytosettherightdsharevalue–  Non-existenceofeli\sm

•  Niching–  Dshareanichecountisreplacedbyacrowdingdistance:–  Thisisasumofdistancestothenearestneighbours–  Thebestindividualsw.r.t.eachfi‘shavecrowdingdistancesettoinfinity

•  EliDsmus–  Oldandnewpopula\onsarejoined,sorted,thebe_erpartgoestonextgenera\on

ROMANNERUDA:EVA1-2014/15

Page 101: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

NSGAIIcontd.

•  Fitness:–  Eachindividualhasanumberofnon-dominatedfrontitisin,andacrowdingdistance

– Whencomparingtwoindividuals,firstafrontisconsidered(smallerisbe_er),andincaseofthesamefront,theircrowdingdistanceisconsidered(biggerisbe_er)

– Andinfact,nofitnessisreallycomputed,justthesetwonumbersarecomparedinatournamentselec\on

•  Andnowwehaveanimprovement–NSGAIIIROMANNERUDA:EVA1-2014/15

Page 102: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

COMBINATORIALOPTIMIZATIONEVAsolvesNP-hardproblems,TSP,permutaionrepresenta\ons

ROMANNERUDA:EVA1-2014/15

Page 103: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

EVAsolveshardtasks

•  0-1knapsackproblem–  Simpleencoding–  Problema\cfitness–  Standardoperators

•  TravellingSalesmanproblem(TSP)–  Simplefitness–  Problema\cencodingandopertators(crowwover,really)

•  Scheduling,planning,transporta\onproblems...

ROMANNERUDA:EVA1-2014/15

Page 104: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Knapsack

•  Given:– AknapsackofcapacityCMAX– Nitems,– eachhaveapricev(i)– andavolumec(i)

•  Thetaskistochooseitemssuchthat:– Maximizeasumv(i)– Atthesame\mewesqueezethemintoaknapsack,i.e.Sumofc(i)<=CMAX

ROMANNERUDA:EVA1-2014/15

Page 105: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Knapsack

•  Encoding–abitmap:– 0110010–takeitems2,3and6– Trivialalmost– Buttheindividualsmightnotsa\sfytheCMAXcondi\on

•  Operators:– Simplecrossover,muta\on,selec\on

•  Fitness:hastwoparts:– max[sumofv(i)]vs.min[CMAX–sumofc(i)]

ROMANNERUDA:EVA1-2014/15

Page 106: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Knapsack

•  So,wehaveamul\-objec\veop\miza\on:– Eitherweightemandaddem– OruseyourfavouriteMOEAfrompreviouschapter

– Or,changetheencodinginacleverway:•  1means:PUTtheitemintheknapsackUNLESSthecapacityisnotexceeded•  Thiswayweachieveanicepropertythatwithsuchadecoderallstringsinfactrepresentavalidsolu\on

ROMANNERUDA:EVA1-2014/15

Page 107: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Travellingsalesman

•  Nci\es,tourthemwithminimalcost•  Fitnessisclearcostofthetrip•  Reprezenta\onsaremany– Variantsofvertex-based– Edge-based,...

•  Operatorsareheavilydependentonrepresenta\on– Crossoverallowstouseheuris\cswemighthavetosolvetheTSP

ROMANNERUDA:EVA1-2014/15

Page 108: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Adjacencyrepresenta\on•  Pathisalistofci\es,cityjisatposi\onIiffthereisanedgefromitoj

•  Ex:–  (248397156)correspondsto1-2-4-3-8-5-9-6-7

•  Eachpathhas1representa\on,somelistsdonotgeneratevalidpaths

•  Notveryintui\ve•  Classicalcrowwoverdoesnotwork•  Butschematado:–  E.g.(*3*...)meansallpathswith2-3edge

•  Donotuseit.

ROMANNERUDA:EVA1-2014/15

Page 109: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Ordinal(orbuffer)representa\on

•  Mo\vova\onwastousethestandard1-pointcrossover–  Letushaveabufferofver\ces,maybejustordered,theencodingisinfactaposi\onofacityinthisbuffer

– Whenacityisused,itisdeletedfromabuffer

•  Ex:–  Buffer(123456789),andpath1-2-4-3-8-5-9-6-7isrepesentedas(112141311)

•  Donotuseiteither.

ROMANNERUDA:EVA1-2014/15

Page 110: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Path(orpermuta\on)representa\on

•  Probablyafirstideaofmostpeople•  Permuta\onrepresenta\onisimportantasnaturalformanyothertasks,aswell.–  path5-1-7-8-9-4-6-2-3isrepresentedas(517894623)

•  Thecrossoverdoesnotwork•  So,themainproblemwiththisrepresenta\onistoproposeacrossoveroperatorthatproducescorrectindividuals,andrepresentssomeideaabouthowagoodsolu\onshouldlooklike.–  PMX,CX,OX,...

ROMANNERUDA:EVA1-2014/15

Page 111: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

PMX•  Par\allymappedcrossover(Goldberg)•  Preserveasmanyci\esontheirposi\onsfromtheindividualsasyoucan.

•  2-point•  (123|4567|89)PMX(452|1876|93):–  (...|1876|..)(...|4567|..)–  andamapping1-48-57-66-7–  Canbeaddedd(.23|1876|.9)(..2|4567|93)– Accordingtothemapping

•  (423|1876|59)(182|4567|93)

ROMANNERUDA:EVA1-2014/15

Page 112: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

OX

•  Ordercrossover(Davis)•  Preserverela\veorderofci\esintheindividuals•  (123|4567|89)OX(452|1876|93):–  (...|1876|..)(...|4567|..)rearrangethepathfromthesecondcrossoverpoint

–  9-3-4-5-2-1-8-7-6– Deletecrossedoverci\esfrom1,remains:9-3-2-1-8–  Fillthefirstchild:(218|4567|93)–  Similarly,thesecondchild:(345|1876|92)

ROMANNERUDA:EVA1-2014/15

Page 113: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

CX

•  Cycliccrossover(Oliver)•  Preservetheabsoluteposi\oninthepath•  (123456789)CX(412876935)–  Firstposi\onatrandom,maybefromthfirstparent:P1=(1........),

– Nowwehavetotake4,P1=(1..4....),then8,3a2–  P1=(1234...8.),can’tcon\nue,wefillfromthesecondparent

–  P1=(123476985)–  SimilarlyP2=(412856739)

ROMANNERUDA:EVA1-2014/15

Page 114: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

ER

•  Edgerecombina\on(Whitleyetal)•  Observa\on:allpreviouscrossoverspreserveonlyabout60%ofedgesfrombothparents

•  TheERtriestopreserveasmanyedgesaspossible.–  Foreachcitymakealistofedges–  Startsomewhere(thefirstcity),–  Chooseci\eswithlessedges,–  Incaseofthesamenumberofedges,chooserandomly

ROMANNERUDA:EVA1-2014/15

Page 115: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

(123456789)ER(412876935)

•  1:924•  2:138•  3:2495•  4:351•  5:463•  6:579•  7:68•  8:792•  9:8163

•  Startin1,successorsare9,2,4•  9looses,has4succ.,from2and4

choosingatrandom4•  succ.of4are3and5,take5,•  Nowwehave(145......),andcon\nue•  ...(145678239)•  Itispossiblethatwecannotchoosean

edgeandthealgorithmfails,butitisveryrare(1-1.5%případů)

ROMANNERUDA:EVA1-2014/15

Page 116: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

(123456789)ER2(412876935)

•  1:9#24•  2:#138•  3:2495•  4:3#51•  5:#463•  6:5#79•  7:#6#8•  8:#792•  9:8163

•  ER2–improvingER•  Preservingmorecommonedges•  Markedgesthatexisttwiceby-#•  Theyarepriori\zedwhenchoosing

wheretogo.

ROMANNERUDA:EVA1-2014/15

Page 117: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Ini\aliza\onforTSP

•  Nearestneighbours:–  Startwitharanodmcity,–  Choosenextastheclosestfromthenotchosenyet

•  Edgeinser\on:–  ToapathT(startwithanedge)choosethenearestcitycnotinT

–  Findanedgek-jinTsoitminimizesthedifferencebetweenk-c-jandk-j

– Deletek-j,insertk-candc-jtoT

ROMANNERUDA:EVA1-2014/15

Page 118: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Muta\onforTSP

•  Inversion(!)•  Insertacityintoapath•  Shi�subpath•  Swap2ci\es•  Swapsubpaths•  Heuris\cssuchas2-optetc.

•  Taketwoedges,fourci\es,chooseothertwoedgesconnec\ngthese4ci\es

ROMANNERUDA:EVA1-2014/15

Page 119: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Otherapproaches

•  (Binary)matrixrepresenta\on:•  Either1onposi\on(i,j)meansanedgefromitoj•  Oritmeansthatiisbeforejinapath(morecommon)

–  Specificoperatorsofmatrixcrossover:•  Conjunc\on–bitwiseANDandrandominser\onofedges•  Disjunc\on–dissectintoquadrants,2ofthemdelete,removecontradic\ons,insertedgesatrandom

•  Combina\onwithlocalheuris\cs–  Evolu\onarystrategywhichimprovespathsby“smartmuta\ons”–heuris\cslike2-opt,3-opt

ROMANNERUDA:EVA1-2014/15

Page 120: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Othertasks-scheduling

•  SchedulingisNP-hard:–  Individualisasechedule,directmatrixencoding

•  Rowsareteachers,columnsclasses,valuesarecodesofsubjects•  Muta\on–mixthesubjects•  Crossover–swapbe_errowsfromindividuals

–  Fitness•  Fitnessofarow(howateacherissa\sfied)•  Otherso�criteriaandconstrainsabouttheschedulequality

–  Hardconstrains•  Mustrespectinoperators,otherwisetoomanyinadmissablesolu\onsaregenerated

•  Teachersconstrains,when,wherewhattoteach,…

ROMANNERUDA:EVA1-2014/15

Page 121: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Othertasks–jobshopscheduling•  Produc\onplanning

•  productso1…oN,frompartsp1…pK,foreachpartmoreplanshowtoproduceitonmachinesm1…mM,machineshavedifferent\mesforsetuptoadifferentproduct

•  Fitness–produc\on\me•  Encodingiscri\cal:–  Permuta\on–planisjustapermuta\nofproductsorder.Decodermustchooseplansforparts.Simplerepresenta\on,canuseTSP-inspiredcrossovers.Butshowsnotveryefficient,decodersolvesthecomplicatedpart,TSPoperatorsnotsuitable.

–  Directrepresenta\onofindividualasthecompleteplan–specializedandcomplexevolu\onaryoperators.

ROMANNERUDA:EVA1-2014/15

Page 122: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

NEUROEVOLUTIONJustanintroduc\on,thecoolapproachesareintheEVAII

ROMANNERUDA:EVA2-2013/14 122

Page 123: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

LearnneuralnetworksbyEVA

•  Firstexperimentsin80s•  Learntheparameters(weights)•  Learnthestructure(architecture,connec\ons)•  Learnweightsandstructuretogether•  Reinforcementlearningtasks–whenthereisnosupervisedalgorithm(robo\cs)

•  Hybridmethods–combina\onofEVAwithlocalsearchetc

ROMANNERUDA:EVA2-2013/14 123

Page 124: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Learntheweights•  Direct:–  Encodetheweightstoa(floa\ngpoint)vector,–  floa\ngpointGA,standardoperators–  Evolu\onarystrategies,…

•  Usuallyslowerthanspecializedgradientbasedlocalalgorithms,butcanberobust

•  Useminibatches•  Canbeparallelizedeasily•  Canbeusedforreinforcementlearningwheretheresnogradient(robo\cs)

ROMANNERUDA:EVA2-2013/14 124

Page 125: EVA I - Department of Theoretical Computer Science and ...ktiml.mff.cuni.cz/~neruda/eva1-16en.pdf · EVOLUTIONARY ALGORITHMS Biological mo\vaon , basic parts ROMAN NERUDA: EVA1 -

Learnthestructure

•  Fitness=buildthenetwork,ini\alizeatrandom,train,several\mes

•  Directencoding–  Representthestructureasbinarymatrix–  Linearizetherelevantpartofthematrixintoabinaryvector

•  Grama\calencoding,Kitano–  Individualisarepresenta\onof2Dformalgrammarthatareaprogramtocreatethebinarymatrixrepresen\ngthestrucrureoftheneuralnet

–  Boldbuttoheavy-weightsolu\on,notusedinprac\ce

ROMANNERUDA:EVA2-2013/14 125