Individual package setups that help you interface with other codes. More...
Modules | |
TRMM | |
Trust Region Model Management Scripts live here. | |
Individual package setups that help you interface with other codes.
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.Additive_Solve | ( | self, | |
problem, | |||
num_fidelity_levels = 2 , |
|||
num_samples = 10 , |
|||
max_iterations = 10 , |
|||
tolerance = 1e-6 , |
|||
opt_type = 'basic' , |
|||
num_starts = 3 , |
|||
print_output = True |
|||
) |
Solves a multifidelity problem using an additive corrections Assumptions: N/A Source: N/A Inputs: problem [nexus()] num_fidelity_levels [int] num_samples [int] max_iterations [int] tolerance [float] opt_type [str] num_starts [int] print_output [bool] Outputs: (fOpt,xOpt) [tuple] Properties Used: N/A
def SUAVE.Optimization.Package_Setups.ipopt_setup.eval_f | ( | x, | |
problem | |||
) |
Find the objective Assumptions: You can actually install ipopt on your machine Source: N/A Inputs: x [array] problem [nexus()] Outputs: obj [float] Properties Used: None
def SUAVE.Optimization.Package_Setups.ipopt_setup.eval_g | ( | x, | |
problem | |||
) |
Find the constraints Assumptions: You can actually install ipopt on your machine Source: N/A Inputs: x [array] problem [nexus()] Outputs: con [array] Properties Used: None
def SUAVE.Optimization.Package_Setups.ipopt_setup.eval_grad_f | ( | x, | |
problem | |||
) |
Calculate the gradient of the objective function Assumptions: You can actually install ipopt on your machine Source: N/A Inputs: x [array] problem [nexus()] Outputs: grad [array] Properties Used: None
def SUAVE.Optimization.Package_Setups.ipopt_setup.eval_jac_g | ( | x, | |
flag, | |||
problem | |||
) |
Calculate the jacobian of the constraint function If flag is used a structure shape is provided to allow ipopt to size the constraints Assumptions: You can actually install ipopt on your machine Source: N/A Inputs: x [array] flag [bool] problem [nexus()] Outputs: jac_g [array] Properties Used: None
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.evaluate_corrected_model | ( | self, | |
x, | |||
problem = None , |
|||
obj_surrogate = None , |
|||
cons_surrogate = None |
|||
) |
Evaluates the corrected model with the low fidelity plus the corrections Assumptions: N/A Source: N/A Inputs: x [array] problem [nexus()] obj_surrogate [fun()] cons_surrogate [fun()] Outputs: obj [float] const [array] fail [bool] Properties Used: N/A
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.evaluate_expected_improvement | ( | self, | |
x, | |||
problem = None , |
|||
obj_surrogate = None , |
|||
cons_surrogate = None , |
|||
fstar = np.inf , |
|||
cons = None |
|||
) |
Evaluates the expected improvement of the point x Assumptions: N/A Source: N/A Inputs: x [array] problem [nexus()] obj_surrogate [fun()] cons_surrogate [fun()] fstar [float] cons [vector] Outputs: -EI [float] const [array] fail [bool] Properties Used: N/A
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.evaluate_model | ( | self, | |
problem, | |||
x, | |||
cons | |||
) |
Solves the optimization problem to get the objective and constraints Assumptions: N/A Source: N/A Inputs: problem [nexus()] x [array] cons [array] Outputs: f [float] g [array] Properties Used: N/A
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.expected_improvement_carpet | ( | self, | |
lbs, | |||
ubs, | |||
problem, | |||
obj_surrogate, | |||
cons_surrogate, | |||
fstar, | |||
show_log_improvement = False |
|||
) |
Makes a carpet plot of the expected improvement Assumptions: N/A Source: N/A Inputs: lbs [array] lbs [array] problem [nexus()] obj_surrogate [fun()] cons_surrogate [fun()] fstar [float] show_log_improvement [bool] Outputs: Alluring plots that you could only dream of Properties Used: N/A
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.initialize_opt_vals | ( | self, | |
opt_prob, | |||
obj, | |||
inp, | |||
x_low_bound, | |||
x_up_bound, | |||
con_low_edge, | |||
con_up_edge, | |||
nam, | |||
con, | |||
x_eval | |||
) |
Sets up the optimization values Assumptions: N/A Source: N/A Inputs: opt_prob [pyopt_problem()] obj [float] inp [array] x_low_bound [array] x_up_bound [array] con_low_edge [array] con_up_edge [array] nam [list of str] con [array] x_eval [array] Outputs: N/A Properties Used: N/A
def SUAVE.Optimization.Package_Setups.ipopt_setup.Ipopt_Solve | ( | problem | ) |
Solves a Nexus optimization problem using ipopt Assumptions: You can actually install ipopt on your machine Source: N/A Inputs: problem [nexus()] Outputs: result [array] Properties Used: None
def SUAVE.Optimization.Package_Setups.ipopt_setup.make_structure | ( | problem | ) |
Create an array structure to let ipopt know the size of the problem Assumptions: You can actually install ipopt on your machine Source: N/A Inputs: problem [nexus()] Outputs: array [array] Properties Used: None
def SUAVE.Optimization.Package_Setups.particle_swarm_optimization.particle_swarm_optimization | ( | func, | |
lb, | |||
ub, | |||
ieqcons = [] , |
|||
f_ieqcons = None , |
|||
args = () , |
|||
kwargs = {} , |
|||
swarmsize = 100 , |
|||
omega = 0.5 , |
|||
phip = 0.5 , |
|||
phig = 0.5 , |
|||
maxiter = 100 , |
|||
minstep = 1e-8 , |
|||
minfunc = 1e-8 , |
|||
debug = False |
|||
) |
This function perform a particle swarm optimization (PSO) Source: Pyswarm: https://github.com/tisimst/pyswarm Inputs: func : The function to be minimized [function] lb : The lower bounds of the design variable(s) [array] ub : The upper bounds of the design variable(s) [array] ieqcons : A list of functions of length n such that ieqcons[j](x,*args) >= 0.0 in a successfully optimized problem (Default: []) [list] f_ieqcons : Returns a 1-D array in which each element must be greater or equal to 0.0 in a successfully optimized problem. If f_ieqcons is specified, ieqcons is ignored (Default: None) [function] args : Additional arguments passed to objective and constraint functions [tuple] kwargs : Additional keyword arguments passed to objective and constraint functions [dict] swarmsize : The number of particles in the swarm (Default: 100) [int] omega : Particle velocity scaling factor (Default: 0.5) [float] phip : Scaling factor to search away from the particle's best known position (Default: 0.5) [scalar] phig : Scaling factor to search away from the swarm's best known position (Default: 0.5) [scalar] maxiter : The maximum number of iterations for the swarm to search (Default: 100) [int] minstep : The minimum stepsize of swarm's best position before the search terminates (Default: 1e-8) [scalar] minfunc : The minimum change of swarm's best objective value before the search terminates (Default: 1e-8) [scalar] debug : If True, progress statements will be displayed every iteration (Default: False) [boolean] Outputs: g : The swarm's best known position (optimal design) [list] f : The objective value at ``g`` [float] Properties Used: None
Copyright (c) 2015, Sebastian M. Castillo Hair All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by Sebastian M. Castillo Hair. 4. Neither the name of Sebastian M. Castillo Hair nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY SEBASTIAN M. CASTILLO HAIR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEBASTIAN M. CASTILLO HAIR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
def SUAVE.Optimization.Package_Setups.pyoptsparse_setup.PyOpt_Problem | ( | problem, | |
xdict | |||
) |
This wrapper runs the SUAVE problem and is called by the PyOpt solver. Prints the inputs (x) as well as the objective values and constraints. If any values produce NaN then a fail flag is thrown. Assumptions: None Source: N/A Inputs: problem [nexus()] x [array] Outputs: obj [float] cons [array] fail [bool] Properties Used: None
def SUAVE.Optimization.Package_Setups.pyopt_setup.PyOpt_Problem | ( | problem, | |
x | |||
) |
This wrapper runs the SUAVE problem and is called by the PyOpt solver. Prints the inputs (x) as well as the objective values and constraints. If any values produce NaN then a fail flag is thrown. Assumptions: None Source: N/A Inputs: problem [nexus()] x [array] Outputs: obj [float] cons [array] fail [bool] Properties Used: None
def SUAVE.Optimization.Package_Setups.pyopt_setup.Pyopt_Solve | ( | problem, | |
solver = 'SNOPT' , |
|||
FD = 'single' , |
|||
sense_step = 1.0E-6 , |
|||
nonderivative_line_search = False |
|||
) |
This converts your SUAVE Nexus problem into a PyOpt optimization problem and solves it PyOpt has many algorithms, they can be switched out by using the solver input. Assumptions: None Source: N/A Inputs: problem [nexus()] solver [str] FD (parallel or single) [str] sense_step [float] nonderivative_line_search [bool] Outputs: outputs [list] Properties Used: None
def SUAVE.Optimization.Package_Setups.pyopt_surrogate_setup.pyopt_surrogate_setup | ( | surrogate_function, | |
inputs, | |||
constraints | |||
) |
sets up a surrogate problem so it can be run by pyOpt. Makes the problem to be run Assumptions: None Source: N/A Inputs: surrogate_function [nexus()] inputs [array] constraints [array] Outputs: opt_problem [pyOpt problem] Properties Used: None
def SUAVE.Optimization.Package_Setups.pyoptsparse_setup.Pyoptsparse_Solve | ( | problem, | |
solver = 'SNOPT' , |
|||
FD = 'single' , |
|||
sense_step = 1.0E-6 , |
|||
nonderivative_line_search = False |
|||
) |
This converts your SUAVE Nexus problem into a PyOptsparse optimization problem and solves it. Pyoptsparse has many algorithms, they can be switched out by using the solver input. Assumptions: None Source: N/A Inputs: problem [nexus()] solver [str] FD (parallel or single) [str] sense_step [float] nonderivative_line_search [bool] Outputs: outputs [list] Properties Used: None
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.run_objective_optimization | ( | self, | |
opt_prob, | |||
problem, | |||
f_additive_surrogate, | |||
g_additive_surrogate | |||
) |
Runs SNOPT to optimize Assumptions: N/A Source: N/A Inputs: opt_prob [pyopt_problem()] problem [nexus()] f_additive_surrogate [fun()] g_additive_surrogate [fun()] Outputs: fOpt [float] xOpt [array] Properties Used: N/A
def SUAVE.Optimization.Package_Setups.additive_setup.Additive_Solver.scale_vals | ( | self, | |
inp, | |||
con, | |||
ini, | |||
bnd, | |||
scl | |||
) |
Scales values to help setup the problem Assumptions: N/A Source: N/A Inputs: inp [array] con [array] ini [array] bnd [array] scl [array] Outputs: tuple: x [array] scaled_constraints [array] x_low_bounds [array] x_up_bounds [array] con_up_edge [array] con_low_edge [array] Properties Used: N/A
def SUAVE.Optimization.Package_Setups.scipy_setup.SciPy_Problem | ( | problem, | |
x | |||
) |
This wrapper runs the SUAVE problem and is called by the Scipy solver. Prints the inputs (x) as well as the objective value Assumptions: None Source: N/A Inputs: problem [nexus()] x [array] Outputs: obj [float] Properties Used: None
def SUAVE.Optimization.Package_Setups.scipy_setup.SciPy_Solve | ( | problem, | |
solver = 'SLSQP' , |
|||
sense_step = 1.4901161193847656e-08 , |
|||
tolerance = 1e-6 , |
|||
pop_size = 10 , |
|||
prob_seed = None |
|||
) |
This converts your SUAVE Nexus problem into a SciPy optimization problem and solves it SciPy has many algorithms, they can be switched out by using the solver input. Assumptions: 1.4901161193847656e-08 is SLSQP default FD step in scipy Source: N/A Inputs: problem [nexus()] solver [str] sense_step [float] Outputs: outputs [list] Properties Used: None