---
title: Algorithm NCL for Constrained Optimization
url: https://www.emergentmind.com/topics/algorithm-ncl
type: topic
---

# Algorithm NCL for Constrained Optimization

Algorithm NCL, usually expanded as **Nonlinearly Constrained augmented Lagrangian**, is an augmented Lagrangian method for smooth constrained optimization that reformulates classical LANCELOT-style bound-constrained augmented-Lagrangian subproblems as a short sequence of nonlinear programs with explicit nonlinear constraints and auxiliary regularization variables. In the formulation emphasized in the Julia, GPU, and AC-SCOPF papers, NCL targets general smooth nonlinear programs, including cases where the original constraints do not satisfy the LICQ, and extends naturally to degenerate mathematical programs with complementarity constraints (MPCCs) arising in security-constrained AC optimal power flow [2101.02164][2510.05885][2510.13333].

## 1. Definition, lineage, and scope

The basic optimization model treated by NCL is
\[
\min_{x\in\mathbb{R}^n}\ \phi(x)\quad \text{s.t.}\quad c(x)=0,\ \ell \le x \le u,
\]
with smooth objective \(\phi\), smooth constraints \(c\), and simple bounds. Inequality constraints are handled by introducing slack variables into \(x\) [2101.02164].

NCL is explicitly presented as a reformulation of the LANCELOT augmented-Lagrangian method. Classical LANCELOT uses a sequence of **bound-constrained** augmented-Lagrangian subproblems, whereas NCL introduces extra variables and retains nonlinear constraints in each subproblem. This yields a sequence of **nonlinearly constrained** subproblems that can be solved by interior-point methods such as IPOPT and KNITRO, with warm starts between subproblems [2101.02164].

A concise chronology of the optimization literature around Algorithm NCL is as follows.

| Paper | Contribution | Context |
|---|---|---|
| "A Julia implementation of Algorithm NCL for constrained optimization" [2101.02164] | Reformulates LANCELOT in Julia and solves NCL subproblems with IPOPT and KNITRO | General smooth constrained optimization, including non-LICQ models |
| "MadNCL: A GPU Implementation of Algorithm NCL for Large-Scale, Degenerate Nonlinear Programs" [2510.05885] | Develops a GPU implementation with loop fusion, extrapolation, and stabilized or condensed KKT systems | Large-scale and degenerate NLPs, including MPCC constraints |
| "An Augmented Lagrangian Method on GPU for Security-Constrained AC Optimal Power Flow" [2510.13333] | Applies NCL as the core engine for corrective AC-SCOPF with complementarity constraints | AC-SCOPF and MPCC reformulations on GPU |

A central structural fact is that NCL is designed for cases where the original problem may be degenerate. In the Julia formulation, the Jacobian of the NCL subproblem constraints is \(\begin{pmatrix}J(x) & I\end{pmatrix}\), which always has full row rank because of the identity block. Thus the NCL subproblems satisfy LICQ even if the original problem does not [2101.02164]. The later GPU work generalizes this viewpoint to large-scale and degenerate NLPs, including MPCC-type degeneracy [2510.05885].

## 2. Augmented-Lagrangian subproblems and outer iteration

The defining NCL subproblem introduces a slack or regularization variable \(r\in\mathbb{R}^m\) and solves
\[
\min_{x,r}\ \phi(x)+y_k^\top r+\frac{\rho_k}{2}\|r\|^2
\quad\text{s.t.}\quad
c(x)+r=0,\ \ell\le x\le u.
\]
Here \(y_k\) is the current multiplier estimate and \(\rho_k>0\) is the penalty parameter [2510.05885][2101.02164].

This is equivalent to the classical augmented-Lagrangian form because substituting \(r=-c(x)\) recovers
\[
\phi(x)-y_k^\top c(x)+\frac{\rho_k}{2}\|c(x)\|^2.
\]
The distinction is algorithmic rather than variational: NCL keeps a nonlinear constraint in the subproblem instead of collapsing everything into a bound-constrained objective [2101.02164].

The outer iteration follows the usual augmented-Lagrangian pattern. In the general MadNCL presentation, if the residual is small enough, the multiplier update is performed in classical augmented-Lagrangian fashion; otherwise the penalty parameter is increased. For the generic NLP form, the update is written as
\[
(y_{k+1},\rho_{k+1})=
\begin{cases}
\bigl(y_k-\rho_k c(x_{k+1}),\rho_k\bigr), & \text{if } \|c(x_{k+1})\|_\infty \le \eta_k,\\
\bigl(y_k,10\rho_k\bigr), & \text{otherwise.}
\end{cases}
\]
In the MPCC/AC-SCOPF formulation the same logic appears in the relaxed variables \(r\) and \(t\), schematically as
\[
\lambda^{(n+1)} \approx \lambda^{(n)}+\rho^{(n)}r^{n+1},\qquad
\nu_0^{(n+1)} \approx \nu_0^{(n)}+\rho^{(n)}t^{n+1},
\]
with \(r\approx -c(w)\) and \(t\) measuring complementarity relaxation [2510.05885][2510.13333].

A persistent misconception is that NCL produces unconstrained augmented-Lagrangian subproblems. The AC-SCOPF paper states the opposite explicitly: NCL is “nonlinearly constrained” because it does not form completely unconstrained augmented-Lagrangian subproblems; each subproblem still has nonlinear constraints, but these constraints are relaxed by extra variables and penalized [2510.13333].

NCL also has a built-in infeasibility mechanism. In the MPCC formulation, if the original problem is infeasible, the penalty parameter diverges and the iterates converge to a stationary point of a feasibility problem that minimizes \(\|r\|^2+\|t\|^2\). This yields a “minimal violation” mode rather than requiring an ad hoc \(\ell_1\) feasibility penalty [2510.13333].

## 3. KKT structure, regularization, and degeneracy handling

The computational core of NCL is the Newton system for the primal-dual KKT equations of each subproblem. For the generic NLP version, MadNCL writes the barrier system as \(F(w,\rho_k,y_k,\mu_k)=0\) in the variables \(w=(x,r,y,z_l,z_u)\), with barrier parameter \(\mu_k\), and computes Newton directions by solving the Jacobian system of \(F\) [2510.05885].

After eliminating bound-multiplier variables, one obtains a regularized augmented KKT system whose stabilized form is
\[
K_{2r}=
\begin{bmatrix}
\hat H+\delta_k I & J^\top\\
J & -\theta_k I
\end{bmatrix},
\]
where \(\hat H\) is the barrier-regularized Hessian block, \(\delta_k>0\) is a diagonal regularization, and \(\theta_k=\hat\rho_k^{-1}\) with \(\hat\rho_k=\rho_k+\delta_k\) [2510.05885]. Eliminating the dual step gives a condensed SPD system, denoted \(K_{1s}\) in the paper, whose positive definiteness is equivalent to the desired inertia of the full KKT matrix [2510.05885].

In the AC-SCOPF MPCC formulation, the Newton system is expressed as
\[
\begin{bmatrix}
A & B^\top\\
B & -C
\end{bmatrix}
\begin{bmatrix}
\Delta w\\
\Delta y
\end{bmatrix}
=
\begin{bmatrix}
r_1\\
r_2
\end{bmatrix},
\]
where \(A\) collects Hessian and barrier terms, \(B\) is the Jacobian of the constraints, and \(C\) contains the dual regularization induced by the augmented-Lagrangian term. The decisive feature is that \(C\) contains \(\rho^{-1}I\), so the dual block is nonzero and positive definite for positive \(\rho\). The paper identifies this dual regularization as the main driver of improved conditioning [2510.13333].

The degeneracy mechanisms addressed by NCL are described explicitly in the AC-SCOPF paper. First, when strict complementarity fails, the Jacobian block \(B\) may lose rank because rows associated with complementarity pairs tend toward zero; the nonzero \(C\) block keeps the saddle-point system nonsingular. Second, bilinear complementarity terms can increase the indefiniteness of \(A\), but they do not destroy positive definiteness of the reduced Hessian near the solution [2510.13333].

The generic GPU paper states the same structural point differently: the added variables \(r\) make the constraint Jacobian \([J(x)\ I]\) full row rank regardless of degeneracy in \(J(x)\), and the quadratic penalty on \(r\) yields a positive definite dual regularization in the Schur complement. This is why NCL is described as more robust than pure IPM or SQP in degenerate settings [2510.05885].

## 4. MPCC formulation and AC-SCOPF specialization

The most detailed contemporary application of Algorithm NCL is corrective AC security-constrained optimal power flow in polar form. In that setting the AC-SCOPF is written as
\[
\min_{x,u}\ f(x_0,u_0)
\]
subject to base-case AC equations and inequalities, contingency-wise recourse equations and inequalities, and complementarity constraints
\[
0 \le G(x_k,u_k) \perp H(x_k,u_k) \ge 0,
\]
where the complementarity models two corrective mechanisms: droop/AGC clipping of active power and PV/PQ switching via reactive limits [2510.13333].

The AC-SCOPF with complementarity is cast as an MPCC in “vertical form,” and then converted into an equivalent NLP-MPCC by replacing complementarity with a bilinear inequality
\[
W_1 W_2 e \le 0,
\]
combined with nonnegativity of \(w_1,w_2\). The paper emphasizes that this formulation is degenerate because the feasible set has empty relative interior and standard constraint qualifications fail [2510.13333].

NCL addresses this by introducing two sets of relaxation variables: \(r\in\mathbb{R}^m\) for the aggregated nonlinear constraints \(c(w)\), and \(t\in\mathbb{R}^p\) for the complementarity bilinear inequalities. The inner subproblem is
\[
\min_{w,r,t}\ \phi(w)+(\lambda^{(n)})^\top r + (\nu_0^{(n)})^\top t
+ \frac{\rho^{(n)}}{2}\bigl(\|r\|^2+\|t\|^2\bigr)
\]
subject to
\[
c(w)-r=0,\qquad W_1W_2 e \le t,\qquad (w_0,w_1,w_2)\ge 0.
\]
The paper notes that \(t\) plays the role of a **Scholtes-type relaxation parameter**, but is endogenous: it is driven to zero by the augmented-Lagrangian penalty rather than chosen manually [2510.13333].

This specialization is also where NCL’s infeasibility behavior becomes operational. For contingency screening, solving the induced feasibility problem with NCL provides the scalar measure \(\|r\|^2+\|t\|^2\), which quantifies how infeasible a contingency is [2510.13333].

On the theoretical side, the AC-SCOPF paper states that under MPCC-LICQ and boundedness of \(\{\nu_0^{(n)}\}\), NCL converges to a **strongly stationary** solution of the MPCC, rather than merely a weakly stationary one [2510.13333].

## 5. Implementations, solver stacks, and GPU realization

The 2021 Julia implementation, distributed as NCL.jl, is built on the JuliaSmoothOptimizers stack. The principal abstractions are `AbstractNLPModel`, `AmplModel`, `NCLModel`, and `NCLSolve`, with solver backends provided by `NLPModelsIpopt.jl` and `NLPModelsKnitro.jl` [2101.02164]. The implementation automatically converts a general smooth constrained model into an `NCLModel`, adds the \(r\)-variables, updates \((y_k,\rho_k)\) across outer iterations, and warm-starts each NC\(_k\) subproblem. Warm-start policies are solver-specific: for IPOPT, `warm_start_init_point = yes` is activated for \(k\ge 2\), and for KNITRO barrier parameters such as `bar_initmu` are decreased as outer iterations progress [2101.02164].

MadNCL generalizes this architecture to GPUs. It uses MadNLP as the primal-dual interior-point engine for each subproblem, ExaModels for GPU-resident model and derivative evaluation, and NVIDIA cuDSS for sparse \(\mathrm{LDL}^\top\) or Cholesky factorizations with static pivoting [2510.05885]. Two KKT formulations are implemented: a stabilized indefinite system \(K_{2r}\) and a condensed SPD system \(K_{1s}\). The stabilized form is solved with sparse \(\mathrm{LDL}^\top\) and a small pivot epsilon, while the condensed form is solved by sparse Cholesky [2510.05885].

A further implementation change in MadNCL is **loop fusion**. Rather than fully solving each augmented-Lagrangian subproblem before updating multipliers or penalty parameters, MadNCL fuses outer ALM updates and inner IPM iterations into a single loop and supplements them with an **extrapolation step**. The extrapolation is accepted when the residual reduction satisfies
\[
\|F_k(w_k^+)\|_\infty \le \theta\|F_k(w_k)\|_\infty + \varepsilon_k,
\qquad
\varepsilon_k = 10\,\alpha_k^{0.2}\mu_k,
\]
which reduces the number of expensive full subproblem solves [2510.05885].

In the AC-SCOPF implementation, the GPU-oriented advantages are especially pronounced. The paper attributes the performance of MadNCL to the combination of regularized Newton systems from NCL, pivoting-free factorization via cuDSS, and GPU-based derivative evaluation via ExaModels [2510.13333].

## 6. Numerical behavior, strengths, and limitations

The numerical record reported across the three papers is consistent on two points: NCL is primarily a robustness mechanism for degeneracy and infeasibility, and more recent implementations turn that robustness into scalable GPU performance.

In the Julia CUTEst study, plain KNITRO solved 126 of 166 constrained problems, whereas NCL/KNITRO solved 147. On nonlinear least-squares problems from CUTEst, the NCL reformulation solved 119 of 127 problems, compared with 101 for KNITRO’s dedicated nonlinear least-squares mode [2101.02164]. On the tax-policy models that motivated the implementation, NCL with warm-started interior-point subsolvers was able to solve instances with extremely many nearly active nonlinear inequalities, whereas direct IPOPT attempts were reported to time out on NEOS [2101.02164].

The GPU paper extends this picture to much larger models. On the largest PGLIB OPF case `78484_epigrids`, MadNCL–\(K_{2r}\)+cuDSS converged in about 54 seconds, compared with about 354 seconds for MadNLP+MA27 on CPU, and the paper reports GPU speedups up to about \(18\times\) versus MA27 [2510.05885]. On SCOPF MPCC instances, Ipopt and MadNLP are reported to fail or become stuck in feasibility restoration, while MadNCL solves all tested instances to tolerance \(10^{-5}\) [2510.05885].

The AC-SCOPF application sharpens the scale comparison. For the ACTIVSg500 network with up to 256 contingencies, corresponding to nearly 1 million variables, MadNCL-GPU solves the AC-SCOPF in under 3 minutes, while Knitro requires several hours. The abstract states more specifically that MadNCL can solve AC-SCOPF with 500 buses and 256 contingencies fully on the GPU in less than 3 minutes, whereas Knitro takes more than 3 hours to find an equivalent solution [2510.13333]. For contingency screening with fixed base-case control, MadNCL-CPU is reported to be roughly \(10\times\) faster than Knitro for networks with more than 300 buses [2510.13333].

The principal strengths emphasized in the literature are therefore threefold. First, NCL handles difficult and degenerate problems, including infeasible cases and MPCC models with complementarity constraints. Second, the augmented-Lagrangian term regularizes the Newton systems in a way that preserves nonsingularity and controlled inertia. Third, that regularity makes sparse factorizations without dynamic pivoting feasible, which is decisive for GPU efficiency [2510.13333][2510.05885].

The limitations are also explicit. In the AC-SCOPF paper, very large and heavily degenerate problems can suffer from ill-conditioning induced mainly by the PV/PQ complementarity reformulation, leading to many inertia corrections and line-search rejections, substantially larger iteration counts, and occasional failure to converge [2510.13333]. In the generic GPU paper, the condensed system \(K_{1s}\) is described as less robust than the stabilized system \(K_{2r}\) on the largest SCOPF cases, and the `rocket` COPS instance is singled out as a case where degeneracy lies in the reduced Hessian, outside the scope of the augmented-Lagrangian regularization used there [2510.05885]. The Julia paper likewise notes that NCL is not uniformly faster than plain KNITRO on easy general problems; its advantage is concentrated on hard or degenerate instances [2101.02164].

Algorithm NCL is therefore best understood not merely as an augmented-Lagrangian variant, but as a specific reformulation strategy: by introducing explicit relaxation variables and preserving nonlinear constraints inside each subproblem, it converts difficult degenerate optimization problems into subproblems with better Jacobian rank properties and more regular KKT systems. In contemporary implementations, that structural regularity is what simultaneously supports stronger degeneracy robustness and efficient execution on modern GPU linear algebra stacks [2101.02164][2510.05885][2510.13333].

Source: https://www.emergentmind.com/topics/algorithm-ncl