From 6f88bb59dca6e36a1a4da56f573ba43858ad4cad Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Thu, 27 Jun 2019 14:46:12 -0700 Subject: module & class & function docstrings --- generator.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'generator.py') diff --git a/generator.py b/generator.py index 7ad2cf3..0e8da8b 100644 --- a/generator.py +++ b/generator.py @@ -12,25 +12,31 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +""" +The 'generator' module contains a single Population class, +which represents a collection of randomized airfoils. +""" -import creator +import creator as cr -class Population: - '''Collection of random airfoils.''' +class Population(cr.Airfoil, cr.Spar, cr.Stringer): + """Collection of random airfoils.""" def __init__(self, size): + af = cr.Airfoil + # print(af) self.size = size self.gen_number = 0 # incremented for every generation def mutate(self, prob_mt): - '''Randomly mutate the genes of prob_mt % of the population.''' + """Randomly mutate the genes of prob_mt % of the population.""" def crossover(self, prob_cx): - '''Combine the genes of prob_cx % of the population.''' + """Combine the genes of prob_cx % of the population.""" def reproduce(self, prob_rp): - '''Pass on the genes of the fittest prob_rp % of the population.''' + """Pass on the genes of the fittest prob_rp % of the population.""" def fitness(): - '''Rate the fitness of an individual on a relative scale (0-100)''' + """Rate the fitness of an individual on a relative scale (0-100)""" -- cgit v1.2.3