Sparse NLP Structure and Time Normalization
Direct collocation produces nonlinear programs that are often large but sparse. This structure is one of the main reasons collocation methods are computationally practical.
This section develops:
local dependence of collocation constraints;
constraint-Jacobian sparsity;
banded structure;
nonzero counting;
sparsity scaling with mesh refinement;
implications for NLP solvers;
time normalization to a fixed interval;
transformation of dynamics and cost;
free initial and final times; and
extensions to large and multi-state systems.
Review of the Euler NLP¶
Consider the decision vector
The defect equations are
for
The endpoint constraints are
Local Dependence¶
Each defect depends only on:
It does not depend on distant variables such as:
This local dependence creates sparsity.
Constraint Jacobian¶
Define
The constraint Jacobian is
Its dimensions are
Derivatives of One Defect¶
For
the nonzero derivatives are
All other partial derivatives of are zero.
Sparsity Pattern¶
The structure is schematically:
Only a narrow band of entries is nonzero.
Counting Nonzero Entries¶
Each defect contributes three nonzeros.
There are defects, so:
nonzeros arise from the dynamics.
The two endpoint constraints contribute two more.
Therefore,
Jacobian Density¶
The total number of entries is
The density is
As
Thus, the problem becomes increasingly sparse as the mesh is refined.
Why Sparse Structure Matters¶
A dense treatment stores and processes all entries.
A sparse treatment stores and processes only nonzero entries.
This affects:
memory usage;
Jacobian assembly;
linear-system solution;
factorization cost;
scalability;
parallelization.
For large trajectory-optimization problems, sparse linear algebra is essential.
Sparse NLP Solvers¶
Modern sparse NLP solvers exploit derivative structure.
Examples include:
IPOPT;
SNOPT;
KNITRO;
WORHP;
filterSQP-type solvers;
sparse interior-point and SQP methods.
MATLAB’s fmincon may be useful for small instructional problems, but large collocation problems benefit from solvers designed explicitly for sparse NLPs.
Why Collocation Naturally Produces Sparsity¶
A collocation equation on interval depends only on variables in or near that interval.
Typical local dependencies include:
Therefore, distant nodes do not interact directly in the Jacobian.
This remains true for many methods:
Euler forward;
Euler backward;
trapezoidal collocation;
Hermite–Simpson;
Runge–Kutta collocation;
finite-element transcription;
multiple shooting.
Multiple States and Controls¶
For
each defect block has dimension .
A defect typically depends on:
components of ;
components of ;
components of .
The Jacobian becomes block sparse and block banded.
Time Normalization¶
Instead of discretizing directly on
it is convenient to map the domain to
Define
The inverse transformation is
Derivation of the Mapping¶
Starting from
subtract :
Divide by :
Multiply by 2 and subtract 1:
Transformation of the Dynamics¶
The original dynamics are
By the chain rule,
From the inverse map,
Therefore,
Transformation of the Cost¶
For
use
Then
Free Initial and Final Times¶
If or is free, they become NLP decision variables.
The normalized computational domain remains fixed:
However, the duration
appears explicitly in:
the transformed dynamics;
the transformed cost;
time-dependent path constraints;
endpoint conditions.
Why Normalize Time¶
Time normalization provides:
a fixed computational domain;
simpler mesh generation;
easier handling of free final time;
direct compatibility with orthogonal polynomials;
a natural foundation for pseudospectral methods;
improved software modularity.
Normalized Euler Defects¶
Let
Define
Euler forward in normalized time gives
Thus,
Normalized Quadrature¶
A left-rectangle approximation becomes
For a uniform normalized mesh,
Sparsity with Free Final Time¶
When is a decision variable, every defect depends on through the factor
This introduces one additional dense column in the Jacobian.
However, the rest of the Jacobian remains sparse.
Thus, free-time problems retain strong sparse structure.
Finite Versus Infinite Horizons¶
The affine map above applies to finite intervals.
An infinite horizon,
requires a nonlinear transformation, for example:
Such mappings require special treatment because:
the derivative scaling becomes singular near the mapped endpoint;
quadrature weights may become extreme;
asymptotic behavior must be represented accurately;
convergence analysis is more delicate.
Solver-Oriented Implementation Workflow¶
Normalize time.
Select the mesh.
Define the decision vector.
Define the discretized objective.
Define defect constraints.
Define endpoint and path constraints.
Provide sparse Jacobian information.
Provide variable and constraint bounds.
Solve the NLP.
Verify convergence under mesh refinement.
Derivative Information¶
NLP solvers may use:
finite differences;
analytic derivatives;
automatic differentiation;
complex-step derivatives.
For large collocation problems, exact or automatic sparse derivatives are usually preferable.
Common Errors¶
Treating the Jacobian as dense.
Counting variables instead of in the scalar Euler example.
Forgetting endpoint-constraint nonzeros.
Assuming sparsity disappears for nonlinear dynamics.
Omitting the factor after time normalization.
Transforming the dynamics but not the cost.
Forgetting that depends on both endpoint times.
Using a finite-interval affine map for an infinite-horizon problem.
Supplying inconsistent derivative sparsity to the solver.
Failing to verify mesh convergence.
Summary¶
Collocation constraints depend locally on neighboring variables.
This produces sparse, banded Jacobians.
The scalar Euler example has Jacobian nonzeros.
Jacobian density approaches zero as the mesh is refined.
Sparse NLP solvers exploit this structure.
Time normalization maps arbitrary finite intervals to .
The dynamics scale by .
The cost scales by the same factor.
Free endpoint times become NLP decision variables.
Normalization is foundational for advanced collocation and pseudospectral methods.