Skip to content

Sequential Quadratic Programming ​

Constrained

Sequential Quadratic Programming (SQP) optimization algorithm.

Algorithm Overview ​

This module implements the Sequential Quadratic Programming (SQP) algorithm, a powerful method for solving nonlinear constrained optimization problems.

The algorithm iteratively solves quadratic programming subproblems to approximate the original nonlinear problem.

Usage ​

python
from opt.constrained.sequential_quadratic_programming import SequentialQuadraticProgramming
from opt.benchmark.functions import sphere

optimizer = SequentialQuadraticProgramming(
    func=sphere,
    lower_bound=-5.12,
    upper_bound=5.12,
    dim=10,
    max_iter=500,
)

best_solution, best_fitness = optimizer.search()
print(f"Best solution: {best_solution}")
print(f"Best fitness: {best_fitness:.6e}")

Parameters ​

ParameterTypeDefaultDescription
funcCallableRequiredObjective function to minimize.
lower_boundfloatRequiredLower bound of search space.
upper_boundfloatRequiredUpper bound of search space.
dimintRequiredProblem dimensionality.
constraintslist[Callable] | NoneNoneList of inequality constraints in form g(x)≀0 .
eq_constraintslist[Callable] | NoneNoneList of equality constraints in form h(x)=0 .
max_iterint100Maximum SQP iterations.
tolfloat1e-06Convergence tolerance.
seedint | NoneNoneRandom seed for reproducibility.

Algorithm Metadata ​

PropertyValue
Algorithm NameSequential Quadratic Programming
AcronymSQP
Year Introduced1963
AuthorsWilson, R. B.; Han, S. P.; Powell, M. J. D.
Algorithm ClassConstrained
ComplexityO(nΒ³) per QP subproblem
PropertiesGradient-based, Deterministic
ImplementationPython 3.10+
COCO CompatibleYes

Mathematical Formulation ​

At each iteration k , solve quadratic programming subproblem:

mindβˆ‡f(xk)Td+12dTBkdsubject toβˆ‡gi(xk)Td+gi(xk)≀0,βˆ‡hj(xk)Td+hj(xk)=0

where:

  • xk is current iterate
  • d is the search direction
  • Bk approximates Hessian of Lagrangian
  • gi(x) are inequality constraints
  • hj(x) are equality constraints

Update:

xk+1=xk+Ξ±kdk

where Ξ±k is step length from line search.

Constraint handling:

  • Boundary conditions: Bounded QP subproblem via bounds
  • Feasibility enforcement: Linearized constraints in QP
  • KKT conditions: Approximated via Newton's method on KKT system

Hyperparameters ​

ParameterDefaultBBOB RecommendedDescription
max_iter1001000-5000Maximum SQP iterations
tol1e-61e-8Convergence tolerance

Sensitivity Analysis:

  • tol: Medium impact - controls stopping precision
  • Recommended tuning ranges: tol∈[10βˆ’8,10βˆ’4]

COCO/BBOB Benchmark Settings ​

Search Space:

  • Dimensions tested: 2, 3, 5, 10, 20, 40
  • Bounds: Function-specific (typically [-5, 5] or [-100, 100])
  • Instances: 15 per function (BBOB standard)

Evaluation Budget:

  • Budget: dimΓ—10000 function evaluations
  • Independent runs: 15 (for statistical significance)
  • Seeds: 0-14 (reproducibility requirement)

Performance Metrics:

  • Target precision: 1e-8 (BBOB default)
  • Success rate at precision thresholds: [1e-8, 1e-6, 1e-4, 1e-2]
  • Expected Running Time (ERT) tracking

Raises ​

ValueError: If search space is invalid or function evaluation fails.

Notes ​

  • Uses scipy SLSQP (Sequential Least Squares Programming)
  • Multi-start strategy for global exploration
  • BBOB: Returns final best solution after max_iter or convergence

Computational Complexity:

  • Time per iteration: O(n3) for QP subproblem solution
  • Space complexity: O(n2) for QP matrices
  • BBOB budget usage: Typically 10-25% of dim*10000 for convergence

BBOB Performance Characteristics:

  • Best function classes: Smooth, well-conditioned, few active constraints
  • Weak function classes: Non-smooth, highly nonconvex, many constraints
  • Typical success rate at 1e-8 precision: 70-80% (dim=5, smooth problems)
  • Expected Running Time (ERT): Among fastest for smooth constrained problems

Convergence Properties:

  • Convergence rate: Superlinear to quadratic under regularity
  • Local vs Global: Excellent local convergence, multi-start for global
  • Premature convergence risk: Low (robust convergence theory)

Reproducibility:

  • Deterministic: Partially - Random multi-start affects results
  • BBOB compliance: No explicit seed parameter in current implementation
  • Initialization: Multiple random starting points
  • RNG usage: numpy.random for multi-start initialization

Implementation Details:

  • Parallelization: Not supported (sequential multi-start)
  • Constraint handling: Linearized constraints in QP subproblems
  • Numerical stability: SLSQP includes line search and trust region
  • Inner solver: scipy SLSQP (Sequential Least Squares Programming)
  • Multi-start: max(1, max_iter // 10) random starting points

Known Limitations:

  • Requires smooth (continuously differentiable) objective and constraints
  • May fail on highly nonconvex problems without good initialization
  • Multi-start helps but doesn't guarantee global optimum
  • Performance degrades with many active constraints
  • BBOB adaptation note: Standard BBOB is unconstrained; this adds constraints for demonstration

Version History:

  • v0.1.0: Initial implementation
  • v0.1.2: Added COCO/BBOB compliant docstring

References ​

[1] Wilson, R. B. (1963). "A Simplicial Algorithm for Concave Programming." PhD thesis, Harvard University.

[2] Han, S. P. (1977). "A globally convergent method for nonlinear programming." Journal of Optimization Theory and Applications, 22(3), 297-309. https://doi.org/10.1007/BF00932858

[3] Powell, M. J. D. (1978). "A fast algorithm for nonlinearly constrained optimization calculations." Lecture Notes in Mathematics, 630, 144-157. https://doi.org/10.1007/BFb0067703

[4] Nocedal, J., & Wright, S. J. (2006). "Numerical Optimization" (2nd ed.). Springer. Chapter 18: Sequential Quadratic Programming.

[5] Hansen, N., Auger, A., Ros, R., Mersmann, O., TuΕ‘ar, T., Brockhoff, D. (2021). "COCO: A platform for comparing continuous optimizers in a black-box setting." Optimization Methods and Software, 36(1), 114-144. https://doi.org/10.1080/10556788.2020.1808977

COCO Data Archive:

Implementation:

  • This implementation: scipy.optimize.minimize with SLSQP method

See Also ​

AugmentedLagrangian: Penalty + multiplier alternative BBOB Comparison: SQP often faster for smooth problems; ALM more robust

PenaltyMethodOptimizer: Exterior penalty approach BBOB Comparison: SQP superior convergence for smooth constrained problems

BarrierMethodOptimizer: Interior point alternative BBOB Comparison: SQP handles equality constraints better

AbstractOptimizer: Base class for all optimizers opt.benchmark.functions: BBOB-compatible test functions

Related BBOB Algorithm Classes:

  • Classical: SimulatedAnnealing, NelderMead
  • Gradient: AdamW, BFGS

Benchmark Performance ​

Results of the benchmark suite for this optimizer, on the same evaluation budget as every other optimizer and compared with a random search baseline. See the methodology for the protocol and statistics.


Source Code

View the implementation: sequential_quadratic_programming.py

Released under the MIT License.