(population, mutation_prob)
| 51 | |
| 52 | |
| 53 | def breed(population, mutation_prob): |
| 54 | offspring = [] |
| 55 | |
| 56 | for i in range(len(population)): |
| 57 | for j in range(i + 1, len(population)): |
| 58 | child1, child2 = crossover(population[i], population[j]) |
| 59 | child1 = mutate(child1, mutation_prob) |
| 60 | child2 = mutate(child2, mutation_prob) |
| 61 | offspring.extend([child1, child2]) |
| 62 | |
| 63 | return population + offspring |
| 64 | |
| 65 | |
| 66 | def rank_selection(population, num_selected): |
no test coverage detected