After a run through the population evaluating each individual the adjusted fitness is used to create the next population. A common approach is to sort the population by fitness size, copy over the top ten percent of the population to the new population (the hundred highest scoring individuals in a population of 1000), then generate the remaining population (900 if the population is 1000) using a tournament method. In the tournament five (or seven or some small number) of individuals is chosen at random. Based on the relative fitness of the individual, that individual is more likely to win the tournament. Using whole numbers, if the five individuals had fitness values of 2, 4, 6, 8 10, the sum of these fitness scores is 30, the individual with a fitness score of 10 has a 10 / 30 or 1/3 chance of winning the tournament.
Once you have a tournament winner, generate a random number to see if that individual will be crossed with another individual (also selected by tournament), mutated, or left unchanged.
Fill the remaining population this way (900 individuals in this example). When the population is complete take another run through the population evaluating the fitness of each individual. Repeat these steps until the maximum number of generations is reached or a "perfect" individual is found.
No comments:
Post a Comment