Source-linked AI summary
acados: a modular open-source framework for fast embedded optimal control
Robin Verschueren, Gianluca Frison, Dimitris Kouzoupis, Jonathan Frey, Niels van Duijkeren, Andrea Zanelli, Branimir Novoselnik, Thivaharan Albin, Rien Quirynen, Moritz Diehl
TL;DR
Embedded optimal-control software must balance flexibility, maintainability, memory use, and speed, while many existing approaches constrain implementations through code generation or tight coupling. The paper presents acados, a modular framework combining interchangeable algorithms with high-performance linear algebra, and reports embedded millisecond-range performance and speed relative to other packages.
Problem
Embedded optimal-control software faces a trade-off among flexibility, memory usage, speed, and maintainability, while automatic code generation can fix problem and algorithm choices.
Method
acados combines modular embedded optimal-control algorithms with BLASFEO linear algebra, Python and Matlab interfaces, CasADi compatibility, and structure-exploiting optimization methods.
Results
The software is embeddable, achieving millisecond-range computation times for a non-trivial NMPC problem, and is fast compared with other embedded optimization packages.
Takeaways & Limitations
acados provides a flexible, maintainable, permissively licensed open-source framework for developing and deploying embedded optimal-control algorithms.
Takeaways & Limitations
Globalization strategies such as line search and trust regions are outside the paper’s scope because real-time runtime bounds cannot generally be established for them.
Abstract
from arXiv · showhide
This paper presents the acados software package, a collection of solvers for fast embedded optimization intended for fast embedded applications. Its interfaces to higher-level languages make it useful for quickly designing an optimization-based control algorithm by putting together different algorithmic components that can be readily connected and interchanged. Since the core of acados is written on top of a high-performance linear algebra library, we do not sacrifice computational performance. Thus, we aim to provide both flexibility and performance through modularity, without the need to rely on automatic code generation, which facilitates maintainability and extensibility. The main features of acados are: efficient optimal control algorithms targeting embedded devices implemented in C, linear algebra based on the high-performance BLASFEO library, user-friendly interfaces to Matlab and Python, and compatibility with the modeling language of CasADi. acados is free and open-source software released under the permissive BSD 2-Clause license.
1 Introduction
acados is introduced as a modular, open-source software package for embedded optimal control that targets the trade-off between flexibility, maintainability, memory usage, and speed. It combines efficient C algorithms, high-performance linear algebra, accessible interfaces, and CasADi compatibility for deployment across CPU architectures.
- Embedded optimal control computes decisions to control dynamic systems as their states change, including in robotics, autonomous driving, and drones.
- The central software-design challenge is balancing flexibility, memory usage, and execution speed without sacrificing maintainability or extensibility.Automatic code generation can fix problem sizes and algorithm choices, while tightly coupled implementations can become difficult to understand, maintain, and extend.
- acados addresses this challenge through a modular architecture that allows solvers, routines, and libraries to be interchanged.Its design avoids unnecessary coupling and supports rapid prototyping of solution algorithms.
- The package provides efficient C-based optimal control algorithms, BLASFEO linear algebra, Python and Matlab interfaces, CasADi compatibility, and deployment across embedded devices.acados has been shown to work with x86, x86 64, ARMv7A, ARMv8A, and PowerPC CPU architectures.
- acados is publicly available as free and open-source software under a permissive license.
2 Algorithmic ingredients for embedded nonlinear optimal control
This section formulates nonlinear optimal-control problems and describes the algorithmic components acados uses to solve them efficiently in embedded settings. The framework supports multiple-shooting discretization, flexible costs and constraints, SQP-based methods, Hessian regularization, and structure-exploiting QP solvers.
- Problem formulation: acados discretizes nonlinear optimal-control problems with multiple shooting, using discrete states, algebraic variables, piecewise-constant controls, and simulated interval transitions.Multiple shooting can provide better convergence behavior than single shooting.
- Problem formulation: The framework supports broader problem classes than the basic OCP, including moving-horizon estimation, slack-variable constraint relaxation, equality constraints, and nonlinear optimal-control structures.
- Costs and constraints: acados exploits structured least-squares and general nonlinear costs, along with bounds, linear constraints, and nonlinear constraints.Slack variables support soft constraints and potentially asymmetric piecewise-quadratic costs.
- SQP methods: Its embedded SQP workflow includes dynamics integration, sensitivity generation, Hessian approximation, and an efficient QP solver.The resulting QP step updates primal and dual iterates during successive SQP iterations.
- SQP methods: Globalization strategies such as line search and trust regions are outside the paper’s scope because real-time runtime bounds cannot generally be established for them.The authors state that initializations are typically close to the exact solution and globalization is usually unnecessary in that setting.
- Structure-exploiting QP solvers: acados includes an efficient Hessian convexification method whose numerical example shows superior convergence behavior relative to mirror and project regularization.
- Structure-exploiting QP solvers: Partial condensing retains some state variables while eliminating others, providing a tunable trade-off between horizon length and the number of optimization variables.Full condensing eliminates state variables to form a smaller QP, with quadratic complexity in the horizon length.
3 Algorithm implementations in acados
acados implements embedded optimal-control algorithms using modular components, specialized numerical libraries, and interfaces for nonlinear modeling and simulation. Its design combines performance-oriented computation with interchangeable solvers and integrators.
- 3.1 Linear algebra: BLASFEO: BLASFEO targets small dense matrices with architecture-specific kernels and cache-aware panel-major storage for embedded optimization.Its routines include optimized matrix multiplication, symmetric rank-k updates, and Cholesky factorizations.
- 3.1 Linear algebra: BLASFEO: Up to 10ˆ speedup is reported for some matrix sizes over code-generated linear algebra kernels, while BLASFEO also outperforms optimized BLAS up to about 300 × 300.The comparison excludes trivially small matrices for the code-generated-kernel result.
- 3.2 Quadratic programming: HPIPM supplies dense, OCP, and tree-structured OCP QP formulations, soft-constraint handling, condensing routines, and Mehrotra-type primal-dual interior-point solvers.acados also interfaces alternative QP solvers including HPMPC, qpDUNES, qpOASES, and OSQP.
- 3.3 Modeling and simulation: acados supports CasADi for graph-based modeling and differentiation, alongside explicit or implicit Runge-Kutta integrators with forward, adjoint, and second-order sensitivities.The interfaces can also accommodate hand-written or code-generated C dynamic models.
- 3.4 Numerical simulation: Lifted collocation and GNSF-IRK provide structure-exploiting integration, while integrators may vary across stages in dimensions, step lengths, and schemes.GNSF-IRK exploits linear dependencies and can handle index-1 differential-algebraic equations.
- 3.5 SQP-type methods: For nonlinear programming, acados offers full-step SQP, multiple Hessian approximations, user-defined Hessians, and a specialized real-time iteration routine for online NMPC.SCQP and the described convexification method are identified as novel features relative to other NMPC software packages.
4 The acados software package
The acados package combines a C core with modular solver components, common interfaces, abstraction plans, and higher-level Python and Matlab workflows. This architecture supports solver interchange, maintainable development, and deployment of generated high-performance embedded projects.
- 4 The acados software package: The C core exposes efficient and flexible modular functionality to Python and Matlab interfaces designed for user-friendly optimal-control development.The interfaces build domain-specific languages on top of the acados C interface.
- 4.1 The acados core library: Each algorithmic component is modeled as a separate module, with modules usable independently or combined within higher-level solvers.The package includes modules for integration, condensing, QP solving, and function evaluation.
- 4.1 The acados core library: Identical module signatures simplify user interaction and make it straightforward for developers to extend acados with additional modules.The common C signature includes configuration, dimensions, inputs, outputs, options, memory, and workspace arguments.
- 4.1 The acados core library: Modules can contain submodules, and memory-size calculation for nested modules is performed recursively from the top-level module.An SQP solver may contain an integrator as a submodule.
- 4.2 The C interface: Solver plans represent combinations of module variants, enabling an abstraction layer for switching solver choices without directly handling variant-specific structures.Plans can encode choices such as partial condensing, integrator type, SQP method, cost, model, and constraint formulation.
- 4.3 High-level interfaces: CasADi-based high-level workflows generate C functions for nonlinear evaluations and derivatives, plus solver setup code, producing self-contained projects deployable on embedded hardware.The workflow begins with an OCP description in Python or Matlab and can generate a Matlab S-Function and build system.
5 Numerical Results
The numerical-results section evaluates acados through experiments and comparisons with other embedded optimization packages. It uses the nonlinear chain-of-masses problem as a benchmark designed to be intuitive yet sufficiently challenging for non-trivial solver comparisons.
- 5 Numerical Results: The experiments cover acados performance, Hessian approximations, hardware-in-the-loop simulation, and comparisons with other embedded optimization software.The section also includes a closed-loop engine-control experiment on an embedded platform.
- 5 Numerical Results: The nonlinear chain-of-masses benchmark stabilizes masses with nonlinear interactions and can be scaled by increasing the number of masses.Its combination of intuitive dynamics and non-trivial solver behavior supports comparisons across different solvers.
Closed-loop experiments
Closed-loop experiments compare acados with embedded and non-embedded solvers on solution quality, computation time, Hessian regularization, and an engine-control platform. acados achieves near-reference solution quality, competitive or faster timing, and effective exact-Hessian performance, while tracking the engine reference closely without oscillations.
- Chain-of-masses comparison: ACADO and acados match each other and remain close to the IPOPT reference, whereas first-order solvers are further from it.
- Chain-of-masses comparison: GRAMPC and acados run at almost the same speed, approximately 2× faster than ACADO and 2–3× faster than VIATOC.Timings remain consistent throughout the experiment, including when the disturbance occurs.
- Chain-of-masses comparison: acados and GRAMPC lie on the Pareto-optimal front: acados is 1000× less suboptimal than GRAMPC but has higher computational cost.By median computation times, acados is faster.
- Exact-Hessian SQP: Structure-exploiting convexification converges almost twice as fast as projection regularization and much faster than mirroring regularization.It redistributes convexity among all stages and therefore needs less regularization overall.
- Exact-Hessian SQP: BLASFEO makes convexification only slightly more expensive per iteration than basic regularization while reducing total computational cost.The paper reports that this enables exact-Hessian NMPC online with better performance than state-of-the-art methods.
- Engine-control hardware experiment: On a 900 MHz PowerPC embedded platform, acados tracks the engine reference closely without oscillations, although timing spikes occur at jumps and constraint activations.The platform has 16 MB of main memory, and the experiment uses real-time iterations with HPIPM as the QP solver.
6 Conclusion and outlook
The paper presents acados as an open-source package for rapid testing and deployment of embedded (N)MPC, combining modular algorithms with interfaces and specialized numerical features. Experiments demonstrate millisecond computation times on embedded hardware and speed relative to other packages, while future work extends interoperability and optimization methods.
- acados is a free, open-source package that facilitates rapid testing and deployment of (N)MPC algorithms on embedded hardware.
- Its distinctive features include convexification for real-time exact-Hessian SQP, SCQP Hessian approximation, GNSF-IRK integration, partial condensing, BLASFEO, and CasADi support.
- Millisecond computation times were obtained on a dSPACE MicroAutoboxII for a non-trivial NMPC problem, and acados was shown faster than other embedded optimization packages.
- Future work includes improved Simulink interoperability, nonlinear interior-point methods, and additional SQP-based methods such as multi-level iterations.
System description
The case study models a chain of five masses connected by springs, with one end fixed and the other freely actuated. Its dynamics derive from Hooke’s law, gravity, and direct velocity control of the free mass, with nonlinearity confined to force calculation.
- The system is a chain of M = 5 masses connected by springs to an equilibrium position, with one end fixed and the other freely movable.
- Each spring has constant D and rest length L, and the force model follows Hooke’s law based on neighboring mass positions.
- The equations of motion for middle masses combine neighboring spring forces and gravitational acceleration.
- The control input u ∈ R^3 directly controls the velocity of the free mass.
- Only the force calculation introduces nonlinearity, and the steady state is found by setting f(x_ss, u_ss) = 0 for a specified free-mass position.
Optimal control problem formulation
The chain-of-masses dynamics are converted into a multiple-shooting optimal control problem that penalizes state and input deviations over a finite horizon. The formulation imposes initial-state, dynamics, and input constraints, while omitting path constraints and state bounds for solver comparability.
- The stabilization problem is obtained by applying multiple shooting to the chain’s ordinary differential equation.
- The objective penalizes deviations of x_k and u_k from x_ref and u_ref, plus a terminal state deviation weighted by P.
- The constraints fix the initial state, enforce x_{k+1} = φ_x(x_k, u_k), and bound each control input between -1 and 1.
- The transition map φ is produced by one RK4 step of length 0.2 s, with the initial state set to the current state estimate.
- The horizon is N = 40, and path constraints or state bounds are omitted because not all compared solvers support them.
Case Study 2: Hessian regularization
The section presents cart-pendulum and two-stage turbocharging control problems involving nonlinear dynamics and constrained tracking. Multiple-shooting NMPC uses RK4 integration and tuned weighting, while the engine formulation adds control-rate states for smooth actuation and handles differential-algebraic dynamics.
- Cart-pendulum case study: The cart-pendulum task swings a pendulum from its hanging-down equilibrium by controlling the horizontal force on the cart.
- Cart-pendulum case study: The cart-pendulum state is x = [p, θ, v, ω]^T, where p and v are horizontal displacement and velocity, and θ and ω describe angle and angular velocity.
- Turbocharging case study: The two-stage turbocharging problem targets boost-pressure tracking under nonlinear cross-coupling and constraints, balancing fast high-pressure transients with slower low-pressure power production.
- Turbocharging case study: The engine is modeled by semi-explicit DAEs with compressor differential states, turbine algebraic states, and wastegate control inputs.
- Turbocharging case study: Control derivatives are included as optimization variables to obtain smooth control behavior.