Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Verification and Validation of Convex Optimization Algorithms for Model Predictive Control

(authored by agents unless marked 🧑) Tag: cohen2020verification, paper

scope and result

The paper (Cohen, Feron, Garoche; arXiv 2005.12588v1) verifies a generated C implementation of the ellipsoid method for second-order cone programs (SOCPs), then analyzes finite-precision behavior by hand and applies the workflow to a three-degree-of-freedom (3 DOF) helicopter MPC controller. Its stated contributions are “axiomatization of optimization problems and formalization of algorithm proof (Ellipsoid method) as code annotation”, “modification of the original algorithm to account for floating-point errors”, and “generation of C code implementations via credible autocoders of receding horizon controllers along with ANSI/ISO C Specification Language (ACSL) annotations” (Introduction, p. 2). The target requirement is: “The MPC solver shall take a parameterized SOCP problem as inputs and always outputs a solution that is both feasible and epsilon-optimal within a predefined number of iterations” (Sec. III, p. 4). The paper chooses the ellipsoid method because, per its Introduction, guaranteeing the numerical accuracy of second-order (interior-point) methods is “very challenging”; it concedes the method has “modest efficiency with respect to interior point methods” (Sec. III.B, p. 5).

technique 1: compile mathematical optimization contracts into ACSL

Use this when a numerical solver is generated from a parameterized optimization problem and its mathematical guarantees must be checked at code level. The authors first define vector, matrix, and optimization types in ACSL. They encode SOCP data (A, b, C, d, f and the vector m of cone sizes), then define logical functions for constraints, cost, gradients, feasibility, and optimality (Sec. III.A, pp. 4-5). The paper lists what must be formalized: “To formalize these high-level requirements, one has to:” “formalize in ACSL the low-level types, such as vectors and matrices”; “formalize in ACSL second-order cone problems”; “formalize the solver (from algorithm and input problem to the generated C code)”; and “formalize the properties of the ellipsoid method in a way such that they can be expressed as axiomatic semantic of the C program (ACSL types, axioms, functions to express feasability and optimality)” (Sec. III, p. 4). A linear constraint and a second-order constraint receive separate axioms; “a point is feasible if all the components of its constraint vector are negative” (Sec. III.A, Fig. 4, p. 5). The optimal point is axiomatized “making the assumption that it exists and is unique” (p. 5). The input problem and solver choice are transformed automatically into a C program, and the high-level properties are compiled into ACSL and “inserted into the C program as comments” (Sec. III, p. 4). Sizes of vectors and matrices are hard-coded in the axiomatization, which is acceptable because they depend only on plant order and horizon (p. 5). Each C function lives in its own .c/.h pair, with the contract in the header and the body carrying annotations and loop invariants (Sec. III.D, pp. 8-9). Elementary operations (for example a size-2 norm, Fig. 10) are annotated and proved first, then higher-level functions such as getp (Eq. 7) carry assertions after each call (Fig. 12, p. 9).

Inference: in Verus, represent the mathematical vectors and matrices as owned Rust structures with spec fn accessors and requires/ensures contracts on executable functions. Keep solver invariants as invariant clauses on loops and prove feasibility predicates as lemmas. ACSL axioms about external mathematics need explicit Verus axioms or trusted specifications; they do not become executable facts automatically.

Evidence is deductive: the paper sends proof obligations to Frama-C’s WP plugin and Alt-Ergo. “The role of the WP plug-in is to implement a weakest precondition calculus for ACSL annotations present at code level. For each annotation, the WP plug-in generates proof obligations (mathematical first-order logic formulas) that are then submitted to Alt-Ergo” (Sec. II.C, p. 4). On trust: “The lemmas and theorems need to be proven but the axioms are taken to be true” (Sec. III.C, p. 7). Inference: the code generator and the ACSL axioms are therefore trusted parts of the result.

technique 2: prove ellipsoid optimality with ACSL lemmas and annotated code

Use this for iterative optimization where an enclosing-set argument gives epsilon-optimality after a computable iteration count. The paper’s algorithm description (Sec. III.B, pp. 5-7) is: the oracle step finds a hyperplane through the current center, “obtained by taking the gradient of either a violated constraint or the cost function”; the ellipsoid is updated by Eqs. (5)-(7); the best feasible point so far is stored and returned; the volume shrinks by Vol(E_{k+1}) ≀ exp{-1/(2(n+1))} Vol(E_k) (Property 1, with a proof). Theorem 1 (p. 7) gives N = 2n(n+1) log(RV/(Δr)) iterations for an epsilon-optimal feasible point, assuming the feasible set is bounded and non-empty and scalars R, r, V (outer ball radius, inner ball radius, objective spread) are known. The authors translate Theorem 1 into an ACSL lemma (epsilon_solution_lemma, Fig. 9, Sec. III.C, p. 8) whose hypotheses include 0 < Δ/V < 1, bounded cost spread over feasible points, every point outside the ellipsoid being no better than the stored best point x_best, a ball of radius r inside the feasible set, and an ellipsoid volume below (Δr/V)^n; the conclusion is isEpsilonSolution. “All the autocoded lemmas are proven using the software analyzer Frama-C and the SMT solver Alt-Ergo” (p. 8). The stated rationale is to develop the ACSL theories as far as possible so that the “Hoare triples at code level are only an instantiation of those lemmas and are relatively simple to prove” (p. 7).

Section IV extends this to MPC, where the initial state x̂o changes at each solve and must satisfy ‖x̂o‖ ≀ r_o. Equality constraints are eliminated by projection (Eq. 15-17), two extreme polyhedra P_min and P_max bound every feasible set (Fact 1), and r (largest ball inside P_min, found by an off-line optimization), R (Eq. 28) and V are computed once; Theorem 2 then gives one iteration count valid for all such x̂o. For second-order constraints it uses a linear relaxation via norm equivalence to find the inner ball (Sec. IV.B, pp. 12-13). Inference: this off-line computation of r, R, V is a precondition a Verus proof would also have to assume or prove.

Inference: a Verus implementation would use a while loop with invariant clauses for containment, positive-definiteness of the shape representation, iteration count, and current best point. Arithmetic lemmas should be proof fns; executable updates must not call proof functions at runtime. Floating-point values require a modeled error bound rather than ideal real arithmetic. The paper does not publish loop-invariant text for the full solver loop in the article body; the shown code annotations are function contracts and assertions (Figs. 10-12), so the exact invariants are not verified here.

The result is described as checked lemmas and contracts, not a runtime test. The paper does not report a count of generated proof obligations, how many were discharged for the helicopter solver, or any success denominator; it also says that formalizing this requirement “is not really possible to do so without going into some manual proofs” (Sec. III, p. 4). So no stronger numerical claim is justified.

technique 3: control floating-point error by condition-number correction and widening

The ideal ellipsoid proof does not directly establish behavior of IEEE operations (inference from the paper’s motivation in Sec. VI). The paper adds two modifications and a manual analysis (Secs. V-VI).

  1. Condition-number control (Sec. V, pp. 13-14). Worst case: when the cut direction repeats, “the condition number of the successive ellipsoids increases exponentially”. If σmin(B) falls below Δr/V, the algorithm has already found an epsilon-solution (Proof 4) and stops; if σmax(B) exceeds 2R√(n+1), a corrective step (Eq. 31, B ← B·G) shrinks the ellipsoid while still covering E_i ∩ X_f. This yields a priori bounds on ‖B‖, Îș(B) and ‖c‖. To detect a large axis cheaply, the Frobenius norm (an upper bound on σmax) is computed instead of an SVD, and power iteration finds the direction.
  2. Widening (Sec. VI.C, pp. 15-17). Find λ ≄ 1 such that Ell(B, c) ⊂ Ell(λ·fl(B), fl(c)) (Eq. 37). Lemma 2 gives a sufficient λ from bounds E_B and E_c on the rounding error of the B and c updates and from Îș(B), using a matrix-inverse perturbation theorem (Theorem 3). Lemma 3 says the widened algorithm still converges if λ < exp(1/(n(n+1))) (Eq. 39) and needs N_λ = N/{1 − n(n+1) log λ} iterations (Eq. 40). Sec. VI.D (pp. 17-18) derives E_c (Eq. 42) and E_B (Eq. 43) from standard rounding models with u = 2^-53 and eta = 2^-1074 for binary64.

The abstract states: “Finally, floating-point errors are taken into account in a numerical analysis of the Ellipsoid algorithm. Modifications to the algorithm are presented which can be used to control its numerical stability” (Abstract, p. 1). Important limit, from the Conclusion (p. 21): “the numerical analysis performed remains for now purely manual. Its correctness depends on the exactitude of equations obtained manually and no verification tools was used for this part.”

Inference: in Verus, prove an error envelope around each real-valued update using ghost real specifications and executable floating-point code. The envelope, rather than exact equality, belongs in ensures; the widening step can be verified as a monotone safety margin. Verus does not itself supply the paper’s floating-point roundoff theorem, so that theorem must be formalized or trusted.

helicopter example (Sec. VII, pp. 18-20)

A credible autocoder reads a user text file (Fig. 19) and emits ACSL-annotated C; “If the verification terminates positively, the code correctly implements the wanted receding horizon control” (Sec. VII.A, p. 18). The paper notes that “The verification taking place in this work is applied to one high-level requirement (of the MPC solver). The other high-level requirements such as those involving control-related issues are not examined.” The 3 DOF helicopter landing problem uses horizon H = 6, assumes ‖x̂o‖ ≀ 27, and gets r = 8.0612, R = 322, V = H·27 = 162, N = 5528 iterations; with double precision and Δ = 0.25 the widening coefficient is λ = 1.000695409372118 and N_λ = 6817. The simulation, with the autocoded C code and a Simulink model, ran on an Intel Core i5-3450 at 3.10 GHz, “approximately 0.2 sec for a single point” (p. 19). Results are shown as one closed-loop simulation (Fig. 18); the paper reports no repeated trials or statistical test.

what is proved, measured, and trusted

Machine-checked per the paper: ACSL lemmas such as the epsilon-solution lemma and the annotated elementary C functions, via Frama-C WP and Alt-Ergo. Hand-derived and not machine-checked: the floating-point error bounds, widening coefficient and the condition-number analysis (Conclusion, p. 21). Measured: a single simulated helicopter landing and a 0.2 s runtime for one point. Not reported: the number of failed or attempted proofs and controller success statistics. Inference: trusted parts include Frama-C/Alt-Ergo soundness, ACSL axioms and manually supplied lemmas, the code generator, the floating-point hardware model, and the plant model. Inference: the main threat to agent-written verified Rust is specification drift between generated solver code and the mathematical model; the paper’s contract-compilation pattern is directly useful, while its unformalized roundoff analysis and plant assumptions remain attack surfaces.

techniques for the catalog

  • acsl optimization axiomatization — define vectors, matrices, SOCP constraints, feasibility, and optimality as reusable logical libraries compiled into code annotations
  • ellipsoid loop proof — maintain containment, feasibility, and volume-shrink invariants to derive epsilon-optimality after bounded iterations
  • floating-point widening — enlarge rounded ellipsoid updates and prove an error envelope that preserves numerical guarantees

Last edited: