do the evolution!

Started by
1 comment, last by draqza 21 years, 1 month ago
Heh...okay, so a reference to a pearl jam song might have been a little silly. Anyway, for the GA I''m writing on this research project, riight now I have a set of parallel arrays, one storing the binary strings representing solutions and one storing the fitness of that solution. If it''s relevant, the size of the array is 128. So now, how would I go about selecting the two genes to combine? Because of the way the fitness function is set up, it''s possible for several genes to have the same fitness value and there''s no real cap on the fitness, so I''m not sure how to weight the randomization to more often pick those that are more fit.
WNDCLASSEX Reality;......Reality.lpfnWndProc=ComputerGames;......RegisterClassEx(&Reality);Unable to register Reality...what's wrong?---------Dan Uptonhttp://0to1.orghttp://www20.brinkster.com/draqza
Advertisement
In order to do roulette wheel selection (I think thats what its called iirc anyways), you total the fitness for all the genes in the population and pikc a random number from 0 to that total-1. Then, you go through the list of genes, and for each one you see if the random number is less than the fitness of that gene. If not, you subtract that amount from the random number and then compare it with the next. Since genes with better fitness have higher numbers, there is more of a chance that they will get selected.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
Read the tutorial at my website



ai-junkie.com

This topic is closed to new replies.

Advertisement