ensqp⚓︎
Ensemble-based sequential quadratic programming (EnSQP) for constrained optimization.
EnSQP
⚓︎
Bases: OptimizerBase
Ensemble-based sequential quadratic programming.
Solves
with every derivative estimated from one ensemble of perturbed controls per iteration: the gradient of the objective, the Jacobian of the constraints and, optionally, the Hessian of the Lagrangian \(L = f - \lambda_{eq}^T c_{eq} - \lambda_{iq}^T c_{iq}\). Each iteration draws the ensemble, solves a quadratic program for the step and the multipliers, and backtracks on the \(\ell_1\) merit function \(f + \mu (\|c_{eq}\|_1 + \|\min(c_{iq}, 0)\|_1)\). The simulations per iteration are those of EnOpt: one ensemble plus the trial points of the line search.
With fewer ensemble members than controls the derivatives are known only along the perturbations. The step is then sought in the subspace they span, where the linear model of objective and constraints is reliable, and the Hessian is updated with the curvature measured along each accepted step.
The objective returns the constraint values with the objective value, from the same
simulation: {'f': ..., 'c_eq': ..., 'c_iq': ...}. With a popt ensemble::
EnSQP.minimize(ens.get_state(), ens.function_and_constraints, jac=ens.gradient,
con_jac=ens.constraint_jacobian, hess=ens.lagrangian_hessian,
args=(ens.get_cov(),), bounds=ens.get_bounds(), **options)
__init__(x0, fun, jac=None, hess=None, args=(), bounds=None, callback=None, con_jac=None, **options)
⚓︎
Initialize an EnSQP optimizer instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x0
|
ndarray
|
Initial control vector. |
required |
fun
|
callable
|
Objective and constraints at a control vector: a dict with |
required |
jac
|
callable
|
Ensemble gradient of the objective. |
None
|
hess
|
callable
|
Ensemble Hessian of the Lagrangian, taking the multipliers as the keyword
|
None
|
args
|
tuple
|
The first element is the covariance the ensemble is drawn with. Leave empty for callables that take the control vector only. |
()
|
bounds
|
sequence
|
Lower and upper bounds for each control. |
None
|
callback
|
callable
|
Called with the optimizer after every accepted step. |
None
|
con_jac
|
callable
|
Ensemble Jacobian of the constraints, a dict with |
None
|
**options
|
EnSQP configuration, plus everything :class: |
{}
|
check_function_convergence()
⚓︎
A small change in the objective only counts at a feasible point (and see :meth:_patience).
check_state_convergence()
⚓︎
A small step only counts at a feasible point (and see :meth:_patience).
log_columns()
⚓︎
The row of the iteration log: iteration, step halvings, objective, violation, penalty, step and KKT residual.
update_step()
⚓︎
One SQP iteration: ensemble derivatives, QP, and a line search on the merit function.