Sequential Quadratic Programming (SQP) is an iterative numerical optimization method that solves a constrained Nonlinear Programming (NLP) problem by repeatedly approximating it as a simpler, locally convex Quadratic Programming (QP) subproblem. At each iteration, SQP constructs a QP that models the original problem's Lagrangian using a local quadratic approximation of the objective function and linearizations of the constraints. Solving this QP yields a search direction and step size, updating the solution until convergence to a local optimum that satisfies the Karush-Kuhn-Tucker (KKT) conditions.
Glossary
Sequential Quadratic Programming (SQP)

What is Sequential Quadratic Programming (SQP)?
Sequential Quadratic Programming (SQP) is a prominent iterative algorithm for solving constrained Nonlinear Programming (NLP) problems, which are central to advanced control methods like Nonlinear Model Predictive Control (NMPC).
In Nonlinear Model Predictive Control (NMPC), SQP is the workhorse solver for the online Optimal Control Problem (OCP). It efficiently handles the nonlinear dynamic model and state and input constraints that define the control task. The algorithm's efficiency is often enhanced via warm-starting, using the solution from the previous control step to initialize the next QP subproblem. This makes SQP particularly suited for the real-time optimization (RTO) requirements of robotic and process control, where a solution must be computed within a strict sampling period.
Key Features of SQP
Sequential Quadratic Programming (SQP) is a prominent iterative algorithm for solving Nonlinear Programming (NLP) problems. It is a cornerstone for Nonlinear Model Predictive Control (NMPC), where it efficiently handles the non-convex optimization required for constrained, dynamic systems.
Local Quadratic Approximation
At its core, SQP solves a difficult Nonlinear Programming (NLP) problem by iteratively approximating it with simpler, convex Quadratic Programming (QP) subproblems. At each iteration k, it constructs a local quadratic model of the Lagrangian function (which combines the objective and constraints) around the current iterate (x_k, λ_k). This involves calculating:
- The gradient of the Lagrangian.
- An approximation of the Hessian of the Lagrangian (often using BFGS or SR1 quasi-Newton updates). The resulting QP subproblem has a quadratic objective and linearized constraints, which can be solved efficiently with dedicated QP solvers.
Superlinear Convergence Rate
When properly implemented with exact second-order derivative information (or high-quality quasi-Newton approximations), SQP exhibits a superlinear convergence rate. This means that near the optimal solution, the error decreases faster than linearly (e.g., ||x_{k+1} - x*|| / ||x_k - x*|| → 0). This property is critical for Real-Time Optimization (RTO) in NMPC, as it allows the algorithm to reach a high-accuracy solution in very few iterations, meeting stringent sampling time requirements. The convergence rate is a key advantage over first-order methods like gradient descent.
Exact Hessian & Merit Functions
A major implementation challenge is ensuring global convergence (convergence from any starting point) while maintaining fast local convergence. Two key mechanisms address this:
- Merit Function: A scalar function (like an
l1or augmented Lagrangian penalty function) that balances reduction in the objective with constraint violation. It determines whether a proposed step should be accepted. - Trust-Region Methods: As an alternative to line searches, these methods restrict the step size to a region where the quadratic model is trusted, dynamically adjusting the region size based on model accuracy. These mechanisms allow the algorithm to take reliable progress steps far from the optimum while preserving the superlinear rate near the solution.
Active-Set Strategy for Constraints
SQP naturally and efficiently handles both equality and inequality constraints. Each QP subproblem solves for a step that respects linearized versions of the original constraints. A crucial part of the QP solution is identifying the active set—the subset of inequality constraints that are binding (equal to their bound) at the solution of the subproblem. The algorithm's ability to accurately predict and adapt this active set from iteration to iteration is central to its efficiency. This makes SQP particularly well-suited for NMPC problems with tight state and input constraints, such as actuator limits or safety boundaries.
Warm-Starting for NMPC
This is perhaps SQP's most powerful feature in the context of Receding Horizon Control. At each control time step t, the NMPC problem is re-solved with a shifted horizon and new initial state measurement. The solution from the previous time step t-1 (shifted appropriately) provides an excellent initial guess (or warm start) for the primal variables (x, u) and dual variables (λ) (Lagrange multipliers) of the new problem. Because the optimal solution typically changes smoothly between time steps, SQP often requires only 1-2 iterations to reconverge from this warm start, making real-time execution feasible for many nonlinear systems.
Connection to KKT Conditions
SQP is derived directly from the Karush-Kuhn-Tucker (KKT) conditions, which are the first-order necessary conditions for optimality in constrained NLP. The QP subproblem solved at each SQP iteration is essentially a Newton or quasi-Newton step applied to the system of nonlinear equations formed by the KKT conditions. This direct root-finding approach on the optimality conditions is why SQP is considered a second-order method and achieves its fast convergence. It simultaneously solves for the optimal primal variables and the corresponding Lagrange multipliers, providing sensitivity information about how constraints affect the optimum.
SQP vs. Other Nonlinear Optimization Methods
A comparison of Sequential Quadratic Programming (SQP) against other prominent algorithms used to solve the Nonlinear Programming (NLP) problems at the core of Nonlinear Model Predictive Control (NMPC).
| Feature / Metric | Sequential Quadratic Programming (SQP) | Interior-Point Method (IPM) | Direct Multiple Shooting | Genetic Algorithm (GA) |
|---|---|---|---|---|
Primary Mathematical Approach | Iteratively solves local Quadratic Programming (QP) approximations of the NLP | Solves a sequence of barrier problems, approaching optimum from interior of feasible region | Discretizes horizon into segments, solves IVPs, enforces continuity via constraints | Population-based stochastic search inspired by biological evolution |
Typical Convergence Rate | Local quadratic convergence (near solution) | Superlinear convergence | Depends on underlying NLP solver (e.g., SQP or IPM) | No guaranteed convergence; probabilistic improvement |
Handling of Nonlinear Constraints | Explicit linearization of constraints in QP subproblem | Handled via barrier/penalty functions in the modified objective | Explicitly enforced at shooting nodes and via continuity constraints | Typically handled via penalty functions or specialized operators |
Suitability for Real-Time NMPC | High (with warm-starting) | Moderate to High (structure-exploiting implementations) | Moderate (requires solving larger, structured NLP) | Very Low (high computational cost per iteration) |
Global Optimality Guarantee | ||||
Provable Local Convergence to KKT Point | ||||
Native Handling of Inequality Constraints | ||||
Standard Use of Derivative Information | First & often second derivatives (Hessian) | First & often second derivatives (Hessian) | First & often second derivatives | |
Primary Advantage for NMPC | Fast local convergence; natural fit for warm-starting from previous solution | Robust handling of inequalities; good for large, sparse problems | Improved numerical stability for unstable systems; natural parallelization | Potential to find global optimum in non-convex, discontinuous problems |
Primary Disadvantage for NMPC | Requires good initial guess; may converge to local minima | Can be computationally heavy per iteration; barrier parameter management | Increased problem size (additional variables); more complex implementation | Extremely slow; no convergence guarantees; poor constraint handling |
Typical Implementation for NMPC | Real-time iteration (RTI) schemes | Primal-dual methods | Often combined with SQP or IPM as the underlying NLP solver | Generally avoided for online control due to speed |
Applications and Use Cases
Sequential Quadratic Programming (SQP) is a cornerstone algorithm for solving the complex Nonlinear Programming (NLP) problems at the heart of Nonlinear Model Predictive Control (NMPC). Its primary application is converting these intractable NLPs into a series of simpler, solvable Quadratic Programming (QP) subproblems. This card grid details its critical roles in advanced control and optimization.
Core Engine for Nonlinear MPC
SQP is the dominant iterative method for solving the Nonlinear Programming (NLP) problem that must be solved online at each control step in Nonlinear MPC (NMPC). It enables NMPC by:
- Linearizing the nonlinear system dynamics and constraints around the current state estimate.
- Approximating the cost function as a quadratic form.
- Solving the resulting Quadratic Programming (QP) subproblem to find a search direction.
- Iterating this process until convergence to a (local) optimum for the control sequence. This allows real-time control of systems with significant nonlinearities, such as chemical reactors or agile autonomous vehicles, where linear approximations fail.
Real-Time Trajectory Optimization
In robotics and aerospace, SQP enables real-time trajectory optimization for dynamic systems. Applications include:
- Autonomous Vehicle Path Planning: Computing smooth, collision-free trajectories that respect vehicle dynamics and actuator limits.
- Robotic Arm Motion Planning: Optimizing joint trajectories for manipulation tasks while minimizing jerk or energy.
- Rocket Landing Guidance: Solving fuel-optimal descent profiles under complex nonlinear dynamics and state constraints. SQP's ability to handle nonlinear equality and inequality constraints directly is crucial here, as it allows the optimizer to respect physical limits (e.g., torque saturation, obstacle boundaries) throughout the planned motion.
Integration with Direct Optimal Control Methods
SQP is not a standalone discretization method but is frequently used as the solver within broader direct optimal control frameworks. It pairs with:
- Direct Multiple Shooting: The time horizon is split into segments, and SQP solves the large, sparse NLP that results from parameterizing controls and states on each segment and enforcing continuity constraints.
- Direct Collocation: Both states and controls are discretized, and SQP solves the NLP where the system dynamics are enforced via algebraic constraints at collocation points. These combinations are implemented in tools like ACADO Toolkit and CasADi, where SQP (often with Interior-Point methods) provides the numerical engine to solve the discretized problem efficiently.
Handling Hard Constraints in Dynamic Systems
A key advantage of SQP within MPC is its native and rigorous handling of hard constraints. This is vital for:
- Process Safety: In chemical plant MPC, SQP ensures temperatures and pressures never exceed safe operating limits.
- Actuator Saturation: Prevents commands that would overdrive motors, valves, or thrusters.
- Obstacle Avoidance: Encodes collision constraints as nonlinear inequalities for drones or mobile robots. By solving a constrained optimization problem at each step, SQP-based NMPC actively anticipates future constraint violations and adjusts the control plan proactively, unlike traditional control which reacts after a violation occurs.
Warm-Starting for Computational Efficiency
The sequential nature of SQP is exploited via warm-starting to meet the strict latency requirements of real-time control (often < 100ms).
- Mechanism: The optimal solution (and the associated QP matrices) from the previous MPC time step is used to initialize the SQP solver for the current step.
- Impact: This dramatically reduces the number of SQP iterations needed for convergence, as the system state and optimal solution typically change only incrementally between sampling instants.
- Result: Enables the use of NMPC with SQP on embedded hardware for fast dynamic systems, such as autonomous quadrotors or automotive active suspension control.
Economic and Advanced Process Optimization
Beyond setpoint tracking, SQP enables Economic MPC (EMPC) and complex multi-objective optimization in industrial settings.
- Economic Objective Minimization: Directly optimizing for profit, energy consumption, or raw material cost using nonlinear cost functions.
- Batch Process Optimization: Optimizing time-varying trajectories for temperature or feed rates in pharmaceutical or specialty chemical production.
- Integration with Real-Time Optimization (RTO): Solving steady-state economic optimization problems that provide targets to a lower-level MPC layer. SQP handles the nonlinear process models and economic gradients involved in these non-quadratic, non-convex problems, bridging dynamic control with plant-wide economic performance.
Frequently Asked Questions
Sequential Quadratic Programming (SQP) is a cornerstone algorithm for solving the Nonlinear Programming (NLP) problems at the heart of advanced control systems like Nonlinear Model Predictive Control (NMPC). These FAQs address its core mechanics, applications, and practical considerations for engineers.
Sequential Quadratic Programming (SQP) is an iterative numerical optimization algorithm designed to solve Nonlinear Programming (NLP) problems by approximating them as a sequence of simpler Quadratic Programming (QP) subproblems. At each iteration, SQP constructs a local quadratic approximation of the Lagrangian (which combines the original cost function and constraints) and linearizes the constraints. It then solves this QP subproblem to find a search direction and step size, updating the solution until convergence criteria are met. This method is prized for its superlinear convergence rate near the solution, making it highly efficient for the real-time optimization required in Nonlinear MPC (NMPC).
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Sequential Quadratic Programming (SQP) is a cornerstone algorithm for solving the Nonlinear Programming (NLP) problems central to advanced control systems like Nonlinear MPC. The following terms define the mathematical and computational landscape in which SQP operates.
Nonlinear Programming (NLP)
Nonlinear Programming (NLP) is the mathematical framework for optimizing a scalar objective function subject to constraints, where the function or constraints are nonlinear. This is the fundamental problem class solved by SQP.
- Core Problem: Minimize
f(x)subject tog(x) = 0andh(x) ≤ 0, wheref,g, andhare smooth, potentially nonlinear functions. - Role in NMPC: The online optimization in Nonlinear Model Predictive Control is formulated as an NLP, where
fis the cost over the horizon,grepresents the system dynamics, andhencodes state/input constraints. - Challenges: NLPs are non-convex, making them significantly harder to solve than Linear or Quadratic Programs, requiring iterative algorithms like SQP.
Quadratic Programming (QP)
Quadratic Programming (QP) is an optimization problem with a quadratic objective function and linear constraints. It is a convex problem with efficient, reliable solvers.
- Standard Form: Minimize
(1/2)xᵀHx + cᵀxsubject toA_eq x = b_eqandA_ineq x ≤ b_ineq. - SQP's Core Mechanism: At each iteration, SQP approximates the original NLP by constructing a local QP subproblem. This QP uses:
- A local quadratic model of the Lagrangian (for the objective
Hmatrix). - Linearized versions of the constraints (
Amatrices).
- A local quadratic model of the Lagrangian (for the objective
- Solving the Subproblem: The solution to this QP provides a search direction (e.g., a step toward the optimum). The reliability of QP solvers is key to SQP's robustness.
Karush-Kuhn-Tucker (KKT) Conditions
The Karush-Kuhn-Tucker (KKT) conditions are first-order necessary conditions for a solution to be optimal in a constrained nonlinear optimization problem. They generalize the method of Lagrange multipliers to handle inequality constraints.
- Components: For an optimal point
x*, there must exist Lagrange multipliers (λ, μ) such that:- Stationarity: ∇f(x*) + ∇g(x*)ᵀλ + ∇h(x*)ᵀμ = 0
- Primal Feasibility: g(x*) = 0, h(x*) ≤ 0
- Dual Feasibility: μ ≥ 0
- Complementary Slackness: μᵢ hᵢ(x*) = 0 for all i
- SQP's Target: Each QP subproblem in SQP is built to model the KKT conditions of the original NLP. Solving the QP finds a step that drives the system toward satisfying these conditions.
Active-Set Method
An active-set method is a common approach for solving Quadratic Programming (QP) subproblems within SQP. It iteratively identifies which inequality constraints are 'active' (i.e., exactly equal to their bound) at the solution.
- Mechanism: The method maintains a working set of constraints treated as equalities. It solves an equality-constrained QP, then updates the working set based on the computed step and Lagrange multiplier signs.
- Efficiency: It is highly efficient for QPs where the number of active constraints is small compared to the total number of variables and constraints.
- Warm-Starting: Active-set methods benefit greatly from warm-starting—using the active set from the previous SQP iteration as an initial guess—which dramatically speeds up convergence in real-time MPC applications.
Merit Function & Line Search
A merit function is a scalar function used to assess the quality of a candidate step in SQP, balancing reduction in the objective with violation of the constraints. A line search procedure then uses this function to ensure global convergence.
- Purpose: The pure Newton step from the QP subproblem may not lead to improvement in the actual NLP. The merit function (e.g.,
L1or augmented Lagrangian) quantifies progress. - Process: After computing a search direction
pₖfrom the QP, SQP performs a line search:xₖ₊₁ = xₖ + α pₖ. The step sizeα∈ (0,1] is chosen to produce a 'sufficient decrease' in the merit function. - Result: This safeguards the algorithm, ensuring it converges to a local optimum from remote starting points, which is critical for the reliability of Nonlinear MPC.
Interior-Point Method (IPM)
An Interior-Point Method (IPM) is an alternative to active-set methods for solving the QP subproblems in SQP. Instead of tracking the active set, IPMs approach the solution from the interior of the feasible region by using barrier functions.
- Mechanism: Inequality constraints are incorporated into the objective via a logarithmic barrier term, transforming the QP into a sequence of unconstrained or equality-constrained problems.
- Advantages for SQP:
- Predictable Runtime: Often more consistent iteration counts than active-set methods, beneficial for real-time MPC.
- Handles Dense Problems Well: Efficient for problems where the Hessian
His not sparse.
- Usage: Many modern, high-performance QP solvers used in production MPC systems (e.g., FORCES Pro, HPIPM) are based on IPM variants.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us