Did stuff
This commit is contained in:
@ -1,8 +1,20 @@
|
||||
# Import all the data prebuilt modules
|
||||
from initialization.population_structure.population import population as create_population
|
||||
from initialization.chromosome_structure.chromosome import chromosome as create_chromosome
|
||||
from initialization.gene_structure.gene import gene as create_gene
|
||||
|
||||
# Import functions for defaults
|
||||
from initialization.gene_creation.gene_random import random_gene
|
||||
# Import functionality defaults
|
||||
from initialization.random_initialization import random_initialization
|
||||
|
||||
|
||||
class GA:
|
||||
|
||||
global population
|
||||
global chromosome
|
||||
global gene
|
||||
|
||||
def __init__(self):
|
||||
# Default variables
|
||||
self.population = None
|
||||
@ -37,4 +49,8 @@ class GA:
|
||||
# and be able to pause and output data based on that generation run.
|
||||
pass
|
||||
|
||||
# What about if you want to see how each
|
||||
def make_gene(self,value):
|
||||
return create_gene(value)
|
||||
|
||||
def make_chromosome(self):
|
||||
pass
|
||||
|
||||
@ -3,8 +3,6 @@ from .population_structure.population import population as create_population
|
||||
from .chromosome_structure.chromosome import chromosome as create_chromosome
|
||||
from .gene_structure.gene import gene as create_gene
|
||||
|
||||
from .initialization import initialization
|
||||
|
||||
class random_initialization:
|
||||
def initialize(self,chromosome_length,population_size,gene_function):
|
||||
# I dont understand why python needs this in its scope but it does.
|
||||
|
||||
@ -7,5 +7,9 @@ ga = EasyGA.GA()
|
||||
# Start the population
|
||||
ga.initialize()
|
||||
|
||||
new_gene = ga.make_gene("Hello")
|
||||
print(new_gene.get_value())
|
||||
print(new_gene.get_fitness())
|
||||
|
||||
for chromosome in ga.population.chromosomes:
|
||||
print(chromosome.genes[0].__dict__)
|
||||
|
||||
Reference in New Issue
Block a user