diff --git a/src/EasyGA.py b/src/EasyGA.py index 36e0eec..2a9cc57 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -32,8 +32,12 @@ class GA: # initialize() def evolve(): + # If you just want to evolve through all generations pass def evolve_generation(self, number_of_generations): - # This is where the generatoin progression happens. + # If you want to evolve through a number of generations + # and be able to pause and output data based on that generation run. pass + + # What about if you want to see how each diff --git a/src/fitness_function/test_fitness_function.py b/src/fitness_function/test_fitness_function.py index e69de29..1cfd756 100644 --- a/src/fitness_function/test_fitness_function.py +++ b/src/fitness_function/test_fitness_function.py @@ -0,0 +1,12 @@ +class test_fitness_funciton: + def get_fitness(self, chromosome): + # For every gene in chromosome + for i in range(len(chromosome.genes)): + # If the gene has a five then add one to the fitness + # Example -> Chromosome = [5],[2],[2],[5],[5] then fitness = 3 + if (chromosome.genes[i].get_value == 5): + # Add to the genes fitness + chromosome.genes[i].fitness += 1 + # Add to the chromosomes fitness + chromosome.fitness += 1 + return chromosome.fitness