Skip to content

[Codex analysis][Acados v0.5.5][4/5] Expose solver diagnostics #1092

Description

@mickaelbegon

Status

WIP — Codex-generated analysis and implementation. No pull request is open.

This is step 4 of the Acados v0.5.5 integration roadmap tracked in #1088. It builds on the solver-mode work in #1090.

Motivation

Applications such as Cocofest currently have to query the mutable Acados solver capsule directly to collect convergence information. That becomes fragile when the solver is reused: a later solve overwrites the statistics needed to understand the previous result.

Stable diagnostics are also useful for RHO and warm-start/homotopy studies: they make it possible to compare residuals, QP effort, solver status, and timing when changing a grid or interpolation strategy, instead of judging a warm start only from total solve time.

Current WIP scope

The branch attaches a detached solver_diagnostics snapshot to the returned Solution containing:

  • Acados status code, v0.5.5 status label, and success flag;
  • NLP and QP solver modes;
  • named KKT residuals (stationarity, dynamics, inequality, complementarity);
  • NLP/SQP iteration counts and QP-scaling status;
  • detailed timing fields exposed by Acados v0.5.5;
  • raw Acados statistics plus normalized QP status/iteration histories;
  • the three per-iteration QP solves used by SQP_WITH_FEASIBLE_QP;
  • unavailable-field errors without masking an otherwise usable solve.

Arrays are copied out of the Acados capsule, and residuals are read with recompute=False so diagnostics do not alter an RTI/AS-RTI linearization. Solution.copy() also preserves the solve status and deep-copies the diagnostics.

Validation

Using the Acados v0.5.5 Python interface and native libraries:

pytest tests/shard1/test_acados_interface.py -k acados_v055 -q --disable-warnings
6 passed, 28 deselected

This includes native solves with Anderson acceleration and SQP_WITH_FEASIBLE_QP, as well as synthetic checks of the solver-specific statistics layouts.

Deliberately out of scope

  • defining convergence/acceptance thresholds for Bioptim;
  • changing warm-start or grid-interpolation behavior;
  • runtime parameter updates (planned step 5);
  • opening a pull request while the analysis remains WIP.

Maintainer feedback requested later

Before turning this analysis into a PR, it would be useful to decide whether:

  1. Solution.solver_diagnostics is the right public location, or diagnostics should remain Acados-specific;
  2. exposing raw_statistics is desirable alongside normalized fields;
  3. a small cross-solver diagnostics schema would be preferable for future RHO comparisons.

This issue and its branch were produced as a Codex analysis for maintainer discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions