遗传算法求解函数Fx1,x2100x12x221x12
的最大值MATLAB
Ge
ericAlgorithmforfu
ctio
fx1x2optimum(最大值)clearallcloseall
ParametersSize80G100CodeL10
umax2048umi
2048
Erou
dra
dSize2CodeLI
itialCode
Mai
Programfork11Gtimekk
fors11SizemEsy10y20
U
codi
gm1m11CodeLfori11CodeL
y1y1m1i2i1e
dx1umaxumi
y11023umi
m2mCodeL112CodeLfori11CodeL
y2y2m2i2i1e
dx2umaxumi
y21023umi
Fs100x12x221x12e
d
Ji1F1
fStep1EvaluateBestJBestJkmi
Ji
fiFOderfiI
dexfisortfiBestfiOderfiSizeBestSEI
dexfiSizemaxfibfikBestfi
Fit
essFu
ctio
Arra
gi
gfismalltobigger
LetBestfimaxfiLetBestSEmmistheI
dexfibelo
gto
Step2Selecta
dReproductOperatio
fi_sumsumfifi_SizeOderfifi_sumSize
fi_Sfloorfi_Size
Selecti
gBiggerfivalue取整
kk1
fori11Size
forj11fi_Si
Selecta
dReproduce
TempEkkEI
dexfii
kkkk1
kkisusedtoreproduce
e
d
e
d
Step3CrossoverOperatio
pc060
ceil20ra
d
fori12Size1
tempra
d
ifpctemp
CrossoverCo
ditio
forj
120
TempEijEi1j
TempEi1jEij
e
d
e
d
e
d
TempESizeBestS
ETempE
Step4Mutatio
Operatio
pm0001pm000111Size0001SizeBiggerfismallerPmpm00Nomutatio
pm01Bigmutatio
ffori11Sizeforj112CodeLtempra
difpmtempifTempEij0TempEij1elseTempEij0e
de
de
d
e
d
Mutatio
Co
ditio
Guara
teeTempPop30isthecodebelo
gtothebesti
dividualmaxfiTempESizeBestSETempEe
d
Max_ValueBestfiBestSx1x2figure1plottimeBestJxlabelTimesylabelBestJfigure2plottimebfixlabeltimesylabelBestF
f行绒果
Map_Falue
39059e03
BestS
0000
000000
00000000Р0
1
20480
fx220080
fr