def configure(self): self.add('iter', IterateUntil()) self.add('airline_subproblem', AirlineSubProblem()) self.add('branchbound_algorithm', BranchBoundLinear()) #self.add('solver', LPSolver()) self.add('solver', LinProgSolver()) self.add('fleet_analysis', FleetAnalysis()) #iteration hierachy self.driver.workflow.add( ['airline_subproblem', 'iter', 'fleet_analysis']) self.iter.workflow.add(['branchbound_algorithm', 'solver']) #data connections # Connect Airline Allocation SubProblem Component with Branch and Bound Algorithm Component and the solver self.connect('airline_subproblem.f_int', ['branchbound_algorithm.f_int', 'solver.f_int']) self.connect('airline_subproblem.f_con', ['branchbound_algorithm.f_con', 'solver.f_con']) self.connect('airline_subproblem.A_init', 'branchbound_algorithm.A_init') self.connect('airline_subproblem.b_init', 'branchbound_algorithm.b_init') self.connect('airline_subproblem.Aeq', ['branchbound_algorithm.Aeq', 'solver.A_eq']) self.connect('airline_subproblem.beq', ['branchbound_algorithm.beq', 'solver.b_eq']) self.connect('airline_subproblem.lb_init', 'branchbound_algorithm.lb_init') self.connect('airline_subproblem.ub_init', 'branchbound_algorithm.ub_init') # Connect Branch and Bound Algorithm Component with the solver component self.connect('branchbound_algorithm.A', 'solver.A') self.connect('branchbound_algorithm.b', 'solver.b') self.connect('branchbound_algorithm.lb', 'solver.lb') self.connect('branchbound_algorithm.ub', 'solver.ub') # Connect solver component with the Branch and Bound Algorithm Component (return results) self.connect('solver.xopt', 'branchbound_algorithm.xopt_current') self.connect('solver.fun_opt', 'branchbound_algorithm.relaxed_obj_current') self.connect('solver.exitflag_LP', 'branchbound_algorithm.exitflag_LP') self.connect('branchbound_algorithm.xopt', 'fleet_analysis.xopt') self.iter.add_stop_condition('branchbound_algorithm.exec_loop != 0') self.iter.max_iterations = 1000000 #data recording self.recorders = [JSONCaseRecorder('airline_allocation.json')]
def configure(self): self.add('driver', IterateUntil()) self.add('branchbound_algorithm', BranchBoundNonLinear(n_int=2, n_contin=0)) #self.add('nonlinopt', BandBSLSQPdriver(n_x=2)) self.add('nonlinopt', pyOptSparseDriver(n_x=2)) self.nonlinopt.optimizer = "SNOPT" self.add('nonlin_test_prob', NonLinearTestProblem()) #nonlin problem formulation` self.nonlinopt.add_parameter('nonlin_test_prob.x', low=0, high=1e3) self.nonlinopt.add_objective('nonlin_test_prob.f') self.nonlinopt.add_constraint('nonlin_test_prob.g1 < 0') self.nonlinopt.add_constraint('nonlin_test_prob.g2 < 0') #iteration hierachy self.driver.workflow.add(['branchbound_algorithm', 'nonlinopt']) self.nonlinopt.workflow.add('nonlin_test_prob') #data connections # Connect solver component with the Branch and Bound Algorithm Component (return results) self.connect('nonlin_test_prob.x', 'branchbound_algorithm.xopt_current') self.connect('nonlin_test_prob.f', 'branchbound_algorithm.relaxed_obj_current') self.connect('nonlinopt.exit_flag', 'branchbound_algorithm.exitflag_NLP') # Connect Airline Allocation SubProblem Component with Branch and Bound Algorithm Component and the solver # Connect Branch and Bound Algorithm Component with the solver component self.connect('branchbound_algorithm.lb', 'nonlinopt.lb') self.connect('branchbound_algorithm.ub', 'nonlinopt.ub') self.driver.add_stop_condition('branchbound_algorithm.exec_loop != 0') self.driver.max_iterations = 1000000 self.recorders = [JSONCaseRecorder('nonlintest.json')]
def configure(self): self._tdir = mkdtemp() #Components self.add("branin_meta_model", MetaModel()) self.branin_meta_model.default_surrogate = KrigingSurrogate() self.branin_meta_model.model = BraninComponent() self.branin_meta_model.recorder = DBCaseRecorder(':memory:') self.branin_meta_model.force_execute = True self.add("EI", ExpectedImprovement()) self.EI.criteria = "branin_meta_model.f_xy" self.add("filter", ParetoFilter()) self.filter.criteria = ['branin_meta_model.f_xy'] self.filter.case_sets = [ self.branin_meta_model.recorder.get_iterator(), ] self.filter.force_execute = True #Driver Configuration self.add("DOE_trainer", DOEdriver()) self.DOE_trainer.sequential = True self.DOE_trainer.DOEgenerator = OptLatinHypercube(num_samples=15) #self.DOE_trainer.DOEgenerator = FullFactorial(num_levels=5) self.DOE_trainer.add_parameter("branin_meta_model.x", low=-5., high=10.) self.DOE_trainer.add_parameter("branin_meta_model.y", low=0., high=15.) self.DOE_trainer.add_event("branin_meta_model.train_next") self.DOE_trainer.case_outputs = ["branin_meta_model.f_xy"] self.DOE_trainer.recorders = [ DBCaseRecorder(os.path.join(self._tdir, 'trainer.db')) ] self.add("EI_opt", Genetic()) self.EI_opt.opt_type = "maximize" self.EI_opt.population_size = 100 self.EI_opt.generations = 10 #self.EI_opt.selection_method = "tournament" self.EI_opt.add_parameter("branin_meta_model.x", low=-5., high=10.) self.EI_opt.add_parameter("branin_meta_model.y", low=0., high=15.) self.EI_opt.add_objective("EI.PI") self.add("retrain", MyDriver()) self.retrain.add_event("branin_meta_model.train_next") self.retrain.recorders = [ DBCaseRecorder(os.path.join(self._tdir, 'retrain.db')) ] self.add("iter", IterateUntil()) self.iter.max_iterations = 30 self.iter.add_stop_condition('EI.EI <= .0001') #Iteration Heirarchy self.driver.workflow.add(['DOE_trainer', 'iter']) self.DOE_trainer.workflow.add('branin_meta_model') self.iter.workflow = SequentialWorkflow() self.iter.workflow.add(['filter', 'EI_opt', 'retrain']) self.EI_opt.workflow.add(['branin_meta_model', 'EI']) self.retrain.workflow.add('branin_meta_model') #Data Connections self.connect("filter.pareto_set", "EI.best_case") self.connect("branin_meta_model.f_xy", "EI.predicted_value")
def configure(self): self._tdir = mkdtemp() self.comp_name = None #check to make sure no more than one component is being referenced compnames = set() for param in self.parent.get_parameters().values(): compnames.update(param.get_referenced_compnames()) if len(compnames) > 1: self.parent.raise_exception('The EGO architecture can only be used on one' 'component at a time, but parameters from %s ' 'were added to the problem formulation.' %compnames, ValueError) self.comp_name = compnames.pop() #change name of component to add '_model' to it. # lets me name the metamodel as the old name self.comp= getattr(self.parent,self.comp_name) self.comp.name = "%s_model"%self.comp_name #add in the metamodel meta_model = self.parent.add(self.comp_name,MetaModel()) #metamodel now replaces old component with same name meta_model.default_surrogate = KrigingSurrogate() meta_model.model = self.comp meta_model_recorder = DBCaseRecorder(os.path.join(self._tdir,'trainer.db')) meta_model.recorder = meta_model_recorder EI = self.parent.add("EI",ExpectedImprovement()) self.objective = self.parent.get_objectives().keys()[0] EI.criteria = self.objective pfilter = self.parent.add("filter",ParetoFilter()) pfilter.criteria = [self.objective] pfilter.case_sets = [meta_model_recorder.get_iterator(),] #Driver Configuration DOE_trainer = self.parent.add("DOE_trainer",DOEdriver()) DOE_trainer.sequential = True DOE_trainer.DOEgenerator = OptLatinHypercube(num_samples=self.initial_DOE_size) for name,param in self.parent.get_parameters().iteritems(): DOE_trainer.add_parameter(param) DOE_trainer.add_event("%s.train_next"%self.comp_name) DOE_trainer.case_outputs = [self.objective] DOE_trainer.recorders = [DBCaseRecorder(':memory:')] EI_opt = self.parent.add("EI_opt",Genetic()) EI_opt.opt_type = "maximize" EI_opt.population_size = 100 EI_opt.generations = 10 #EI_opt.selection_method = "tournament" for name,param in self.parent.get_parameters().iteritems(): EI_opt.add_parameter(param) EI_opt.add_objective("EI.%s"%self.EI_PI) retrain = self.parent.add("retrain",Driver()) retrain.recorders = self.data_recorders retrain.add_event("%s.train_next"%self.comp_name) iter = self.parent.add("iter",IterateUntil()) iter.max_iterations = self.sample_iterations iter.add_stop_condition('EI.PI <= %s'%self.min_ei_pi) #Data Connections self.parent.connect("filter.pareto_set","EI.best_case") self.parent.connect(self.objective,"EI.predicted_value") #Iteration Heirarchy self.parent.driver.workflow.add(['DOE_trainer', 'iter']) #DOE_trainer.workflow.add(self.comp_name) iter.workflow = SequentialWorkflow() iter.workflow.add(['filter', 'EI_opt', 'retrain']) #EI_opt.workflow.add([self.comp_name,'EI']) retrain.workflow.add(self.comp_name)
def configure(self): # --------------------------------------------------------------------------- # # --- Instantiate Counter Component # --------------------------------------------------------------------------- # self.add('counter', DOECounterComp()) # --------------------------------------------------------------------------- # # --- Instantiate Subcounter Component # --------------------------------------------------------------------------- # self.add('subcounter', SubCounterComp()) # --------------------------------------------------------------------------- # # --- Instantiate Restart Component # --------------------------------------------------------------------------- # self.add('restart_doe', RestartComp()) # --------------------------------------------------------------------------- # # --- Instantiate NPSS Non-Reacting Component # --------------------------------------------------------------------------- # self.add('npss_nonreacting', NpssNonreacting()) self.npss_nonreacting.Comb_dPqPBase = init_dP() # --------------------------------------------------------------------------- # # --- Instantiate NPSS Reacting Component # --------------------------------------------------------------------------- # self.add('npss_reacting', NpssReacting()) self.npss_reacting.Comb_dPqPBase = init_dP() # --------------------------------------------------------------------------- # # --- Instantiate Geometry Component # --------------------------------------------------------------------------- # self.add('geometry', GeometryComp()) # --------------------------------------------------------------------------- # # --- Instantiate Mesh Component # --------------------------------------------------------------------------- # self.add('mesh', MeshComp()) # --------------------------------------------------------------------------- # # --- Instantiate NCC Non-reacting Component (1-Step Chemistry) # --------------------------------------------------------------------------- # self.add('ncc_nonreacting', NCCcomponent()) self.ncc_nonreacting.max_iterations_per_time_step = 40000 self.ncc_nonreacting.nonreacting = True self.ncc_nonreacting.continuity_goal = 2000 self.ncc_nonreacting.restarts = 40000 self.ncc_nonreacting.CFL = 0.8 self.ncc_nonreacting.mass_imbalance_goal = 1.0E-2 self.ncc_nonreacting.aero2 = -1.0E-3 self.ncc_nonreacting.k_e2 = -1.0E-3 self.ncc_nonreacting.species2 = -1.0E-3 self.ncc_nonreacting.enthalpy2 = -1.0E-3 self.ncc_nonreacting.aero4 = 0.05 self.ncc_nonreacting.k_e4 = 0.05 self.ncc_nonreacting.species4 = 0.05 self.ncc_nonreacting.enthalpy4 = 0.05 self.ncc_nonreacting.twall_run = 4.0 self.ncc_nonreacting._num_procs = 400 # --- Must be divisible by 20 to run on Ivy Bridge # --------------------------------------------------------------------------- # # --- Instantiate NCC Reacting Component (1-Step Chemistry) # --------------------------------------------------------------------------- # self.add('ncc_reacting', NCCcomponent()) self.ncc_reacting.reacting = True self.ncc_reacting.continuity_goal = 750 self.ncc_reacting.max_iterations_per_time_step = 15000 self.ncc_reacting.restarts = 15000 self.ncc_reacting.CFL = 0.8 self.ncc_reacting.pbcfl = 0.375 self.ncc_reacting.etau_beta = 0.15 self.ncc_reacting.mass_imbalance_goal = 1.0E-3 self.ncc_reacting.aux_var_name_list = "'unmixed' 'C12H23'" self.ncc_reacting.spec_name_ignite = 'C12H23' self.ncc_reacting.fuel_symbol = 'C12H23' self.ncc_reacting.combust = True self.ncc_reacting.lspray = True self.ncc_reacting.aero2 = -2.5E-3 self.ncc_reacting.k_e2 = -2.5E-3 self.ncc_reacting.species2 = -2.5E-3 self.ncc_reacting.enthalpy2 = -2.5E-3 self.ncc_reacting.aero4 = 0.05 self.ncc_reacting.k_e4 = 0.05 self.ncc_reacting.species4 = 0.05 self.ncc_reacting.enthalpy4 = 0.05 self.ncc_reacting.ignite_done_model = 0 self.ncc_reacting.ignition_on = True self.ncc_reacting.no_of_streams = 16 self.ncc_reacting.twall_run = 4.0 self.ncc_reacting._num_procs = 400 # --- Must be divisible by 20 to run on Ivy Bridge # --------------------------------------------------------------------------- # # --- Instantiate NCC Reacting Component (Detailed Chemistry) # --------------------------------------------------------------------------- # self.add('ncc_reacting2', NCCcomponent()) self.ncc_reacting2.reacting2 = True self.ncc_reacting2.continuity_goal = 750 self.ncc_reacting2.max_iterations_per_time_step = 10000 self.ncc_reacting2.restarts = 10000 self.ncc_reacting2.CFL = 0.9 self.ncc_reacting.pbcfl = 0.5 self.ncc_reacting2.mass_imbalance_goal = 1.0E-3 self.ncc_reacting2.aux_var_name_list = "'unmixed' 'C11H21'" self.ncc_reacting2.spec_name_ignite = 'C11H21' self.ncc_reacting2.fuel_symbol = 'C11H21' self.ncc_reacting2.combust = True self.ncc_reacting2.lspray = True self.ncc_reacting2.aero2 = -1.0E-3 self.ncc_reacting2.k_e2 = -1.0E-3 self.ncc_reacting2.species2 = -1.0E-3 self.ncc_reacting2.enthalpy2 = -1.0E-3 self.ncc_reacting2.aero4 = 0.05 self.ncc_reacting2.k_e4 = 0.05 self.ncc_reacting2.species4 = 0.05 self.ncc_reacting2.enthalpy4 = 0.05 self.ncc_reacting2.energy = 0.0001 self.ncc_reacting2.when_start_spray = 1 self.ncc_reacting2.ignite_done_model = 0 self.ncc_reacting2.ignition_on = True self.ncc_reacting2.twall_run = 7.5 self.ncc_reacting2._num_procs = 400 # --- Must be divisible by 20 to Run on Ivy Bridge # --------------------------------------------------------------------------- # # --- Instantiate Tecplot Nonreacting Component # --------------------------------------------------------------------------- # self.add('tecplot_nonreacting', TecplotComp()) self.tecplot_nonreacting.nonreacting = True # --------------------------------------------------------------------------- # # --- Instantiate Tecplot Reacting Spray Component # --------------------------------------------------------------------------- # self.add('tecplot_reacting', TecplotComp()) self.tecplot_reacting.reacting = True # --------------------------------------------------------------------------- # # --- Instantiate Tecplot Reacting Spray Component # --------------------------------------------------------------------------- # self.add('tecplot_reacting2', TecplotComp()) self.tecplot_reacting2.reacting2 = True # --------------------------------------------------------------------------- # # --- Create Driver Instances # --------------------------------------------------------------------------- # # --- Top Level Assembly Driver self.add('driver', IterateUntil()) self.driver.max_iterations = 1 self.driver.workflow = SequentialWorkflow() # --- Inner Nonreacting Driver (Fixed Point) self.add('nonreacting_driver', FixedPointIterator()) self.nonreacting_driver.workflow = SequentialWorkflow() self.nonreacting_driver.step_size = 0.125 self.nonreacting_driver.max_iteration = 1 self.nonreacting_driver.tolerance = 0.001 # --- Inner Reacting Driver self.add('reacting_driver', IterateUntil()) self.reacting_driver.max_iterations = 1 self.reacting_driver.workflow = SequentialWorkflow() # --- Inner Reacting Driver #2 self.add('reacting_driver2', IterateUntil()) self.reacting_driver2.max_iterations = 2 self.reacting_driver2.workflow = SequentialWorkflow() self.reacting_driver2.add_stop_condition( 'tecplot_reacting2.dTqTBase < 0.0025') # --- Run Design at All ICAO Power Settings self.add('power_hook', CaseIteratorDriver()) self.power_hook.workflow = SequentialWorkflow() self.power_hook.iterator = CSVCaseIterator(filename='ICAOsettings.csv') self.power_hook.workflow.add(['reacting_driver2']) # --------------------------------------------------------------------------- # # --- Create Main Assembly Workflow # --------------------------------------------------------------------------- # # --- Add component instances to top-level assembly #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'mesh', 'nonreacting_driver', 'reacting_driver', 'reacting_driver2']) #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'nonreacting_driver', 'reacting_driver', 'reacting_driver2']) #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'reacting_driver2']) #self.driver.workflow.add(['counter', 'restart_doe', 'geometry', 'npss_nonreacting', 'npss_reacting']) self.driver.workflow.add( ['counter', 'restart_doe', 'geometry', 'power_hook']) # --------------------------------------------------------------------------- # # --- Create Sub-Assembly Workflows # --------------------------------------------------------------------------- # # --- Inner Nonreacting Loop - Solve via fixed point iteration self.nonreacting_driver.workflow.add([ 'subcounter', 'npss_nonreacting', 'ncc_nonreacting', 'tecplot_nonreacting' ]) # --- Add solver independents and dependents for fixed point iterator self.nonreacting_driver.add_parameter( ['npss_nonreacting.Comb_dPqPBase', 'npss_reacting.Comb_dPqPBase'], low=-9.e99, high=9.e99) self.nonreacting_driver.add_constraint( 'tecplot_nonreacting.dPqPBase = npss_nonreacting.Comb_dPqPBase') # --- Inner Reacting Loop - Run Once self.reacting_driver.workflow.add([ 'subcounter', 'npss_reacting', 'ncc_reacting', 'tecplot_reacting' ]) # --- Inner Reacting Loop #2 - Run Once self.reacting_driver2.workflow.add([ 'subcounter', 'npss_reacting', 'ncc_reacting2', 'tecplot_reacting2' ]) # --------------------------------------------------------------------------- # # --- Add Driver Events --- Comment this section out to override numbering # --------------------------------------------------------------------------- # if (self.subcounter._iteration == 0): self.driver.add_event('subcounter.reset_iteration') self.driver.add_event('ncc_nonreacting.clean_start') self.power_hook.add_event('subcounter.reset_iteration') self.power_hook.add_event('ncc_nonreacting.clean_start') # --------------------------------------------------------------------------- # # --- Specify Case Recorders # --------------------------------------------------------------------------- # self.driver.case_outputs = [ 'geometry.pilot_recession', 'geometry.vane_height', 'geometry.venturi_angle', 'nonreacting_driver.ncc_nonreacting.FAR', 'nonreacting_driver.tecplot_nonreacting.dPqPBase' ] self.power_hook.recorders = [DumpCaseRecorder()] # --------------------------------------------------------------------------- # # --- Create Data Connections # --------------------------------------------------------------------------- # self.connect('counter.config', [ 'subcounter.case', 'restart_doe.config', 'geometry.config', 'mesh.config' ]) self.connect('subcounter.config', [ 'ncc_nonreacting.config', 'ncc_reacting.config', 'ncc_reacting2.config', 'tecplot_nonreacting.config', 'tecplot_reacting.config', 'tecplot_reacting2.config' ]) self.connect('restart_doe.pilot_recession', ['geometry.pilot_recession', 'mesh.pilot_recession']) self.connect('restart_doe.venturi_angle', ['geometry.venturi_angle', 'mesh.venturi_angle']) self.connect('restart_doe.vane_height', ['geometry.vane_height', 'mesh.vane_height']) self.connect('geometry.injector_dia', [ 'ncc_nonreacting.injector_dia', 'ncc_nonreacting.bc1_Lmix', 'ncc_reacting.injector_dia', 'ncc_reacting.bc1_Lmix', 'ncc_reacting2.injector_dia', 'ncc_reacting2.bc1_Lmix' ]) self.connect('geometry.sector_area', [ 'npss_nonreacting.Inlet_Fl_O_Aphy', 'npss_nonreacting.Comb_Fl_O_Aphy', 'npss_nonreacting.Bld1_Fl_O_Aphy', 'npss_nonreacting.Bld2_Fl_O_Aphy' ]) self.connect('geometry.sector_area', [ 'npss_reacting.Inlet_Fl_O_Aphy', 'npss_reacting.Comb_Fl_O_Aphy', 'npss_reacting.Bld1_Fl_O_Aphy', 'npss_reacting.Bld2_Fl_O_Aphy' ]) self.connect('geometry.venturi_throat_area', [ 'npss_nonreacting.Conv_Duct_Fl_O_Aphy', 'npss_reacting.Conv_Duct_Fl_O_Aphy' ]) self.connect('geometry.venturi_exit_area', [ 'npss_nonreacting.Div_Duct_Fl_O_Aphy', 'npss_reacting.Div_Duct_Fl_O_Aphy' ]) self.connect('npss_nonreacting.Conv_Duct_Fl_O_W', 'ncc_nonreacting.bc1_mdot') self.connect('npss_nonreacting.Inlet_Fl_O_V', 'ncc_nonreacting.u_init') self.connect( 'npss_nonreacting.Inlet_Fl_O_Ts', ['ncc_nonreacting.bc1_Tstatic', 'ncc_nonreacting.Tstatic_init']) self.connect( 'npss_nonreacting.Comb_Fl_O_Ps', ['ncc_nonreacting.bc2_Pstatic', 'ncc_nonreacting.Pstatic_init']) self.connect('npss_nonreacting.Comb_Fl_O_Ts', 'ncc_nonreacting.bc2_Tstatic') self.connect('npss_nonreacting.Comb_FAR', 'ncc_nonreacting.FAR') self.connect('npss_nonreacting.Inlet_Fl_O_rhos', 'ncc_nonreacting.rho_air') self.connect('npss_nonreacting.Bld1_BldOut_W', 'ncc_nonreacting.bc7_mdot') self.connect('npss_nonreacting.Bld1_Fl_O_Ts', 'ncc_nonreacting.bc7_Tstatic') self.connect('npss_reacting.Conv_Duct_Fl_O_W', ['ncc_reacting.bc1_mdot', 'ncc_reacting2.bc1_mdot']) self.connect('npss_reacting.Inlet_Fl_O_Ts', ['ncc_reacting.bc1_Tstatic', 'ncc_reacting2.bc1_Tstatic']) self.connect('npss_reacting.Comb_Fl_O_Ps', [ 'ncc_reacting.bc2_Pstatic', 'ncc_reacting2.bc2_Pstatic', 'ncc_reacting.Pstatic_init', 'ncc_reacting2.Pstatic_init' ]) self.connect('npss_reacting.Comb_Fl_O_Ts', [ 'ncc_reacting.bc2_Tstatic', 'ncc_reacting2.bc2_Tstatic', 'ncc_reacting.Tstatic_init', 'ncc_reacting2.Tstatic_init' ]) self.connect('npss_reacting.Comb_FAR', ['ncc_reacting.FAR', 'ncc_reacting2.FAR']) self.connect('npss_reacting.Inlet_Fl_O_rhos', ['ncc_reacting.rho_air', 'ncc_reacting2.rho_air']) self.connect('npss_reacting.Bld1_BldOut_W', ['ncc_reacting.bc7_mdot', 'ncc_reacting2.bc7_mdot']) self.connect('npss_reacting.Bld1_Fl_O_Ts', ['ncc_reacting.bc7_Tstatic', 'ncc_reacting2.bc7_Tstatic'])
def configure(self): self._tdir = mkdtemp() #Components self.add("spiral_meta_model", MetaModel()) self.spiral_meta_model.surrogate = {'default': KrigingSurrogate()} self.spiral_meta_model.model = SpiralComponent() self.spiral_meta_model.recorder = DBCaseRecorder(':memory:') self.spiral_meta_model.force_execute = True self.add("MOEI", MultiObjExpectedImprovement()) self.MOEI.criteria = [ 'spiral_meta_model.f1_xy', 'spiral_meta_model.f2_xy' ] self.add("filter", ParetoFilter()) self.filter.criteria = [ 'spiral_meta_model.f1_xy', 'spiral_meta_model.f2_xy' ] self.filter.case_sets = [ self.spiral_meta_model.recorder.get_iterator() ] self.filter.force_execute = True #Driver Configuration self.add("DOE_trainer", DOEdriver()) self.DOE_trainer.sequential = True self.DOE_trainer.DOEgenerator = OptLatinHypercube(num_samples=25) self.DOE_trainer.add_parameter("spiral_meta_model.x") self.DOE_trainer.add_parameter("spiral_meta_model.y") self.DOE_trainer.add_event("spiral_meta_model.train_next") self.DOE_trainer.case_outputs = [ 'spiral_meta_model.f1_xy', 'spiral_meta_model.f2_xy' ] self.DOE_trainer.recorders = [ DBCaseRecorder(os.path.join(self._tdir, 'trainer.db')) ] self.add("MOEI_opt", Genetic()) self.MOEI_opt.opt_type = "maximize" self.MOEI_opt.population_size = 100 self.MOEI_opt.generations = 10 #self.MOEI_opt.selection_method = "tournament" self.MOEI_opt.add_parameter("spiral_meta_model.x") self.MOEI_opt.add_parameter("spiral_meta_model.y") self.MOEI_opt.add_objective("MOEI.PI") self.add("retrain", MyDriver()) self.retrain.add_event("spiral_meta_model.train_next") self.retrain.recorders = [ DBCaseRecorder(os.path.join(self._tdir, 'retrain.db')) ] self.add("iter", IterateUntil()) self.iter.iterations = 30 self.iter.add_stop_condition('MOEI.PI <= .0001') #Iteration Heirarchy self.driver.workflow.add(['DOE_trainer', 'iter']) self.DOE_trainer.workflow.add('spiral_meta_model') self.iter.workflow = SequentialWorkflow() self.iter.workflow.add(['filter', 'MOEI_opt', 'retrain']) self.MOEI_opt.workflow.add(['spiral_meta_model', 'MOEI']) self.retrain.workflow.add('spiral_meta_model') #Data Connections self.connect("filter.pareto_set", "MOEI.best_cases") self.connect("spiral_meta_model.f1_xy", "MOEI.predicted_values[0]") self.connect("spiral_meta_model.f2_xy", "MOEI.predicted_values[1]")