Added structure directory and improved sort by fitness
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import random
|
||||
|
||||
# Import all the data structure prebuilt modules
|
||||
from initialization import Population as create_population
|
||||
from initialization import Chromosome as create_chromosome
|
||||
from initialization import Gene as create_gene
|
||||
from structure import Population as create_population
|
||||
from structure import Chromosome as create_chromosome
|
||||
from structure import Gene as create_gene
|
||||
|
||||
# Structure Methods
|
||||
from fitness_function import Fitness_Examples
|
||||
@ -130,4 +130,4 @@ class GA:
|
||||
etc.
|
||||
"""
|
||||
|
||||
return list(reversed(sorted(chromosome_set, key = lambda chromosome: chromosome.get_fitness())))
|
||||
return sorted(chromosome_set, key = lambda chromosome: chromosome.get_fitness(), reverse = True)
|
||||
|
||||
@ -1,5 +1,2 @@
|
||||
# FROM (. means local) file_name IMPORT function_name
|
||||
from .initialization_methods import Initialization_Methods
|
||||
from .gene_structure.gene import Gene
|
||||
from .chromosome_structure.chromosome import Chromosome
|
||||
from .population_structure.population import Population
|
||||
from .initialization_methods import Initialization_Methods
|
||||
0
src/structure/README.md
Normal file
0
src/structure/README.md
Normal file
4
src/structure/__init__.py
Normal file
4
src/structure/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
# FROM (. means local) file_name IMPORT function_name
|
||||
from .gene import Gene
|
||||
from .chromosome import Chromosome
|
||||
from .population import Population
|
||||
Reference in New Issue
Block a user