diff --git a/src/EasyGA.py b/src/EasyGA.py index 828f71e..2db1e4a 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -20,8 +20,14 @@ from attributes import attributes class GA(attributes): + """GA is the main class in EasyGA. Everything is run through the ga + class. The GA class inherites all the default ga attributes from the + attributes class. + + An extensive wiki going over all major functions can be found at + https://github.com/danielwilczak101/EasyGA/wiki + """ - # Inhert all the ga attributes from the attributes class. def __init__(self, chromosome_length = None, population_size = None, @@ -51,7 +57,7 @@ class GA(attributes): mutation_individual_impl = None, mutation_population_impl = None, termination_impl = None - ): + ): super(GA, self).__init__( chromosome_length, population_size, diff --git a/src/attributes.py b/src/attributes.py index e272940..c70e1de 100644 --- a/src/attributes.py +++ b/src/attributes.py @@ -19,7 +19,7 @@ from mutation import Mutation_Methods from crossover import Crossover_Methods class attributes: - """SAMPLE TEXT""" + """Default GA attributes can be found here""" def __init__(self, chromosome_length, @@ -51,7 +51,10 @@ class attributes: mutation_population_impl, termination_impl ): - """Initialize the GA.""" + + """Default GA attributes can be found here. If any attributes have not + been set then they will fall back onto the default attribute. All + attributes have been catigorized to explain sections in the ga process.""" # Initilization variables self.chromosome_length = 10 if chromosome_length is None else chromosome_length @@ -96,14 +99,18 @@ class attributes: self.termination_impl = Termination_Methods.fitness_and_generation_based if termination_impl is None else termination_impl - # Getter and setters for all varibles + # Getter and setters for all required varibles @property def chromosome_length(self): - """SAMPLE TEXT""" + """Getter function for chromosome length""" + return self._chromosome_length @chromosome_length.setter def chromosome_length(self, value_input): + """Setter function with error checking for chromosome length""" + + # If the chromosome length is less then or equal 0 throw error if(not isinstance(value_input, int) or value_input <= 0): raise ValueError("Chromosome length must be integer greater then 0") self._chromosome_length = value_input @@ -111,10 +118,15 @@ class attributes: @property def population_size(self): + """Getter function for population size""" + return self._population_size @population_size.setter def population_size(self, value_input): + """Setter function with error checking for population size""" + + # If the population size is less then or equal 0 throw error if(not isinstance(value_input, int) or value_input <= 0): raise ValueError("Population length must be integer greater then 0") self._population_size = value_input