Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create an initial population randomly of size p
- Calculate the fitness
- Pick p/2 random individuals to the parents
- While counter < p/2
- pick parent1 and parent2 by tournament selection
- child1, child2 = mutate and crossover parent1 and parent2
- add child1 and child2 to new population
- pick p/2 distinct individuals from initial population and store in new population
Add Comment
Please, Sign In to add comment