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

Function rank_selection

streamlit_solver.py:66–70  ·  view source on GitHub ↗
(population, num_selected)

Source from the content-addressed store, hash-verified

64
65
66def rank_selection(population, num_selected):
67 pop_by_fitness = sorted(
68 population, key=lambda ind: evaluate_fitness(ind), reverse=True
69 )
70 return pop_by_fitness[:num_selected]
71
72
73def genetic_tsp(

Callers 1

genetic_tspFunction · 0.85

Calls 1

evaluate_fitnessFunction · 0.85

Tested by

no test coverage detected