diff options
author | Marius Peter <blendoit@gmail.com> | 2019-06-24 21:45:02 -0700 |
---|---|---|
committer | Marius Peter <blendoit@gmail.com> | 2019-06-24 21:45:02 -0700 |
commit | eb3b9ecddd38294ca9ee6ae792fc01d57f04c441 (patch) | |
tree | 40365a19951c9430c45d4c1ba375a234fbfcadbb /generator.py | |
parent | 0658183612f39bae5cf0083befa226de5a2653d9 (diff) |
spar dP_x
Diffstat (limited to 'generator.py')
-rw-r--r-- | generator.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/generator.py b/generator.py index 6a87b7e..7ad2cf3 100644 --- a/generator.py +++ b/generator.py @@ -14,3 +14,23 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. import creator + + +class Population: + '''Collection of random airfoils.''' + + def __init__(self, size): + 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.''' + + def crossover(self, prob_cx): + '''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.''' + + def fitness(): + '''Rate the fitness of an individual on a relative scale (0-100)''' |