From 8b6f11119790c8c930734894a37d2a4aaa42462d Mon Sep 17 00:00:00 2001 From: blendoit Date: Fri, 1 Nov 2019 18:12:34 -0700 Subject: Start work on optimized multiprocessing random a/c gen. & eval. --- example.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'example.py') diff --git a/example.py b/example.py index 5faaae3..8bc3033 100644 --- a/example.py +++ b/example.py @@ -1,4 +1,5 @@ -"""This example illustrates the usage of creator, evaluator and generator. +""" +This example illustrates the usage of creator, evaluator and generator. All the steps of airfoil creation & evaluation are detailed here; furthermore, the generator.py module contains certain presets @@ -9,11 +10,7 @@ Evaluate an airfoil; Generate a population of airfoils & optimize. """ -import matplotlib.pyplot as plt - -import creator -import evaluator -import generator +import aircraftstudio as acs import resources.materials as mt import time @@ -54,18 +51,15 @@ SAVE_PATH = '/home/blendux/Projects/Aircraft_Studio/save' # stringer2 = creator.wing.Stringer(af2, 'stringer2') # stringer2.info_save(SAVE_PATH) -pop = generator.Population(200) - -evaluator.analyze_all(pop) - -# for aircraft in pop.aircrafts: -# print(aircraft.results) +population = acs.generator.Population(10000) +acs.evaluator.analyze_all(population) # 123s with multiprocessing :-( -# for i in eval.aircrafts: -# print(i.name) +def foo(size): + for _ in range(size): + print(acs.evaluator.analyze(acs.creator.base.Aircraft.from_random())) + return None -# for i in eval.aircrafts: -# print(i.results) +foo(10000) # 106s # Final execution time final_time = time.time() - start_time -- cgit v1.2.3