Solver-Consistent Surrogates for Sequential Convex Trajectory Optimization

Sequential convex programming solves hard, nonconvex trajectory problems, such as flying a robot through a cluttered space station, by repeatedly replacing the problem with a convex approximation around the current guess, solving that easier problem, and deciding whether to accept the step. Its convergence guarantee depends on one condition that is easy to overlook: the approximation must match the value and slope of the function the solver actually uses to judge progress. In trajectory optimization, practitioners usually build the approximation by linearizing the continuous-time dynamics and then discretizing. They then check feasibility and cost with a numerical integrator that may be different, more accurate, or adaptive. The approximation's slope is therefore the slope of a different function. The same failure is well documented in neural ordinary differential equations. There, gradients derived in continuous time and then discretized ("optimize-then-discretize") point in directions that do not decrease the loss actually computed, which stalls training (Discretize-Optimize vs. Optimize-Discretize for Time-Series Regression and Continuous Normalizing Flows).

We propose to build every convex approximation inside sequential convex programming from exact derivatives of the specific integrator used to evaluate the merit function. That integrator can be high-order, implicit, structure-preserving, or adaptive. The derivatives come from discrete adjoints, meaning backpropagation through the solver's actual arithmetic steps, and they are assembled matrix-free, so large systems never form full Jacobians. The claim is concrete and falsifiable. Solvers with mismatched approximations should hit a stationarity floor and repeatedly reject steps at a level that scales with the integrator's truncation error. Solver-consistent approximations should remove that floor. For systems with many states but few constraints, adjoint products should also make each subproblem cheaper than forward-sensitivity linearization.

Core Claim

Let the discrete forward map be $u_{n+1} = \Phi(u_n, \theta, \Delta t_n)$. Here $u_n$ is the state, $\theta$ the controls or design variables, and $\Delta t_n$ the step size chosen by the integrator's controller. The objective and constraints are evaluated as $F(\theta) = J(u_N(\theta), \theta)$ and $G_i(\theta) \le 0$, where $u_N$ is the final state. Sequential convex programming at iterate $\theta_k$ uses a surrogate $\tilde F(\cdot;\theta_k)$ and accepts or rejects steps using the ratio $\rho_k = [F(\theta_k) - F(\theta_{k+1})]/[\tilde F(\theta_k;\theta_k) - \tilde F(\theta_{k+1};\theta_k)]$. Suppose the surrogate is built from a different discretization, so that $\nabla \tilde F(\theta_k;\theta_k) = \nabla F(\theta_k) + e_k$. Then as the step length $s$ shrinks, the predicted decrease is set by $\nabla F + e_k$, while the true decrease is set by $\nabla F$ alone. This gives

$$ \rho_k \to \frac{\langle \nabla F(\theta_k), d_k\rangle}{\langle \nabla F(\theta_k) + e_k, d_k\rangle} \quad \text{as } s \to 0, $$

where $d_k$ is the step direction. The ratio collapses once $\|\nabla F\|$ falls to the order of $\|e_k\|$. The trust region then shrinks until the solver stops, with a stationarity residual of order $\|e_k\| = O(h^p)$. We expect the $O(h^p)$ form because the gap between two consistent order-$p$ discretizations of the same dynamics is bounded by their truncation errors. Discrete adjoints make $e_k$ zero to floating-point precision for the evaluating integrator. This includes its step-size heuristics, which Opening the Blackbox showed can be differentiated through.

Relation to Prior Work

Three sequential convex programming papers motivate this work. GuSTO proves convergence to a Pontryagin extremal in continuous time, a guarantee independent of discretization. It then discretizes the linearized subproblems heuristically and uses the subproblems' dual variables as approximate continuous adjoints to warm-start shooting. Embedded SCP on manifolds does the same on curved spaces, again with continuous geometric adjoints. Neither analyzes whether the surrogate bounds survive discretization. We keep their trust-region machinery but move the consistency requirement to the discrete level. APCSCP is the closest method: it replaces full Jacobians with adjoint derivatives inside predictor-corrector sequential convex programming and runs about six times faster on a 259-state hydro plant. Its adjoints serve to speed up parametric tracking and assume smooth, strongly regular problems. It does not address whether they are consistent with the integrator. We differ by requiring exact discrete consistency with an arbitrary, including adaptive, integrator, and by testing the predicted stationarity floor directly.

The discrete adjoint literature supplies the method. PETSc TSAdjoint gives exact vector-Jacobian and Hessian-vector products with checkpointing, and reports adjoint-to-forward time ratios below one for implicit integrators. DAVM and the variational-integrator discrete adjoint show exact gradients for flexible multibody and beam systems. Both drive generic optimizers, and DAVM itself notes vulnerability to local minima. We place their gradients inside a trust-region convex loop. One result constrains the design: the beam paper found that Kelvin-Voigt damping was necessary to keep high-frequency oscillations out of the adjoint. We keep that damping rather than assume consistency alone suffices. CRISP shows that sequential convex programming with an $l_1$ merit function is robust from all-zero starts on contact problems. We use it as evidence that the outer loop is worth keeping, not as a target, because contact complementarity breaks the smoothness that exact discrete gradients rely on.

Research Program

The solver takes any integrator, fixed-step Runge-Kutta, implicit, variational, or adaptive, and treats its step sequence as the dynamics. Each convex subproblem is built in one of two ways. In the first, the full-transcription variant, it linearizes each discrete step map exactly, which suits moderate state dimensions and path constraints. In the second, the condensed matrix-free variant, the states are eliminated by the integrator itself. The Jacobian of the $m$ constraint functions with respect to the controls $\theta$ is then assembled from $m$ discrete adjoint solves, rather than from forward sensitivities whose cost grows with state dimension. An optional quadratic model uses Hessian-vector products along a small subspace of recent steps. The trust region and $l_1$ merit function follow GuSTO and CRISP. Memory is controlled by checkpointing.

For adaptive integrators, the step-size choices at $\theta_k$ are frozen when the surrogate is built, and $\rho_k$ is evaluated with re-adapted steps. Theory and experiment will quantify the resulting kink-induced mismatch against the continuous-linearization mismatch. The analysis will derive the stationarity floor above for mismatched surrogates. It will also give conditions, piecewise smoothness of the step controller and a bounded number of step rejections within the trust region, under which solver-consistent surrogates recover standard stationarity guarantees for the discrete problem.

Baselines

The naive reference point is the conventional pipeline: linearize continuous dynamics, discretize the linear subproblem with zero-order hold, and check feasibility and cost with an accurate integrator. This is a faithful reimplementation of GuSTO's discretization, since no public code is listed in our sources. Beating it means a lower final stationarity residual and fewer rejected steps at equal integrator tolerance. It also means that residual stays flat, rather than tracking $h^p$, as tolerance varies. GuSTO reports a 97% success rate over 100 cluttered 12-dimensional Astrobee trials (GuSTO), and our reimplementation must reproduce roughly this before any comparison counts.

The strongest competitor, and the key ablation, is consistent-but-cheap direct sequential convex programming. Surrogate and evaluation use the same coarse fixed-step integrator, differentiated exactly. This is what careful direct-transcription solvers already do, and it removes the mismatch without adjoints. It is run with the same step count as our method's average and the same trust-region settings. We beat it only if its solutions, re-simulated at tolerance $10^{-10}$, violate constraints or cost more, while ours do not at comparable wall time.

The third baseline is IPOPT on direct collocation with automatic differentiation, given the same initializations and a tuned barrier strategy. On the hydro plant, APCSCP's roughly sixfold speedup over PCSCP (APCSCP) sets the timing bar for the condensed variant; no reported absolute runtime or tracking error was found on Lacuna for this benchmark. On the suspension chassis, DAVM reduced displacement from 0.0638 to 9.575e-05 under all 16 stress constraints (DAVM), and our method should reach at least that with fewer outer iterations. A fourth ablation swaps our discrete adjoint products for continuous adjoint products inside the identical matrix-free loop, which isolates consistency from matrix-freeness.

Why not just…?

Why not just use the same fixed-step integrator for both surrogate and evaluation? This is the most serious threat, and if it matched us we would narrow the contribution to "adjoints for adaptive and large-scale integrators." The argument against it is that a coarse fixed step is optimized and certified only against itself. Its trajectories can be infeasible under accurate physics, and the variational-integrator results show that low-order steps degrade energy and momentum over long horizons (Schubert et al.). The re-simulation experiment below settles it directly.

Why not just hand the discretized problem to IPOPT or SNOPT with automatic differentiation? On contact tasks, those solvers failed from naive starts where sequential convex programming succeeded 100% of the time (CRISP). On smooth, well-initialized problems, however, IPOPT may be fully competitive. We therefore report results split by initialization quality rather than claim a uniform win.

Why not just use continuous adjoints to save memory? On BSDS300, optimize-then-discretize took nine days against under 14 hours for discretize-then-optimize, and its gradients drifted (Onken and Ruthotto). Checkpointing bounds the memory cost of discrete adjoints (PETSc TSAdjoint). The continuous-adjoint ablation measures whether drift actually produces the predicted floor inside sequential convex programming.

Why not just add penalties and run gradient descent on discrete adjoint gradients? Penalized sequential convex programming reached a true cost of 1.0 against 0.105 with hard constraints on the 7-degree-of-freedom manipulator (E-SCP). We include penalized Adam as a sanity baseline on the beam swing-up.

Proposed Experiments

The first experiment tests the mechanism directly. On the Dubins car, the 12-dimensional Astrobee in the JEM model, and the damped geometrically exact beam swing-up, we sweep integrator tolerance from $10^{-3}$ to $10^{-9}$. At each tolerance we record the final KKT residual and the number of trust-region rejections for mismatched, consistent-coarse, and solver-consistent surrogates. The prediction is that the mismatched residual tracks $h^p$ while ours tracks the subproblem solver tolerance. If the mismatched residual is already below the solver tolerance, the mechanism is irrelevant in practice, and we will report that.

The second experiment tests practical value. Every returned trajectory is re-simulated at tolerance $10^{-10}$, and we report constraint violation, true cost, and success rate over 100 randomized Astrobee scenes, alongside wall time and peak memory. The third experiment tests scale. The condensed variant runs on the 259-state hydro plant and the 60-variable suspension chassis against forward-sensitivity linearization, APCSCP-style continuous adjoints, and IPOPT, and we plot time per iteration against state dimension. The work fails if consistent-coarse sequential convex programming matches our re-simulated feasibility at lower cost in both regimes. It succeeds if solver-consistent surrogates are the only variant that is simultaneously stationary, feasible under accurate physics, and tractable at hundreds of states.