
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
"José Gomila Fŕbregues" <[EMAIL PROTECTED]> wrote: > We want to find a [hypothetical] composed individual formed by a 4 > simple individuals that are representated by > X1,Y1,Z1,V1 > X2,Y2,Z2,V2 > X3,Y3,Z3,V3 > X4,Y4,Z4,V4 > The individual are formed by 4x4 parameters now. > How can i write a good code to implement the crossover operator? I'm not quite sure what "superposed" means to you across our language barrier, so I'll ignore that part, but what you seem to have are four points in four space, which if my geometric intuition extends that far means that at least in non-degenerate cases, you have defined a four-space plane. Now two individuals would define two such planes, which either (a) intersect or (b) are parallel. In case (b), crossover is simple, you want some parallel plane between them. To solve the mutation issue at the same time you might allow some chance of overshoot to be outside the two planes on one side or the other, as well. I've found it fruitful to use a Gaussian (normal curve) distribution with the 2 sigma (two standard deviations) points at the existing plane locations, which puts the crossed over solution mostly in the center, but in a few percent of cases to one side or the other, and in very rare cases quite far to one sice or the other. Case (a) is also fairly simple, you want a plane that passes through the (four-space) line of intersection of the existing two planes, and usually lies at some intermediate position between their smaller angles of separation; again a Gaussian distribution, this time on the angles, should help. [There are also some options for perturbing the line of intersection after determining the angle, but before determining the child plane, that might be worth exploration, though there are questions how you keep the angle attached to the line while perturbing it.] What you do in the degenerate (or ambiguous, if the two planes have a perpendicular intersection) cases will be fun only if you enjoy lots and lots of math pain, so although I definitely do find that fun as a math major, I'm not about to solve that here. Try the whole thing in one fewer dimensions first, x y v, just to make sure you know where you are going without the confusion of a space you cannot envision easily. The overall lesson here is that something like "crossover" or "mutation" in genetic algorithms makes much more sense if it can be cast in terms sensible in the domain of discourse, rather than just as some mechanical manipulation of bits or even floating point values. Similarly pure mutation could be cast as a small displacement of the plane combined with a small perturbation of its normal, probably at the point closest to the coordinate system origin (if well defined) to have some fixed mechanism for choosing that point. xanthian. -- Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
| <-- __Chronological__ --> | <-- __Thread__ --> |