Compare commits
1 Commits
1e5f02e5ce
...
046b1a043a
Author | SHA1 | Date |
---|---|---|
coolneng | 046b1a043a |
|
@ -201,11 +201,12 @@ def generational_replacement(prev_population, current_population):
|
||||||
|
|
||||||
|
|
||||||
def get_best_elements(population):
|
def get_best_elements(population):
|
||||||
first_element = max(population, key=lambda x: x.fitness.values[0])
|
select_population = deepcopy(population)
|
||||||
first_index = get_individual_index(first_element, population)
|
first_element = max(select_population, key=lambda x: x.fitness.values[0])
|
||||||
population.pop(first_index)
|
first_index = get_individual_index(first_element, select_population)
|
||||||
second_element = max(population, key=lambda x: x.fitness.values[0])
|
select_population.pop(first_index)
|
||||||
second_index = get_individual_index(second_element, population)
|
second_element = max(select_population, key=lambda x: x.fitness.values[0])
|
||||||
|
second_index = get_individual_index(second_element, select_population)
|
||||||
return first_index, second_index
|
return first_index, second_index
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue