Skip to content

Add MadNLP solver support through CasADi #1083

Description

@mickaelbegon

Disclosure: This issue text and technical analysis were prepared by OpenAI Codex from the implementation and benchmark results on the linked branch, and reviewed by the branch author.

Motivation

Add MadNLP as an optional nonlinear programming solver in Bioptim through CasADi’s nlpsol interface.

MadNLP may be useful for large optimal-control problems and biomechanical problems where exact Hessian and constraint-Jacobian evaluations are expensive.

Reference implementation

A working implementation is available on this branch:

Proposed scope

  • Add Solver.MADNLP().
  • Expose convergence tolerance, constraint tolerance, maximum iterations, verbosity, and advanced MadNLP options.
  • Pass primal and dual warm-start values through the standard CasADi inputs.
  • Normalize MadNLP status, feasibility, iteration count, and timing information in Solution.
  • Keep MadNLP optional so Bioptim remains importable when the plugin is unavailable.
  • Add unit and integration tests.
  • Document the Linux installation procedure.
  • Add reproducible GitHub Actions tests and solver benchmarks.

Current validation

The reference branch contains a Linux benchmark comparing MadNLP, IPOPT, FATROP, and ACADOS on nine problem sizes.

Notable hot-run results include:

  • 500-interval pendulum: MadNLP 33.430 s, IPOPT 40.398 s.
  • Hessian-heavy muscle-fatigue problem: MadNLP 17.397 s, IPOPT 23.002 s.
  • On the muscle-fatigue problem, MadNLP uses 57 iterations versus 67 for IPOPT.

Costs and constraint violations are reported in the benchmark README to verify solution equivalence.

Installation considerations

The main difficulty is providing an ABI-compatible combination of:

  • CasADi with the MadNLP plugin;
  • the MadNLP C/Julia runtime;
  • RBDL-CasADi and biorbd.

The reference branch includes a reproducible Ubuntu workflow that installs the official CasADi wheel, compiles RBDL-CasADi and biorbd against the same ABI, verifies the MadNLP runtime checksum, and runs the integration tests.

Known limitations

  • Online optimization callbacks are not currently supported.
  • Bioptim’s c_compile path is disabled for MadNLP.
  • The free-time benchmark currently fails in MadNLP.
  • The contact-inequality case returns a nearly equivalent objective but does not meet the benchmark feasibility threshold.

Would the maintainers be interested in turning this reference branch into a pull request?

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