Example and Implementation Workflow
Mass–spring–damper direct transcription¶
Consider
with plant decisions , state , and
Use
with bounds on , , , and .
The decision vector is
Trapezoidal defects are
The second is nonlinear because plant decisions multiply state variables. Use trapezoidal objective quadrature, node bounds, and dense between-node checks.
Note the structure this creates for a nested CCD architecture: for any fixed plant design , the dynamics are linear and the objective is quadratic in the remaining state and control variables, so the inner control-design transcription is a linear-quadratic dynamic-optimization problem whose sparse Hessian and defect Jacobian can be assembled directly from constant matrices rather than by finite-differencing or automatic differentiation at every inner solve. Only the outer sweep over reintroduces nonlinearity. Recognizing this fixed-plant/variable-control structure is often what makes repeated inner-loop transcription affordable inside a nested plant search.
A credible study uses at least three meshes, design and objective convergence, dense constraint checks, independent simulation, derivative verification, and multiple initial guesses.
Numerical workflow¶
The loop from refinement back to formulation and method selection is intentional.
Formulate the continuous problem.
Scale variables, objective terms, and residuals.
Select shooting, multiple shooting, or transcription.
Choose the mesh, polynomial order, control interpolation, and quadrature.
Assemble sparse functions and verified derivatives.
Solve and inspect feasibility, stationarity, and warnings.
Refine and warm start.
Verify with independent simulation and dense constraint checks.
Test nonconvexity using multiple starts and continuation.
Report method, mesh, scaling, solver, tolerances, derivatives, initialization, convergence, residuals, and verification.
Method selection¶
| Method | Best suited for | Main strength | Main limitation |
|---|---|---|---|
| Direct shooting | Stable systems, short horizons | Simple simulator connection | Long-horizon conditioning |
| Multiple shooting | Unstable systems, terminal constraints | Short sensitivity propagation | Added states and continuity equations |
| Local collocation | General nonlinear path-constrained CCD | Sparse and locally refinable | Large NLP and trajectory initialization |
| Pseudospectral | Smooth high-accuracy trajectories | Rapid smooth convergence | Awkward near discontinuities |
| Indirect | Known active sets and theoretical analysis | High accuracy and costates | Difficult initialization and constraints |