Major structural changes

This commit is contained in:
Daniel Wilczak
2020-09-23 16:46:59 -04:00
parent cd15a85b71
commit 2322a186e3
11 changed files with 24 additions and 28 deletions

View 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)

View 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)