MCPcopy Create free account
hub / github.com/Hrishikesh332/Gen-TSP / breed

Function breed

streamlit_solver.py:53–63  ·  view source on GitHub ↗
(population, mutation_prob)

Source from the content-addressed store, hash-verified

51
52
53def 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
66def rank_selection(population, num_selected):

Callers 1

genetic_tspFunction · 0.85

Calls 2

crossoverFunction · 0.85
mutateFunction · 0.85

Tested by

no test coverage detected