Convex crossover in genetic algorithm

• To: mathgroup at smc.vnet.net
• Subject: [mg112654] Convex crossover in genetic algorithm
• From: lightnation <lightnation at naver.com>
• Date: Fri, 24 Sep 2010 05:39:26 -0400 (EDT)

```If you are interested in the genetic algorithm,
The coding below is convex crossover in RCGA.
It's working, but the convergence is not so good.
(The whole algorithm is posted in this.
http://blog.daum.net/lightnation/5846116)

crossover[varvalue_List, pc_] :=
Module[{length, lengthtemp, crosspool, temp1, temp2, tub, crosstub,
xcrossprob, outtaxcrossindex, outtaelement, end1, end2, end,
crosspooltemp, outtaelementtemp, temp},
length = Length[varvalue];
crosstub = {};
tub = {};
lengthtemp = Range[length];

For[k = 1, k <= length/2,
temp1 = RandomChoice[lengthtemp];
lengthtemp = Complement[lengthtemp, {temp1}];
temp2 = RandomChoice[lengthtemp];
tub = {temp1, temp2};
AppendTo[crosstub, tub];
lengthtemp = Complement[lengthtemp, {temp2}];
k++];

crosspooltemp =
Map[{varvalue[[#[[1]]]], varvalue[[#[[2]]]]} &, crosstub];
xcrossprob = RandomReal[1, length/2];
outtaxcrossindex =
Flatten[Map[Position[xcrossprob, #] &,
Select[xcrossprob, # > pc &]], 1];
outtaelement = Map[crosspooltemp[[#[[1]]]] &, outtaxcrossindex];
crosspool = Delete[crosspooltemp, outtaxcrossindex];
temp = Map[{#[[1]], #[[2]],
RandomReal[1, Length[crosspool[[1, 1]]]]} &, crosspool];

end1 = Map[MapThread[(#1 (1 - #3) + #2 #3) &, #] &, temp];
end2 = Map[MapThread[(#1 #3 + #2 (1 - #3)) &, #] &, temp];

end = Join[end1, end2, Flatten[outtaelement, 1]];

Return[end];
];

```

• Prev by Date: Re: Interpolate in polar coordinates or cartesian but on non-uniform grid
• Next by Date: Re: Animation
• Previous by thread: Re: Interpolate in polar coordinates or cartesian but on non-uniform grid
• Next by thread: Re: Convex crossover in genetic algorithm