Reproduction of parents for multiple children in the genetic algorithm

I am creating my first genetic algorithm in javascript using a collection of tutorials.

I am creating a slightly simpler structure for this planning tutorial http://www.codeproject.com/KB/recipes/GaClassSchedule.aspx#Chromosome8 , but I had a problem with reproduction.

I get a population of 60 people, and now I choose the two best people for breeding, and then I pick a few random other people to breed with the best two, am I not going to end up pretty small number of parents pretty quickly?

I believe that I will not make significant progress in the decision if I analyze the two best results with each of the following 20.

It is right? Is there a generally accepted way to do this?

+5
source share
4 answers

I have a sample genetic algorithm in Javascript here .

One of the problems with your approach is that you are killing diversity in a population by communicating between two people. This will never work very well, because it is too greedy , and you will actually defeat the goal of having a genetic algorithm in the first place.

( , ),

// save best guys as elite population and shove into temp array for the new generation
for(var e = 0; e < ELITE; e++) {
   tempGenerationHolder.push(fitnessScores[e].chromosome); 
}

// randomly select a mate (including elite) for all of the remaining ones
// using double-point crossover should suffice for this silly problem
// note: this should create INITIAL_POP_SIZE - ELITE new individualz
for(var s = 0; s < INITIAL_POP_SIZE - ELITE; s++) {
   // generate random number between 0 and INITIAL_POP_SIZE - ELITE - 1
   var randInd = Math.floor(Math.random()*(INITIAL_POP_SIZE - ELITE));

   // mate the individual at index s with indivudal at random index
   var child = mate(fitnessScores[s].chromosome, fitnessScores[randInd].chromosome);

   // push the result in the new generation holder
   tempGenerationHolder.push(child);
}

, , ( github repo, URL- ). () , .

, .

+4

, , , , - , , ( ).

, , , "" , "" . " ", - .

EDIT: , , , : , . 6 :

Solution   Fitness Value
A          5
B          4
C          3
D          2
E          1
F          1

k (, 2 4) . , "", , :

Solution   Probability
A          5/16
B          4/16
C          3/16
D          2/16
E          1/16
F          1/16

F . (, 100), ), , . , "" "" .

+3

, , , , , , , . , , , , , .

. - , -, , , . , , . . , .

, ( ).

, ( ), ( , ). , .

+3

. . , , , , - .

" ". - . , ; -. - , - . , , ( ) , .

One of the advantages of a tournament selection operator is that by simply changing the size of the tournament, you can easily adjust the level of selection pressure. A larger tournament will give more pressure, less tournament less.

+2
source

All Articles