(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 64897, 1427]*) (*NotebookOutlinePosition[ 65655, 1454]*) (* CellTagsIndexPosition[ 65611, 1450]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Optimisation", "Title"], Cell[CellGroupData[{ Cell["\<\ \[CapitalEAcute]tapes de la d\[EAcute]marche d'optimisation par \ algorithme g\[EAcute]n\[EAcute]tique\ \>", "Subsubsection"], Cell["\<\ 1. Commencer avec une population d'individus (chromosomes) g\ \[EAcute]n\[EAcute]r\[EAcute]s al\[EAcute]atoirement. 2. D\[EAcute]terminer l'adaptation de chaque individu dans la population 3. S\[EAcute]lectionner l'individu le mieux adapt\[EAcute] 4. Utiliser cet individu pour produire la nouvelle g\[EAcute]n\[EAcute]ration 5. Faire \[EAcute]voluer la population en r\[EAcute]p\[EAcute]tant les \ \[EAcute]tapes 2 \[AGrave] 4.\ \>", "Text"], Cell["Liste des composantes de la fonction \[AGrave] minimiser :", \ "Subsubsection"], Cell[BoxData[ \(\(yi = {0.0015 x^2 + 1.8 x + 40, \[IndentingNewLine]0.003 x^2 + 1.7 x + 60, \[IndentingNewLine]0.0126 x^2 + 2.1 x + 100, \[IndentingNewLine]0.08 x^2 + 2 x + 25, \[IndentingNewLine]0.001 x^2 + 1.9 x + 120};\)\)], "Input"], Cell["Contraintes impos\[EAcute]es sur les composantes de la fonction :", \ "Subsubsection"], Cell[BoxData[ \(\(\(\ \)\(\(ci = {100 \[LessEqual] x \[LessEqual] 300, 80 \[LessEqual] x \[LessEqual] 150, 80 \[LessEqual] x \[LessEqual] 200, 20 \[LessEqual] x \[LessEqual] 100, 100 \[LessEqual] x \[LessEqual] 300};\)\[IndentingNewLine] \(xmin = 0;\)\[IndentingNewLine] \(xmax = 400;\)\)\)\)], "Input"], Cell["Repr\[EAcute]sentation des composantes de la fonction :", \ "Subsubsection"], Cell[CellGroupData[{ Cell[BoxData[ \(\(Plot[{\[IndentingNewLine]If[ci[\([1]\)], yi[\([1]\)], 0], \[IndentingNewLine]If[ci[\([2]\)], yi[\([2]\)], 0], \[IndentingNewLine]If[ci[\([3]\)], yi[\([3]\)], 0], \[IndentingNewLine]If[ci[\([4]\)], yi[\([4]\)], 0], \[IndentingNewLine]If[ci[\([5]\)], yi[\([5]\)], 0]}, {x, xmin, xmax}, PlotStyle \[Rule] Table[Hue[n], {n, 0, 1 - 1/Length[yi], 1/Length[yi]}]];\)\)], "Input"], Cell[GraphicsData["PostScript", "\<\ %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart /Mabs { Mgmatrix idtransform Mtmatrix dtransform } bind def /Mabsadd { Mabs 3 -1 roll add 3 1 roll add exch } bind def %% Graphics %%IncludeResource: font Courier %%IncludeFont: Courier /Courier findfont 10 scalefont setfont % Scaling calculations 0.0238095 0.00238095 0.0147151 0.00057543 [ [.2619 .00222 -9 -9 ] [.2619 .00222 9 0 ] [.5 .00222 -9 -9 ] [.5 .00222 9 0 ] [.7381 .00222 -9 -9 ] [.7381 .00222 9 0 ] [.97619 .00222 -9 -9 ] [.97619 .00222 9 0 ] [.01131 .1298 -18 -4.5 ] [.01131 .1298 0 4.5 ] [.01131 .24489 -18 -4.5 ] [.01131 .24489 0 4.5 ] [.01131 .35997 -18 -4.5 ] [.01131 .35997 0 4.5 ] [.01131 .47506 -18 -4.5 ] [.01131 .47506 0 4.5 ] [.01131 .59015 -24 -4.5 ] [.01131 .59015 0 4.5 ] [ 0 0 0 0 ] [ 1 .61803 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath 0 g .25 Mabswid [ ] 0 setdash .2619 .01472 m .2619 .02097 L s [(100)] .2619 .00222 0 1 Mshowa .5 .01472 m .5 .02097 L s [(200)] .5 .00222 0 1 Mshowa .7381 .01472 m .7381 .02097 L s [(300)] .7381 .00222 0 1 Mshowa .97619 .01472 m .97619 .02097 L s [(400)] .97619 .00222 0 1 Mshowa .125 Mabswid .07143 .01472 m .07143 .01847 L s .11905 .01472 m .11905 .01847 L s .16667 .01472 m .16667 .01847 L s .21429 .01472 m .21429 .01847 L s .30952 .01472 m .30952 .01847 L s .35714 .01472 m .35714 .01847 L s .40476 .01472 m .40476 .01847 L s .45238 .01472 m .45238 .01847 L s .54762 .01472 m .54762 .01847 L s .59524 .01472 m .59524 .01847 L s .64286 .01472 m .64286 .01847 L s .69048 .01472 m .69048 .01847 L s .78571 .01472 m .78571 .01847 L s .83333 .01472 m .83333 .01847 L s .88095 .01472 m .88095 .01847 L s .92857 .01472 m .92857 .01847 L s .25 Mabswid 0 .01472 m 1 .01472 L s .02381 .1298 m .03006 .1298 L s [(200)] .01131 .1298 1 0 Mshowa .02381 .24489 m .03006 .24489 L s [(400)] .01131 .24489 1 0 Mshowa .02381 .35997 m .03006 .35997 L s [(600)] .01131 .35997 1 0 Mshowa .02381 .47506 m .03006 .47506 L s [(800)] .01131 .47506 1 0 Mshowa .02381 .59015 m .03006 .59015 L s [(1000)] .01131 .59015 1 0 Mshowa .125 Mabswid .02381 .04349 m .02756 .04349 L s .02381 .07226 m .02756 .07226 L s .02381 .10103 m .02756 .10103 L s .02381 .15857 m .02756 .15857 L s .02381 .18734 m .02756 .18734 L s .02381 .21612 m .02756 .21612 L s .02381 .27366 m .02756 .27366 L s .02381 .30243 m .02756 .30243 L s .02381 .3312 m .02756 .3312 L s .02381 .38874 m .02756 .38874 L s .02381 .41752 m .02756 .41752 L s .02381 .44629 m .02756 .44629 L s .02381 .50383 m .02756 .50383 L s .02381 .5326 m .02756 .5326 L s .02381 .56137 m .02756 .56137 L s .25 Mabswid .02381 0 m .02381 .61803 L s 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath 1 0 0 r .5 Mabswid .02381 .01472 m .06244 .01472 L .10458 .01472 L .14415 .01472 L .18221 .01472 L .22272 .01472 L .24141 .01472 L .25127 .01472 L .25666 .01472 L .2593 .01472 L .26045 .01472 L .26171 .01472 L .26301 .1505 L .26425 .15113 L .26698 .15252 L .27279 .15548 L .28302 .16072 L .30316 .17114 L .3438 .19253 L .38293 .2136 L .42451 .2365 L .46458 .25906 L .50313 .28123 L .54413 .30531 L .58362 .32898 L .62159 .35219 L .66202 .37738 L .70093 .4021 L .7111 .40864 L .72217 .41579 L .72723 .41908 L .73262 .42258 L .73483 .42402 L .73599 .42477 L .73721 .42557 L .73786 .426 L .73858 .01472 L .73983 .01472 L .74229 .01472 L .78285 .01472 L .82189 .01472 L .86339 .01472 L .90337 .01472 L .94184 .01472 L .97619 .01472 L s .8 1 0 r .02381 .01472 m .06244 .01472 L .10458 .01472 L .14415 .01472 L .18221 .01472 L .20178 .01472 L .20742 .01472 L .21019 .01472 L .2114 .01472 L .21274 .01472 L .21394 .01472 L .21506 .13896 L .21625 .13958 L .21753 .14026 L .22272 .14301 L .26394 .16546 L .30365 .18806 L .34184 .21071 L .36152 .22272 L .36718 .22622 L .37252 .22954 L .37731 .23253 L .37862 .23335 L .37934 .2338 L .38 .23422 L .38119 .01472 L .38249 .01472 L .4214 .01472 L .46276 .01472 L .5026 .01472 L .54093 .01472 L .58171 .01472 L .62098 .01472 L .65873 .01472 L .69893 .01472 L .73762 .01472 L .77876 .01472 L .81839 .01472 L .85649 .01472 L .89706 .01472 L .9361 .01472 L .97619 .01472 L s 0 1 .4 r .02381 .01472 m .06244 .01472 L .10458 .01472 L .14415 .01472 L .18221 .01472 L .20178 .01472 L .20742 .01472 L .21019 .01472 L .2114 .01472 L .21274 .01472 L .21394 .01472 L .21506 .21611 L .21625 .21729 L .21753 .21857 L .22272 .22381 L .26394 .26788 L .30365 .31444 L .34184 .36303 L .38249 .41884 L .42162 .47656 L .44159 .50753 L .4632 .54219 L .47335 .55887 L .48407 .57679 L .49322 .59231 L .49573 .59661 L .49711 .59898 L .49842 .60122 L .49963 .60332 L .50095 .01472 L .50215 .01472 L .50327 .01472 L .54253 .01472 L .58028 .01472 L .62049 .01472 L .65917 .01472 L .70031 .01472 L .73994 .01472 L .77805 .01472 L .81861 .01472 L .85765 .01472 L .89915 .01472 L .93913 .01472 L .97619 .01472 L s 0 .4 1 r .02381 .01472 m .04262 .01472 L .0522 .01472 L .06244 .01472 L .06525 .01472 L .0679 .01472 L .06905 .01472 L .07027 .01472 L .07091 .01472 L .07162 .07077 L .07286 .07234 L .08255 .08552 L .10458 .12112 L .14487 .20662 L .18364 .3138 L .20335 .37764 L .22486 .45453 L .23483 .4927 L .24546 .53517 L .25062 .55646 L .25548 .57692 L .25761 .58598 L .25985 .59562 L .26102 .60069 L .26231 .01472 L .26348 .01472 L .26457 .01472 L .30348 .01472 L .34484 .01472 L .38469 .01472 L .42302 .01472 L .4638 .01472 L .50307 .01472 L .54082 .01472 L .58102 .01472 L .61971 .01472 L .66085 .01472 L .70047 .01472 L .73858 .01472 L .77914 .01472 L .81819 .01472 L .85968 .01472 L .89966 .01472 L .93813 .01472 L .97619 .01472 L s .8 0 1 r .02381 .01472 m .06244 .01472 L .10458 .01472 L .14415 .01472 L .18221 .01472 L .22272 .01472 L .24141 .01472 L .25127 .01472 L .25666 .01472 L .2593 .01472 L .26045 .01472 L .26171 .01472 L .26301 .19941 L .26425 .20004 L .26698 .20143 L .27279 .20439 L .28302 .20961 L .30316 .21996 L .3438 .2411 L .38293 .26176 L .42451 .28406 L .46458 .30589 L .50313 .32719 L .54413 .35018 L .58362 .37264 L .62159 .39454 L .66202 .41817 L .70093 .44123 L .7111 .44731 L .72217 .45395 L .72723 .457 L .73262 .46024 L .73483 .46158 L .73599 .46228 L .73721 .46302 L .73786 .46341 L .73858 .01472 L .73983 .01472 L .74229 .01472 L .78285 .01472 L .82189 .01472 L .86339 .01472 L .90337 .01472 L .94184 .01472 L .97619 .01472 L s % End of Graphics MathPictureEnd \ \>"], "Graphics", ImageSize->{250, 154.5}, ImageMargins->{{28, 0}, {0, 0}}, ImageRegion->{{0, 1}, {0, 1}}, ImageCache->GraphicsData["Bitmap", "\<\ CF5dJ6E]HGAYHf4PAg9QL6QYHgooooo`03o`1Voooo oooooooo027ooooo00?o0?mVolco0?ooool02oooool00oo<0?ooooooooooo`0Nooooo`03olco0?oo oooooooo01oooooo00?o0?mVooooooooool0?oooool00oo<0?ooooooooooo`1ooooo`03olco0?oooooooooo00Oooooo0_oo0004ooooo`03olco0?oooooo oooo01oooooo00?o0?mVooooooooool0?oooool00oo<0?ooooooooooo`1ooo ool00oo<0?ooooooooooo`1ooooo`03o`3oI_oooooooooo02oooooo00?o0?mVoooo ooooool01?ooool2ol`0oaCooooo00?oo`00ooooooooool08oooool00oo<0?ooooooooooo`1ooooo`03o`1Voooooooooooo01Cooooo00?o 0?mVooooooooool0:Oooool00ol0ofKoooooooooo`0Booooo`;oc03o4_ooool2ool001Sooooo00?o c03oooooooooool0C?ooool000Oooooo00?oEEEEohN7Qoooool01Oooool01Ol@413ooooooooooooo oooo410@00?ooooo00Go410@oooooooooooooooooa0@4005ooooo`03o`000?oooooooooo02kooooo 00?o06Koooooooooool03_ooool00ol0I_ooooooooooo`0Eooooo`03o`3oI_oooooooooo02Sooooo 00?o0?mVooooooooool05?ooool00oo<0?ooooooooooo`0Aooooo`03ool00?oooooooooo01Gooooo 00?oc03oooooooooool0C?ooool000Oooooo00?ogMgMoa0@4?nHV9P01Oooool01OmgMgOoV9RHoooo oonHV9SoMgMg00?ooooo00GoMgMgoiRHV?ooooooV9RHogMgM`05ooooo`03o`000?oooooooooo02oo oooo00?o06Koooooooooool03Oooool00ol0I_ooooooooooo`0Fooooo`03o`3oI_oooooooooo02Oo oooo00?o0?mVooooooooool05Oooool2ol`0oa;ooooo0_oo000Eooooo`03ol`0oooooooooooo04co oooo0008ooooo`04olcooooo`008Oooool00ol0003oooooooooo`0boooo o`03o`1Voooooooooooo00[ooooo00?o06Koooooooooool07oooool00ol0ofKoooooooooo`0Noooo o`03o`3oI_oooooooooo02gooooo00?oc03oooooooooool03Oooool2ool00003ooooooo<0?oooooo 04gooooo000Qooooo`03o`000?oooooooooo03;ooooo00?o06Koooooooooool02_ooool00ol0I_oo ooooooooo`0Oooooo`03o`3oI_oooooooooo01kooooo00?o0?mVooooooooool0;_ooool2ol`0o`oo oooo00?oo`00ol`0ooooool0COooool0027ooooo00?o0000ooooooooool0ooo ool00oo<0?ooooooooooo`02ooooo`03ol`0oooooooooooo04cooooo000Qooooo`03o`000?oooooo oooo03Gooooo00?o06Koooooooooool01oooool00ol0I_ooooooooooo`0Uooooo`03o`3oI_oooooo oooo01Sooooo00?o0?mVooooooooool0??ooool01Oo<0?ooooooooooooooooooc03o04kooooo000Q ooooo`03o`000?oooooooooo03Gooooo00?o06Koooooooooool01oooool00ol0I_ooooooooooo`0V ooooo`03o`3oI_oooooooooo01Oooooo00?o0?mVooooooooool0?Oooool2ol`0o`03ooooooo<0?oo oooo04gooooo000Qooooo`03o`000?oooooooooo03Gooooo00?o06Koooooooooool01oooool00ol0 I_ooooooooooo`0Vooooo`03o`3oI_oooooooooo01Oooooo00?o0?mVooooooooool0?oooool2ol`0 odkooooo000Qooooo`03o`000?oooooooooo03Gooooo00?o06Koooooooooool01oooool00ol0I_oo ooooooooo`0Wooooo`03o`3oI_oooooooooo01Kooooo00?o0?mVooooooooool0?oooool2ol`0odko oooo0007ooooo`05olc?ooool00ol0I_oooooo ooooo`04ooooo`03o`1Voooooooooooo02cooooo00?o0?mVooooooooool04Oooool00ol0ofKooooo ooooo`2?ooooo`001oooool01OnYZJWo410@o`000?l@413oZJVY00?ooooo00Gok^k^oc8b<_l0003o ?ooool00ol0I_ooooooooooo`04ooooo`03o`1V oooooooooooo02kooooo00?o0?mVooooooooool03oooool00ol0ofKoooooooooo`2?ooooo`008Ooo ool2o`0003[ooooo00?o06Koooooooooool00oooool00ol0I_ooooooooooo`0_ooooo`03o`3oI_oo oooooooo00kooooo00?o0?mVooooooooool0Soooool0027ooooo00?o0000ooooooooool0>Oooool0 0ol0I_ooooooooooo`03ooooo`03o`1Voooooooooooo033ooooo00?o0?mVooooooooool03Oooool0 0ol0ofKoooooooooo`2?ooooo`008Oooool00ol0003oooooooooo`0iooooo`03o`1Voooooooooooo 00?ooooo00?o06Koooooooooool0_ooool00ol0I_ooooooooooo`02ooooo`03o`1Voooooooooooo03;ooooo 00?o0?mVooooooooool02oooool00ol0ofKoooooooooo`2?ooooo`008Oooool00ol0003ooooooooo o`0jooooo`03o`1Voooooooooooo00;ooooo00?o06Koooooooooool0<_ooool00ol0ofKooooooooo o`0;ooooo`03o`3oI_oooooooooo08oooooo000Qooooo`03o`000?oooooooooo03[ooooo00?o06Ko ooooooooool00_ooool00ol0I_ooooooooooo`0cooooo`03o`3oI_oooooooooo00[ooooo00?o0?mV ooooooooool0Soooool0027ooooo00?o0000ooooooooool0>_ooool00ol0I_ooooooooooo`02oooo o`03o`1Voooooooooooo03?ooooo00?o0?mVooooooooool02_ooool00ol0ofKoooooooooo`2?oooo o`008Oooool2o`0003cooooo00Go06Koooooooooooooooooo`1Vo`0fooooo`03o`3oI_oooooooooo 00Wooooo00?o0?mVooooooooool0Soooool0027ooooo00?o0000ooooooooool0>oooool01Ol0I_oo oooooooooooooooo06Ko03Oooooo00?o0?mVooooooooool02?ooool00ol0ofKoooooooooo`2?oooo o`008Oooool00ol0003oooooooooo`0kooooo`05o`1Vooooooooooooooooool0I_l0=oooool00ol0 ofKoooooooooo`08ooooo`03o`3oI_oooooooooo08oooooo000Qooooo`03o`000?oooooooooo03co oooo00Co06Kooooooooooooo06Ko>?ooool00ol0ofKoooooooooo`07ooooo`03o`3oI_oooooooooo 08oooooo000Qooooo`03o`000?oooooooooo03cooooo00Co06Kooooooooooooo06Ko>?ooool00ol0 ofKoooooooooo`07ooooo`03o`3oI_oooooooooo08oooooo000Qooooo`03o`000?oooooooooo03co oooo00Co06Kooooooooooooo06Ko>Oooool00ol0ofKoooooooooo`06ooooo`03o`3oI_oooooooooo 08oooooo000Qooooo`03o`000?oooooooooo03gooooo00?o06Koooooool0I_l0>_ooool00ol0ofKo ooooooooo`05ooooo`03o`3oI_oooooooooo08oooooo000Qooooo`03o`000?oooooooooo03gooooo 00?o06Koooooool0I_l0>_ooool00ol0ofKoooooooooo`05ooooo`03o`3oI_oooooooooo08oooooo 000Qooooo`;o0000?_ooool00ol0I_ooooooo`1Vo`0kooooo`03o`3oI_oooooooooo00Cooooo00?o 0?mVooooooooool0Soooool0027ooooo00?o0000ooooooooool0?Oooool00ol0I_ooooooo`1Vo`0k ooooo`03o`3oI_oooooooooo00Cooooo00?o0?mVooooooooool0Soooool0027ooooo00?o0000oooo ooooool0?Oooool00ol0I_ooooooo`1Vo`0looooo`03o`3oI_oooooooooo00?ooooo00?o0?mVoooo ooooool0Soooool0027ooooo00?o0000ooooooooool0?_ooool2o`1Vocgooooo00?o0?mVoooooooo ool00_ooool00ol0ofKoooooooooo`2?ooooo`008Oooool00ol0003oooooooooo`0nooooo`;o06Ko ?Oooool00ol0ofKoooooooooo`02ooooo`03o`3oI_oooooooooo08oooooo000Qooooo`03o`000?oo oooooooo03kooooo0_l0I_lnooooo`05o`3oI_ooooooooooooooool0ofH0TOooool000Co000000So 410@ooooooooooook^k^oc8b<_l0003oOooool00?oooooo>Oooool00?oooooo >Oooool00?oooooo>Oooool00001\ \>"], ImageRangeCache->{{{0, 311.5}, {192.125, 0}} -> {-50.2384, -117.566, \ 1.87444, 7.75585}}] }, Open ]], Cell["1. Composer un \[LeftGuillemet]chromosome\[RightGuillemet]", \ "Subsubsection"], Cell[TextData[{ "Les valeurs ", Cell[BoxData[ FormBox[ SubscriptBox[ StyleBox["x", FontSlant->"Italic"], "i"], TextForm]]], " prises par chaque composante peuvent \[EHat]tre \ consid\[EAcute]r\[EAcute]es comme les \[LeftGuillemet]all\[EGrave]les\ \[RightGuillemet] ou valeurs des \[LeftGuillemet]g\[EGrave]nes\ \[RightGuillemet] d'un \[LeftGuillemet]chromosome\[RightGuillemet]. Tirons au \ hasard ces valeurs dans les domaines de d\[EAcute]finition des composantes de \ la fonction :" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[{ \(\(dom = {{100, 300}, {80, 150}, {80, 200}, {20, 100}, {100, 300}};\)\), "\[IndentingNewLine]", \(\(but = 765;\)\), "\[IndentingNewLine]", \(init = Table[Random[Real, dom[\([i]\)]], {i, Length[yi]}]\)}], "Input"], Cell[BoxData[ \({265.0346583510013`, 132.5538700084016`, 100.986192629243`, 58.22089185545753`, 201.05604014346574`}\)], "Output"] }, Open ]], Cell["2. D\[EAcute]terminer l'\[LeftGuillemet]adaptation\[RightGuillemet] du \ \[LeftGuillemet]chromosome\[RightGuillemet] ", "Subsubsection"], Cell["\<\ Calculons l'\[EAcute]cart entre la somme des composante et le \ \[LeftGuillemet]but\[RightGuillemet] :\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Abs[Apply[Plus, init] - but]\)], "Input"], Cell[BoxData[ \(7.148347012430804`\)], "Output"] }, Open ]], Cell[TextData[{ "Ainsi que la valeur de la fonction avec avec les valeurs ", Cell[BoxData[ FormBox[ SubscriptBox[ StyleBox["x", FontSlant->"Italic"], "i"], TextForm]]], " obtenues :" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Sum[yi[\([i]\)] /. x \[Rule] init[\([i]\)], {i, Length[yi]}]\)], "Input"], Cell[BoxData[ \(2356.0946401402744`\)], "Output"] }, Open ]], Cell["\<\ Le \[LeftGuillemet]chromosome\[RightGuillemet] le mieux adapt\ \[EAcute] sera celui qui minimise une certaine \[LeftGuillemet]distance\ \[RightGuillemet].. Nous utilisons ici l'\[EAcute]cart comme distance pour \ mesurer l'\[LeftGuillemet]adaptation\[RightGuillemet].\ \>", "Text"], Cell["\<\ 3. S\[EAcute]lectionner, parmi une population, un \ \[LeftGuillemet]chromosome\[RightGuillemet] bien adapt\[EAcute]\ \>", \ "Subsubsection"], Cell[TextData[{ "G\[EAcute]n\[EAcute]rons une population de ", StyleBox["n", FontSlant->"Italic"], " \[LeftGuillemet]chromosomes\[RightGuillemet] et trions-la par ordre d\ \[EAcute]croissant des distances :" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[{ \(\(n = 3;\)\), "\[IndentingNewLine]", \(pop = Sort[Table[ RotateLeft[{poptemp = Table[Random[Real, dom[\([i]\)]], {i, Length[yi]}], Abs[Apply[Plus, poptemp] - but], Sum[yi[\([i]\)] /. x \[Rule] poptemp[\([i]\)], {i, Length[yi]}]}], {n}]]\)}], "Input"], Cell[BoxData[ \({{39.843671139738035`, 2510.0462102069473`, {155.14088002696928`, 117.30722648827691`, 152.64168641842588`, 67.44244492417602`, 232.62409100241385`}}, {54.339045158386284`, 2397.2501946688053`, {230.08700039413665`, 136.15685351058374`, 195.05745854073152`, 31.98117344994835`, 117.37846894621347`}}, {126.75853097471895`, 3198.906037997335`, {292.620139138437`, 103.13811000585207`, 196.91022619035837`, 76.14571667875026`, 222.9443389613211`}}}\)], "Output"] }, Open ]], Cell["", "Text"], Cell["\<\ S\[EAcute]lectionnons maintenant un \[LeftGuillemet]chromosome\ \[RightGuillemet] parmi les mieux adapt\[EAcute]s (jusqu'\[AGrave] une \ profondeur \[LeftGuillemet]prof\[RightGuillemet]) :\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[{ \(\(prof = 3;\)\), "\[IndentingNewLine]", \(\(pop[\([Random[Integer, {1, prof}]]\)]\)[\([2]\)]\)}], "Input"], Cell[BoxData[ \(2397.2501946688053`\)], "Output"] }, Open ]], Cell["4. G\[EAcute]n\[EAcute]rer une population \[AGrave] partir d'un \ \[LeftGuillemet]chromosome\[RightGuillemet]", "Subsubsection"], Cell[TextData[{ "Pour g\[EAcute]n\[EAcute]rer une nouvelle population \[AGrave] partir du \ chromosome retenu, nous utiliserons la fonction \[LeftGuillemet]boole\ \[RightGuillemet] qui donne \[LeftGuillemet]vrai\[RightGuillemet] lorsque la \ probabilit\[EAcute] ", StyleBox["p", FontSlant->"Italic"], " de muter est sup\[EAcute]rieure ou \[EAcute]gale \[AGrave] un nombre tir\ \[EAcute] au hasard :" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(boole[p_] := If[Random[] \[LessEqual] p, \ True, False]\)], "Input"], Cell[BoxData[ RowBox[{\(General::"spell1"\), \(\(:\)\(\ \)\), "\<\"Possible spelling \ error: new symbol name \\\"\\!\\(boole\\)\\\" is similar to existing symbol \ \\\"\\!\\(Boole\\)\\\". \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", \ ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \ ButtonData:>\\\"General::spell1\\\"]\\)\"\>"}]], "Message"] }, Open ]], Cell[TextData[{ "La fonction \[LeftGuillemet]muter\[RightGuillemet] nous permettra ainsi de \ modifier, avec une probabilit\[EAcute] ", StyleBox["p", FontSlant->"Italic"], StyleBox[", la valeur d'un g\[EGrave]ne ", FontVariations->{"CompatibilityType"->0}], StyleBox["g. \n", FontSlant->"Italic", FontVariations->{"CompatibilityType"->0}], StyleBox["En cas de mutation, la nouvelle valeur du g\[EGrave]ne est une de \ celles du chromosome retenu :", FontVariations->{"CompatibilityType"->0}] }], "Text"], Cell[BoxData[ \(muter[p_, g_, parent_] := If[boole[p], \[IndentingNewLine]parent[\([Random[ Integer, {1, Length[parent]}]]\)], g]\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(p = 0.2; \ (*\ probabilit\[EAcute]\ de\ mutation\ *) \[IndentingNewLine]Map[ muter[p, #, \(pop[\([1]\)]\)[\([2]\)]] &, \(pop[\([Random[ Integer, {1, prof}]]\)]\)[\([2]\)]]\)], "Input"], Cell[BoxData[ \(3198.906037997335`\)], "Output"] }, Open ]], Cell["\<\ Rassemblons les instructions permettant d'obtenir: \[Bullet] le liste des valeurs initiales \[Bullet] l'\[EAcute]cart au but (pour les valeurs initiales) \[Bullet] la valeur de la fonction (pour les valeurs initiales) \[Bullet] la nouvelle g\[EAcute]n\[EAcute]ration \[Bullet] les valeurs de l'individu le mieux adapt\[EAcute] de cette g\ \[EAcute]n\[EAcute]ration\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[{ \(\(n = 10;\)\ (*\ nombre\ d' individus\ dans\ le\ population\ *) \), "\[IndentingNewLine]", \(\(prof = 3;\)\ (*\ profondeur\ de\ recherche\ d' un\ individu\ adapt\[EAcute]\ *) \), "\[IndentingNewLine]", \(\(p = 0.2;\)\ (*\ probabilit\[EAcute]\ de\ mutation\ *) \), "\[IndentingNewLine]", \(\(dom = {{100, 300}, {80, 150}, {80, 200}, {20, 100}, {100, 300}};\)\), "\[IndentingNewLine]", \(\(but = 756;\)\ \[IndentingNewLine]\), "\[IndentingNewLine]", \(\(\(yi = {0.0015 x^2 + 1.8 x + 40, \[IndentingNewLine]0.003 x^2 + 1.7 x + 60, \[IndentingNewLine]0.0126 x^2 + 2.1 x + 100, \[IndentingNewLine]0.08 x^2 + 2 x + 25, \[IndentingNewLine]0.001 x^2 + 1.9 x + 120};\)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(boole[p_] := If[Random[] \[LessEqual] p, \ True, False]\), "\[IndentingNewLine]", \(\(\(muter[pmute_, g_, parent_] := If[boole[ pmute], \[IndentingNewLine]parent[\([Random[ Integer, {1, Length[parent]}]]\)], g];\)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(init = Table[Random[Real, dom[\([i]\)]], {i, Length[yi]}]\), "\[IndentingNewLine]", \(Abs[Apply[Plus, init] - but]\), "\[IndentingNewLine]", \(Sum[ yi[\([i]\)] /. x \[Rule] init[\([i]\)], {i, Length[yi]}]\), "\[IndentingNewLine]", \(pop = Sort[Table[ RotateLeft[{poptemp = Table[Random[Real, dom[\([i]\)]], {i, Length[yi]}], Abs[Apply[Plus, poptemp] - but]}], {n}]]\), "\[IndentingNewLine]", \(Map[ muter[p, #, \(pop[\([1]\)]\)[\([2]\)]] &, \(pop[\([Random[ Integer, {1, prof}]]\)]\)[\([2]\)]]\)}], "Input"], Cell[BoxData[ \({261.98387450325896`, 141.6072566013995`, 160.1786549403554`, 32.912906712020344`, 296.9492161522577`}\)], "Output"], Cell[BoxData[ \(137.63190890929195`\)], "Output"], Cell[BoxData[ \(2684.939311045746`\)], "Output"], Cell[BoxData[ \({{5.131229212178823`, {292.0620281710628`, 85.48119592207736`, 186.37223821901114`, 35.240739123101484`, 161.97502777692617`}}, {23.90063944501958`, {219.41574706612676`, 84.65448801963328`, 142.53936028030225`, 75.85917151608943`, 257.4318725628678`}}, {24.483013316185747`, {125.86681883713686`, 114.52893634814889`, 162.0380222848442`, 58.357270403516765`, 270.7259388101676`}}, {41.65764951580172`, {281.1357472152033`, 104.17841643076488`, 138.51347699579105`, 29.972065710935645`, 243.8579431631068`}}, {81.99250539604782`, {254.9750650914018`, 110.55584584621322`, 81.54991915822302`, 27.164006306694056`, 199.76265820142004`}}, {92.78487546689553`, {198.4800142356073`, 146.55487987731766`, 118.66850472003739`, 72.97878317925885`, 126.53294252088321`}}, {95.04805063305855`, {201.77778390633364`, 148.05199954495444`, 183.98807416161347`, 34.86815617995014`, 282.3620368402069`}}, {109.41770923453896`, {171.9470717147241`, 139.72246870406798`, 118.75368824109093`, 36.27401856191683`, 179.8850435436613`}}, {138.98833951429378`, {137.2778040520965`, 139.71041144830232`, 144.41939720610364`, 84.19306256424404`, 111.41098521495965`}}, {170.53373183746237`, {155.21240688998176`, 144.93362147899643`, 84.8893485097297`, 37.83862353228507`, 162.59226775154468`}}}\)], "Output"], Cell[BoxData[ \({292.0620281710628`, 85.48119592207736`, 186.37223821901114`, 35.240739123101484`, 161.97502777692617`}\)], "Output"], Cell[" 5. Faire \[EAcute]voluer la population", "Subsubsection"], Cell["\<\ Pour faire \[EAcute]voluer la population, nous retenons les valeurs \ de l'individu le mieux adapt\[EAcute] et nous recommen\[CCedilla]ons le cycle \ (\[EAcute]tapes 2 \[AGrave] 4) :\ \>", "Text"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{\(ecart = pop[\([1, 1]\)]\), "\[IndentingNewLine]", \(parent = pop[\([1, 2]\)]\), "\[IndentingNewLine]", \(somme = Apply[Plus, parent]\), "\[IndentingNewLine]", \(valeur = Sum[yi[\([i]\)] /. x \[Rule] init[\([i]\)], {i, Length[yi]}]\), "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "j", ",", "\"\<: \>\"", ",", "parent", ",", "\"\< Ecart=\>\"", ",", "ecart", ",", " ", "\"\< \!\(\(TextForm\`\[Sum]\)\)\!\(TextForm\`x\_i\)=\>\"", ",", RowBox[{"somme", "\"\< \!\(TextForm\`Y\_i\)=\>\""}], ",", "valeur"}], "]"}]}], "Input"], Cell[BoxData[ \(5.131229212178823`\)], "Output"], Cell[BoxData[ \({292.0620281710628`, 85.48119592207736`, 186.37223821901114`, 35.240739123101484`, 161.97502777692617`}\)], "Output"], Cell[BoxData[ \(761.1312292121788`\)], "Output"], Cell[BoxData[ \(2684.939311045746`\)], "Output"], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"G\[EAcute]n\[EAcute]ration \"\>", "\[InvisibleSpace]", "j", "\[InvisibleSpace]", "\<\": \"\>", "\[InvisibleSpace]", \({292.0620281710628`, 85.48119592207736`, 186.37223821901114`, 35.240739123101484`, 161.97502777692617`}\), "\[InvisibleSpace]", "\<\" Ecart=\"\>", "\[InvisibleSpace]", "5.131229212178823`", "\[InvisibleSpace]", "\<\" \ \\!\\(\\(TextForm\\`\[Sum]\\)\\)\\!\\(TextForm\\`x\\_i\\)=\"\>", "\[InvisibleSpace]", RowBox[{ "761.1312292121788`", " ", "\<\" \\!\\(TextForm\\`Y\\_i\\)=\"\>"}], "\[InvisibleSpace]", "2684.939311045746`"}], SequenceForm[ "G\[EAcute]n\[EAcute]ration ", j, ": ", {292.06202817106282, 85.481195922077362, 186.37223821901114, 35.240739123101484, 161.97502777692617}, " Ecart=", 5.1312292121788232, " \!\(\(TextForm\`\[Sum]\)\)\!\(TextForm\`x\_i\)=", Times[ 761.13122921217882, " \!\(TextForm\`Y\_i\)="], 2684.9393110457459], Editable->False]], "Print"] }, Open ]], Cell["Utilisons un \[LeftGuillemet]For\[RightGuillemet]", "Text", FormatType->TextForm], Cell[BoxData[{ RowBox[{\(m = 50000;\), " ", \( (*\ nombre\ d' individus\ dans\ le\ population\ *) \)}], "\[IndentingNewLine]", \ \(n = 10; \ (*\ nombre\ de\ g\[EAcute]n\[EAcute]rations\ *) ;\), "\[IndentingNewLine]", RowBox[{\(prof = 5;\), " ", \( (*\ profondeur\ de\ recherche\ d' un\ individu\ adapt\[EAcute]\ *) \)}], "\[IndentingNewLine]", \(p = 0.01; \ (*\ probabilit\[EAcute]\ de\ mutation\ *) \[IndentingNewLine]dom = {{100, 300}, {80, 150}, {80, 200}, {20, 100}, {100, 300}};\), "\[IndentingNewLine]", RowBox[{\(but = 756;\), " ", "\[IndentingNewLine]", "\[IndentingNewLine]", \( (*\ valeurs\ intiales\ *) \)}], "\[IndentingNewLine]", RowBox[{\(parent = Table[Random[Real, dom[\([i]\)]], {i, Length[yi]}];\), "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{\(j = 1\), ",", \(j \[LessEqual] n\), ",", \(j++\), ",", "\[IndentingNewLine]", RowBox[{\(Sum[ yi[\([i]\)] /. x \[Rule] parent[\([i]\)], {i, Length[yi]}]\), ";", "\[IndentingNewLine]", \(pop = Sort[Table[ RotateLeft[{poptemp = Table[Random[Real, dom[\([i]\)]], {i, Length[yi]}], Abs[Apply[Plus, poptemp] - but], Sum[yi[\([i]\)] /. x \[Rule] poptemp[\([i]\)], {i, Length[yi]}]}], {n}]]\), ";", "\[IndentingNewLine]", \(Map[ muter[p, #, \(pop[\([1]\)]\)[\([3]\)]] &, \(pop[\([Random[ Integer, {1, prof}]]\)]\)[\([3]\)]]\), ";", "\[IndentingNewLine]", \(valeur = pop[\([1, 2]\)]\), ";", "\[IndentingNewLine]", \(parent = pop[\([1, 3]\)]\), ";", "\[IndentingNewLine]", \(somme = Apply[Plus, parent]\), ";", "\[IndentingNewLine]", \(ecart = somme - but\), ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "j", ",", "\"\<: \>\"", ",", "parent", ",", " ", "\"\< \!\(TextForm\`Y\)=\>\"", ",", "valeur", ",", "\"\< \!\(\(TextForm\`\[Sum]\)\)\!\(TextForm\`x\_i\)=\>\"", ",", "somme", ",", "\"\< Ecart=\>\"", ",", "ecart"}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{0, 997}, {0, 746}}, CellGrouping->Manual, WindowSize->{891, 719}, WindowMargins->{{27, Automatic}, {-24, Automatic}}, ShowSelection->True, ShowCellLabel->False, Magnification->1.25, StyleDefinitions -> "DemoText.nb" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 29, 0, 66, "Title"], Cell[CellGroupData[{ Cell[1830, 57, 135, 3, 49, "Subsubsection"], Cell[1968, 62, 452, 8, 117, "Text"], Cell[2423, 72, 85, 1, 49, "Subsubsection"], Cell[2511, 75, 289, 4, 120, "Input"], Cell[2803, 81, 92, 1, 49, "Subsubsection"], Cell[2898, 84, 359, 7, 88, "Input"], Cell[3260, 93, 83, 1, 49, "Subsubsection"], Cell[CellGroupData[{ Cell[3368, 98, 492, 9, 153, "Input"], Cell[3863, 109, 45735, 919, 213, 6346, 428, "GraphicsData", "PostScript", \ "Graphics"] }, Open ]], Cell[49613, 1031, 85, 1, 49, "Subsubsection"], Cell[49701, 1034, 541, 13, 60, "Text"], Cell[CellGroupData[{ Cell[50267, 1051, 255, 4, 88, "Input"], Cell[50525, 1057, 141, 2, 50, "Output"] }, Open ]], Cell[50681, 1062, 142, 1, 49, "Subsubsection"], Cell[50826, 1065, 126, 3, 26, "Text"], Cell[CellGroupData[{ Cell[50977, 1072, 61, 1, 55, "Input"], Cell[51041, 1075, 52, 1, 50, "Output"] }, Open ]], Cell[51108, 1079, 236, 8, 26, "Text"], Cell[CellGroupData[{ Cell[51369, 1091, 93, 1, 55, "Input"], Cell[51465, 1094, 53, 1, 50, "Output"] }, Open ]], Cell[51533, 1098, 291, 5, 43, "Text"], Cell[51827, 1105, 151, 4, 49, "Subsubsection"], Cell[51981, 1111, 229, 6, 26, "Text"], Cell[CellGroupData[{ Cell[52235, 1121, 359, 8, 120, "Input"], Cell[52597, 1131, 573, 10, 83, "Output"] }, Open ]], Cell[53185, 1144, 16, 0, 26, "Text"], Cell[53204, 1146, 212, 4, 43, "Text"], Cell[CellGroupData[{ Cell[53441, 1154, 132, 2, 71, "Input"], Cell[53576, 1158, 53, 1, 50, "Output"] }, Open ]], Cell[53644, 1162, 134, 1, 49, "Subsubsection"], Cell[53781, 1165, 421, 9, 60, "Text"], Cell[CellGroupData[{ Cell[54227, 1178, 88, 1, 55, "Input"], Cell[54318, 1181, 358, 5, 41, "Message"] }, Open ]], Cell[54691, 1189, 533, 13, 49, "Text"], Cell[55227, 1204, 167, 3, 71, "Input"], Cell[CellGroupData[{ Cell[55419, 1211, 232, 4, 88, "Input"], Cell[55654, 1217, 52, 1, 50, "Output"] }, Open ]], Cell[55721, 1221, 388, 8, 140, "Text"], Cell[CellGroupData[{ Cell[56134, 1233, 1871, 41, 429, "Input"], Cell[58008, 1276, 143, 2, 50, "Output"], Cell[58154, 1280, 53, 1, 50, "Output"], Cell[58210, 1283, 52, 1, 50, "Output"], Cell[58265, 1286, 1525, 21, 196, "Output"], Cell[59793, 1309, 144, 2, 50, "Output"], Cell[59940, 1313, 64, 0, 49, "Subsubsection"], Cell[60007, 1315, 206, 4, 43, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[60250, 1324, 673, 11, 149, "Input"], Cell[60926, 1337, 52, 1, 50, "Output"], Cell[60981, 1340, 144, 2, 50, "Output"], Cell[61128, 1344, 52, 1, 50, "Output"], Cell[61183, 1347, 52, 1, 50, "Output"], Cell[61238, 1350, 1101, 21, 49, "Print"] }, Open ]], Cell[62354, 1374, 89, 1, 26, "Text"], Cell[62446, 1377, 2423, 46, 467, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)