Added comments

This commit is contained in:
SimpleArt
2020-10-12 21:43:23 -04:00
parent b6ae77c7ea
commit 0b53f2cd81
2 changed files with 9 additions and 3 deletions

View File

@ -7,7 +7,11 @@ class Initialization_Methods:
"""Initialization examples that are used as defaults and examples"""
def random_initialization(ga):
"""Takes the initialization inputs and returns a population with the given parameters."""
"""Takes the initialization inputs and
- creates a new population
- fills population with chromosomes
- fills chromosomes with genes
"""
# Using the chromosome_impl to set every index inside of the chromosome
if ga.chromosome_impl != None:

View File

@ -20,7 +20,9 @@ class Mutation_Methods:
"""Methods for mutating a single chromosome"""
def whole_chromosome(ga, chromosome):
"""Makes a completely random chromosome"""
"""Makes a completely random chromosome.
Fills chromosome with new genes.
"""
# Using the chromosome_impl to set every index inside of the chromosome
if ga.chromosome_impl != None:
@ -42,7 +44,7 @@ class Mutation_Methods:
def single_gene(ga, chromosome):
"""Makes a completely random chromosome"""
"""Changes a random gene in the chromosome and resets the fitness."""
chromosome.set_fitness(None)
# Using the chromosome_impl