From fc8d16ca9e04066f3ea09f94bea758e41d2c1e4a Mon Sep 17 00:00:00 2001 From: Justin Gray Date: Sat, 19 Apr 2014 08:01:03 -0400 Subject: [PATCH 1/2] added conmin, fix to objective scaling --- examples/example.py | 8 ++++++-- src/harpopt.py | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/example.py b/examples/example.py index 360dac2..87a4eae 100644 --- a/examples/example.py +++ b/examples/example.py @@ -19,7 +19,7 @@ varspeed = True varpitch = True cdf_type = 'rayleigh' -optimizer = 'psqp' +optimizer = 'conmin' # ------------------------ # ---- instantiate rotor object ------- @@ -85,7 +85,7 @@ # ---- control settings ------------ rotor.control.Vin = 3.0 # (Float, m/s): cut-in wind speed -rotor.control.Vout = 25.0 # (Float, m/s): cut-out wind speed +rotor.control.Vout = 50.0 # (Float, m/s): cut-out wind speed rotor.control.ratedPower = 5e6 # (Float, W): rated power rotor.control.pitch = 0.0 # (Float, deg): pitch angle in region 2 (and region 3 for fixed pitch machines) @@ -114,6 +114,10 @@ # run one iteration to get baseline for normalization +rotor.driver.config_parameters() +rotor.driver.update_parameters() +rotor.driver.start_iteration() + rotor.driver.run_iteration() rotor.AEP0 = rotor.aep.AEP rotor.driver.run_iteration() diff --git a/src/harpopt.py b/src/harpopt.py index 5cb1982..9432bc8 100644 --- a/src/harpopt.py +++ b/src/harpopt.py @@ -13,7 +13,7 @@ from pyopt_driver.pyopt_driver import pyOptDriver except Exception: pass -from openmdao.lib.drivers.api import SLSQPdriver +from openmdao.lib.drivers.api import SLSQPdriver, CONMINdriver from openmdao.lib.casehandlers.api import DumpCaseRecorder from rotorse.rotoraerodefaults import common_io_with_ccblade, common_configure_with_ccblade @@ -44,7 +44,7 @@ def configure(self): 'Minor feasibility tolerance': 1e-6, 'Major optimality tolerance': 1e-5, 'Function precision': 1e-8, - 'Iterations limit': 500, + 'Iterations limit': 100, 'Print file': 'harpopt_snopt.out', 'Summary file': 'harpopt_snopt_summary.out'} @@ -53,7 +53,7 @@ def configure(self): self.driver.optimizer = 'PSQP' self.driver.options = {'XMAX': 100.0, 'TOLG': 1e-4, - 'MFV': 500, + 'MFV': 100, 'IFILE': 'harpopt_psqp.out'} elif self.optimizer == 'slsqp': @@ -61,6 +61,11 @@ def configure(self): self.driver.accuracy = 1.0e-6 self.driver.maxiter = 500 + elif self.optimizer == "conmin": + self.replace('driver', CONMINdriver()) + self.driver.delfun = 1e-6 + self.driver.itmax = 500 + else: print 'invalid optimizer specified' exit() From e9c2ac5c213ac01fb9282a4ae768111ce597ebb2 Mon Sep 17 00:00:00 2001 From: Justin Gray Date: Mon, 21 Apr 2014 14:26:41 -0400 Subject: [PATCH 2/2] boo --- examples/example.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/example.py b/examples/example.py index 87a4eae..308edaf 100644 --- a/examples/example.py +++ b/examples/example.py @@ -119,9 +119,19 @@ rotor.driver.start_iteration() rotor.driver.run_iteration() -rotor.AEP0 = rotor.aep.AEP -rotor.driver.run_iteration() +# rotor.AEP0 = rotor.aep.AEP +# rotor.driver.run_iteration() + + +inputs = ['cdf.x'] +outputs = ['cdf.F'] +rotor.cdf.run() +#rotor.driver.gradient_options.fd_step_type = 'relative' +#rotor.driver.gradient_options.fd_form = 'central' +rotor.check_gradient(inputs=inputs, outputs=outputs) + +exit() # run optimization rotor.run()