summaryrefslogtreecommitdiff
path: root/generator.py
diff options
context:
space:
mode:
Diffstat (limited to 'generator.py')
-rw-r--r--generator.py20
1 files changed, 13 insertions, 7 deletions
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 <https://www.gnu.org/licenses/>.
+"""
+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)"""
Copyright 2019--2024 Marius PETER