RCAIDE.Framework.Optimization.Packages.trmm.Trust_Region_Optimization.Trust_Region_Optimization#

class Trust_Region_Optimization(*args, **kwarg)[source]#

Bases: Data

A trust region optimization

Assumptions: Only SNOPT is implemented

Source: None

__init__(*args, **kwarg)#

Methods

accuracy_ratio(f_center, f_hi, f_corr, ...)

Compute the trust region accuracy ratio.

calculate_constraint_violation(gval, lb, ub)

Calculates the constraint violation using a 2-norm of the violated constraint values.

calculate_correction(f, df, g, dg, tr)

Calculates additive correction factors.

evaluate_constraints(x[, problem, ...])

Evaluates the RCAIDE nexus problem provides an objective value based on constraint violation.

evaluate_corrected_model(x[, problem, ...])

Evaluates the RCAIDE nexus problem and applies corrections to the results.

evaluate_model(problem, x[, der_flag])

Evaluates the RCAIDE nexus problem.

initialize_SLSQP_constraints(con, problem, ...)

optimize(problem[, print_output])

Optimizes the problem

scale_vals(inp, con, ini, bnd, scl)

Scales inputs, constraints, and their bounds.

unpack_constraints_slsqp(x, con_ind, sign, ...)

update_tr_size(rho, tr, accepted)

Updates the trust region size based on the accuracy ratio and if it has been accepted.

optimize(problem, print_output=False)[source]#

Optimizes the problem

Assumptions: Currently only works with SNOPT

Source: “A trust-region framework for managing the use of approximation models in optimization,” Alexandrov et. al., 1998 Details do not follow exactly.

Inputs: problem. <Nexus class> (also passed into other functions)

optimization_problem.

inputs Numpy array matching standard RCAIDE optimization setup objective Numpy array matching standard RCAIDE optimization setup constraints Numpy array matching standard RCAIDE optimization setup

fidelity_level [-]

print_output <boolean> Determines if output is printed during the optimization run

Outputs: (fOpt_corr,xOpt_corr,str):

fOpt_corr <float> xOpt_corr <numpy array> str Varies depending on the result of the optimization

Properties Used: self.

trust_region_max_iterations [-] fidelity_levels [-] evaluation_order List of the fidelity level order evaluate_model(..) calculate_correction(..) calculate_constraint_violation(..) optimizer <string> Determines what optimizer is used evaluate_corrected_model(..) optimizer_max_iterations [-] optimizer_convergence_tolerance [-] optimizer_constraint_tolerance [-] optimizer_function_precision [-] optimizer_verify_level Int determining if SNOPT will verify that the minimum is level accuracy_ratio(..) update_tr_size(..) convergance_tolerance [-]

evaluate_model(problem, x, der_flag=True)[source]#

Evaluates the RCAIDE nexus problem. This is often a mission evaluation.

Assumptions: None

Source: N/A

Inputs: problem. <Nexus class>

objective(..) all_constraints(..) finite difference(..)

x <numpy array> der_flag <boolean> Determines if finite differencing is done

Outputs: f - function value <float> df - derivative of f <numpy array> g - constraint value <numpy array> (only returned if der_flag is True) dg - jacobian of g <numpy array> (only returned if der_flag is True)

Properties Used: self.difference_interval [-]

evaluate_corrected_model(x, problem=None, corrections=None, tr=None, return_cons=False)[source]#

Evaluates the RCAIDE nexus problem and applies corrections to the results.

Assumptions: None

Source: N/A

Inputs: problem. <Nexus class>

objective(..) all_constraints(..)

corrections <tuple> Contains correction factors tr.center <array>

Outputs: obj function objective cons list of contraint values fail indicates if the evaluation was successful

Properties Used: None

evaluate_constraints(x, problem=None, corrections=None, tr=None, lb=None, ub=None)[source]#

Evaluates the RCAIDE nexus problem provides an objective value based on constraint violation. Correction factors are applied to the evaluation results.

Assumptions: None

Source: N/A

Inputs: problem. <Nexus class>

objective(..) all_constraints(..)

corrections <tuple> Contains correction factors tr.center <numpy array> lb <numpy array> lower bounds on the constraints up <numpy array> upper bounds on the constraints

Outputs: obj_cons objective based on constraint violation cons list of contraint values fail indicates if the evaluation was successful

Properties Used: self.calculate_constraint_violation(..)

calculate_constraint_violation(gval, lb, ub)[source]#

Calculates the constraint violation using a 2-norm of the violated constraint values.

Assumptions: None

Source: N/A

Inputs: gval <numpy array> constraint values lb <numpy array> lower bounds on the constraints up <numpy array> upper bounds on the constraints

Outputs: constraint violation [-]

Properties Used: None

calculate_correction(f, df, g, dg, tr)[source]#

Calculates additive correction factors.

Assumptions: None

Source: N/A

Inputs: f - function value <float> df - derivative of f <numpy array> g - constraint value <numpy array> (only returned if der_flag is True) dg - jacobian of g <numpy array> (only returned if der_flag is True)

Outputs: corr <tuple> correction factors

Properties Used: None

scale_vals(inp, con, ini, bnd, scl)[source]#

Scales inputs, constraints, and their bounds.

Assumptions: None

Source: N/A

Inputs: (all RCAIDE format specific numpy arrays) inp Design variables con Constraint limits ini Initial values bnd Variable bounds scl Scaling factors

Outputs: x <numpy array> Scaled design variables scaled_constraints <numpy array> x_low_bound <numpy array> x_up_bound <numpy array> con_up_edge <numpy array> con_low_edge <numpy array> name <list of strings> List of variable names

Properties Used: None

accuracy_ratio(f_center, f_hi, f_corr, g_viol_center, g_viol_hi, g_viol_corr, tr)[source]#

Compute the trust region accuracy ratio.

Assumptions: None

Source: N/A

Inputs: f_center Objective value at the center of the trust region f_hi High-fidelity objective value at the expected optimum f_corr Corrected low-fidelity objective value at the expected optimum g_viol_center Constraint violation at the center of the trust region g_viol_hi High-fidelity constraint violation at the expected optimum g_viol_corr Corrected low-fidelity constraint violation at the expected optimum tr.evaluation_function(..)

Outputs: rho [-] accuracy ratio

Properties Used: self.trust_region_function_precision [-]

update_tr_size(rho, tr, accepted)[source]#

Updates the trust region size based on the accuracy ratio and if it has been accepted.

Assumptions: None

Source: N/A

Inputs: rho [-] accuracy ratio tr.

size [-] contraction_factor [-] contract_threshold [-] expand_threshold [-] expansion_factor [-]

Outputs: tr_action [-] number indicating the type of action done by the trust region

Properties Used: None

initialize_SLSQP_constraints(con, problem, corrections, tr)[source]#
unpack_constraints_slsqp(x, con_ind, sign, edge, problem, corrections, tr)[source]#