SQP
Options table
Option |
Type |
Default Value |
Description |
|---|---|---|---|
problem |
Problem or ProblemLite |
None |
Object containing the problem to be solved. |
recording |
bool |
False |
If |
out_dir |
str |
None |
The directory to store all the output files generated from the optimization. |
hot_start_from |
str |
None |
The record file from which to hot-start the optimization. |
hot_start_atol |
float |
0. |
The absolute tolerance check for the inputs when reusing outputs from the hot-start record. |
hot_start_rtol |
float |
0. |
The relative tolerance check for the inputs when reusing outputs from the hot-start record. |
visualize |
list |
[] |
The list of scalar variables to visualize during the optimization. |
keep_viz_open |
bool |
False |
If |
turn_off_outputs |
bool |
False |
If |
maxiter |
int |
1000 |
Maximum number of major iterations. |
opt_tol |
float |
1e-7 |
Optimality tolerance. |
feas_tol |
float |
1e-7 |
Feasibility tolerance. Certifies convergence when the “scaled” maximum constraint violation is less than this value. |
qp_tol |
float |
1e-4 |
Tolerance for the QP subproblem. |
qp_maxiter |
int |
5000 |
Maximum number of iterations for the QP subproblem. |
ls_min_step |
float |
1e-14 |
Minimum step size for the line search. |
ls_max_step |
float |
1. |
Maximum step size for the line search. |
ls_maxiter |
int |
10 |
Maximum number of iterations for the line search. |
ls_alpha_tol |
float |
1e-14 |
Relative tolerance for an acceptable step in the line search. |
ls_eta_a |
float |
1e-4 |
Armijo (sufficient decrease condition) parameter for the line search. |
ls_eta_w |
float |
0.9 |
Wolfe (curvature condition) parameter for the line search. |
readable_outputs |
list |
[] |
List of outputs to be written to readable text output files. Available outputs are: ‘major’, ‘obj’, ‘x’, ‘lag_mult’, ‘slacks’, ‘constraints’, ‘opt’, ‘feas’, ‘time’, ‘nfev’, ‘ngev’, ‘step’, ‘rho’, ‘merit’. |
Source code
The source code is available here.
API
- class modopt.SQP(problem, recording=False, out_dir=None, hot_start_from=None, hot_start_atol=0.0, hot_start_rtol=0.0, visualize=[], keep_viz_open=False, turn_off_outputs=False, **kwargs)[source]
A Sequential Quadratic Programming (SQP) algorithm for general constrained optimization.
- Parameters
- problemProblem or ProblemLite
Object containing the problem to be solved.
- recordingbool, default=False
If
True, record all outputs from the optimization. This needs to be enabled for hot-starting the same problem later, if the optimization is interrupted.- out_dirstr, optional
The directory to store all the output files generated from the optimization.
- hot_start_fromstr, optional
The record file from which to hot-start the optimization.
- hot_start_atolfloat, default=0.
The absolute tolerance check for the inputs when reusing outputs from the hot-start record.
- hot_start_rtolfloat, default=0.
The relative tolerance check for the inputs when reusing outputs from the hot-start record.
- visualizelist, default=[]
The list of scalar variables to visualize during the optimization.
- keep_viz_openbool, default=False
If
True, keeps the visualization window open after the optimization is complete.- turn_off_outputsbool, default=False
If
True, prevent modOpt from generating any output files.- maxiterint, default=1000
Maximum number of major iterations.
- opt_tolfloat, default=1e-7
Optimality tolerance.
- feas_tolfloat, default=1e-7
Feasibility tolerance. Certifies convergence when the “scaled” maximum constraint violation is less than this value.
- qp_tolfloat, default=1e-4
Tolerance for the QP subproblem.
- qp_maxiterint, default=5000
Maximum number of iterations for the QP subproblem.
- ls_min_stepfloat, default=1e-14
Minimum step size for the line search.
- ls_max_stepfloat, default=1.
Maximum step size for the line search.
- ls_maxiterint, default=10
Maximum number of iterations for the line search.
- ls_alpha_tolfloat, default=1e-14
Relative tolerance for an acceptable step in the line search.
- ls_eta_afloat, default=1e-4
Armijo (sufficient decrease condition) parameter for the line search.
- ls_eta_wfloat, default=0.9
Wolfe (curvature condition) parameter for the line search.
- readable_outputslist, default=[]
List of outputs to be written to readable text output files. Available outputs are: ‘major’, ‘obj’, ‘x’, ‘lag_mult’, ‘slacks’, ‘constraints’, ‘opt’, ‘feas’, ‘time’, ‘nfev’, ‘ngev’, ‘step’, ‘rho’, ‘merit’.
Methods
check_first_derivatives([x, step, formulation])Check the first derivatives of the optimization problem using finite differences.
print_results([summary_table, all])Print the results of the optimization problem to the terminal.
solve()Run the optimization algorithm to solve the problem.
- check_first_derivatives(x=None, step=1e-06, formulation='rs')
Check the first derivatives of the optimization problem using finite differences.
- Parameters
- xnp.ndarray, optional
The design variables at which the derivatives are to be checked. If not provided, the initial design variables are used.
- stepfloat, default=1e-6
The step size for the finite differences.
- print_results(summary_table=False, all=False)
Print the results of the optimization problem to the terminal.
- Parameters
- summary_tablebool, default=False
If
True, print the summary table for the optimization.- allbool, default=False
If
False, print only the scalar outputs of the optimization problem. Otherwise, print all the outputs of the optimization problem.
- solve()[source]
Run the optimization algorithm to solve the problem.