11. Nonlinear Constrained Optimization
The nonlinear constraint solvers work on the standard form
with the Lagrangian and KKT conditions of section 1.4. nlopt4r provides four entry families: SQP with restoration, the legacy SQP, the exact equality methods (Newton–Lagrange and Lagrange SQP), and PHR augmented Lagrangian.
11.1 SQP model and active-set subproblem
At iterate \(x_k\), SQP builds a subproblem from a quadratic model and linearized constraints:
quadratic::minimize solves the subproblem, and the active-set method returns the step \(d_k\) with multiplier estimates. The subproblem requires a consistent linearization; when the linearization is infeasible, the legacy SQP returns Infeasible and the restoration entry starts its restoration phase.
The Hessian model \(B_k\) uses the Powell damped BFGS update. With
the update is
Multipliers interpolate along the step:
The line search uses the \(l_1\) exact penalty function
with penalty parameter \(\pi\ge\max(\lVert\mu\rVert_\infty,\lVert\lambda\rVert_\infty)+1\); each iteration sets it to the larger of its current value and the current multiplier bound plus one.
11.2 Feasibility restoration
constrained::sqp_with_restoration runs a constraint-specific restoration phase when the subproblem is infeasible. The restoration objective is
The restoration iteration:
- assemble residuals and Jacobian rows from the equality rows and the currently violated inequality rows;
- solve a damped augmented QR system for the direction;
- backtrack on the actual nonlinear objective \(\theta\);
- end restoration when the objective decrease reaches the configured ratio
restoration_reduction(default 0.1) or feasibility reaches tolerance.
Restoration resets the Hessian model and multipliers, and the same SQP continues. Each restoration records a RestorationEvent: triggering subproblem error, outer iteration number, violation before and after restoration, restoration iteration count and failure information. max_subproblem_evaluations and max_subproblem_iterations bound the subproblem budget; max_restoration_iterations bounds restoration iterations.
11.3 Exact equality methods
Method::NewtonLagrange and Method::LagrangeSqp of constrained::minimize handle the equality-constrained subset. Both methods solve Newton steps on the KKT system
with the Lagrangian Hessian supplied by the caller. LagrangeSqp adds the stabilization term
The line-search merit function is
and multipliers interpolate along the direction. Inequality constraints are rejected explicitly by these two methods (InvalidInput).
11.4 PHR augmented Lagrangian
constrained::augmented_lagrangian uses the Powell–Hestenes–Rockafellar multiplier method. The augmented objective is
Figure 11-1 Quadratic-penalty minimizer path for the equality constraint \(x_1^2+x_2^2=1\) and objective \((x_1-2)^2+(x_2-1)^2\): with \(\rho=0.25,0.5,1,4,16\), \(x(\rho)\) approaches \(x^*=(0.894,0.447)\) along the feasible curve; with no multiplier update the augmented objective reduces to this penalty. Sections 9.1 and 9.3 of the textbook derive the exterior penalty and multiplier methods, and section 9.4 lists the multphr.m program.
The outer flow:
- inner BFGS minimization of \(\Phi_\rho\) with inner tolerance \(0.1,\tau_g\) (lower bound \(10^{-12}\)) and iteration cap
max_inner_iterations(default 1000); - multiplier updates
- residual \(r=\max(\text{violation},\text{complementarity})\) triggers a penalty doubling when \(k\ge2\) and \(r>0.8,r_{\text{prev}}\);
- convergence when three KKT diagnostics meet their tolerances simultaneously.
Inner objective calls share the strict outer budget. initial_penalty supplies the initial penalty parameter (default 2).
11.5 Report and restoration state
The four entry families report a ConstrainedSolution: objective and iteration status, equality and inequality multipliers, constraint violation, complementarity and inner iteration count. sqp_with_restoration additionally returns the list of restoration events; on failure, SqpError carries the complete last_constrained checkpoint, including multipliers.
The convergence test checks stationarity, feasibility and complementarity together; solution.converged() is true when all three meet their thresholds.
Software interface
Constraintsconstructors and theConstrainedProblemtrait: see chapter 19.SqpOptions,SqpSolution,SqpErrorandRestorationEvent: see chapter 19.- Line search and budgets: see chapter 2 and chapter 12.
- API reference (docs.rs):
constrained.
References
- 马昌凤, 最优化方法及其 Matlab 程序设计 (in Chinese), 2010, chapters 9 and 12.
- M. J. D. Powell, “A method for nonlinear constraints in minimization problems,” in Optimization, Academic Press, 1969.
- M. R. Hestenes, “Multiplier and gradient methods,” J. Optim. Theory Appl. 4 (1969), 303–320.
- J. Nocedal, S. J. Wright, Numerical Optimization, 2nd ed., 2006, Chapters 15, 18.