Major structural changes
This commit is contained in:
8
src/initialization/population_structure/population.py
Normal file
8
src/initialization/population_structure/population.py
Normal file
@ -0,0 +1,8 @@
|
||||
class population:
|
||||
# population = [chromosome,chromosome,etc]
|
||||
def __init__(self):
|
||||
self.fitness = None
|
||||
self.chromosomes = []
|
||||
|
||||
def add_chromosome(self,chromosome):
|
||||
self.chromosomes.append(chromosome)
|
||||
14
src/initialization/population_structure/test_population.py
Normal file
14
src/initialization/population_structure/test_population.py
Normal file
@ -0,0 +1,14 @@
|
||||
from population import population
|
||||
from chromosome import chromosome
|
||||
from gene import gene
|
||||
|
||||
population = population()
|
||||
# Fill the population with chromosomes
|
||||
for i in range(population_size):
|
||||
chromosome = chromosome()
|
||||
#Fill the Chromosome with genes
|
||||
for j in range(chromosome_length):
|
||||
gene = gene(gene_function)
|
||||
chromosome.add_gene(gene)
|
||||
|
||||
population.add_chromosome(chromosome)
|
||||
Reference in New Issue
Block a user