Simpler appending to next population since it will be sorted anyways
This commit is contained in:
@ -55,16 +55,13 @@ class Population:
|
|||||||
|
|
||||||
|
|
||||||
def append_children(self, chromosome_list):
|
def append_children(self, chromosome_list):
|
||||||
"""Appends a list of chromosomes to the next population.
|
"""Appends a list of chromosomes to the next population."""
|
||||||
Appends to the front so that chromosomes with fitness
|
|
||||||
values already will stay sorted.
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.next_population = [
|
self.next_population += (
|
||||||
to_chromosome(chromosome)
|
to_chromosome(chromosome)
|
||||||
for chromosome
|
for chromosome
|
||||||
in chromosome_list
|
in chromosome_list
|
||||||
] + self.next_population
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_chromosome(self, chromosome, index = None):
|
def add_chromosome(self, chromosome, index = None):
|
||||||
|
|||||||
Reference in New Issue
Block a user