TransformerMPC: Accelerating Model Predictive Control via Transformers

Vrushabh Zinage,Ahmed Khalil,Efstathios Bakolas
2024-09-14
Abstract:In this paper, we address the problem of reducing the computational burden of Model Predictive Control (MPC) for real-time robotic applications. We propose TransformerMPC, a method that enhances the computational efficiency of MPC algorithms by leveraging the attention mechanism in transformers for both online constraint removal and better warm start initialization. Specifically, TransformerMPC accelerates the computation of optimal control inputs by selecting only the active constraints to be included in the MPC problem, while simultaneously providing a warm start to the optimization process. This approach ensures that the original constraints are satisfied at optimality. TransformerMPC is designed to be seamlessly integrated with any MPC solver, irrespective of its implementation. To guarantee constraint satisfaction after removing inactive constraints, we perform an offline verification to ensure that the optimal control inputs generated by the MPC solver meet all constraints. The effectiveness of TransformerMPC is demonstrated through extensive numerical simulations on complex robotic systems, achieving up to 35x improvement in runtime without any loss in performance.
Robotics,Systems and Control
What problem does this paper attempt to address?
This paper attempts to address the problem of reducing the computational burden of Model Predictive Control (MPC) in real-time robotic applications. Specifically, the authors propose the TransformerMPC method, which leverages the attention mechanism in transformers to improve the computational efficiency of the MPC algorithm. This method primarily accelerates the computation of optimal control inputs by removing inactive constraints online and providing better initialization, while ensuring that the original constraints are satisfied during optimization. ### Main Issues: 1. **Heavy computational burden**: Traditional MPC algorithms have a large computational load when dealing with nonlinear systems and non-convex constraints, making real-time applications difficult. 2. **Complex constraint handling**: In MPC, a large number of constraints need to be handled, many of which are inactive, increasing computational complexity. 3. **Difficult initialization**: The solving process of MPC requires a good initial point to speed up convergence. ### Solutions: 1. **Attention mechanism**: Utilize the attention mechanism in transformers to identify active constraints and remove inactive constraints, thereby simplifying the optimization problem. 2. **Better initialization**: Provide an initial point close to the optimal solution through the transformer, accelerating the optimization process. 3. **Generality**: TransformerMPC can be seamlessly integrated into any MPC solver, regardless of its specific implementation. 4. **Offline validation**: Ensure through offline validation that the optimal control inputs generated after removing inactive constraints still satisfy all constraint conditions. ### Experimental Results: - **Constraint reduction**: TransformerMPC significantly reduces the number of inactive constraints, for example, by 89.0% on a wheeled biped robot, 93.6% on a quadrotor drone, and 95.8% on a humanoid robot. - **Reduced computation time**: Compared to baseline methods, TransformerMPC significantly reduces computation time, for example, on the CVXOPT solver, the computation time for a wheeled biped robot is reduced from 1.1549 seconds to 0.1698 seconds (6.8 times improvement), and for the Atlas humanoid robot, the computation time is reduced from 0.95 seconds to 0.0272 seconds (34.9 times improvement). ### Conclusion: TransformerMPC significantly improves the computational efficiency of the MPC algorithm by leveraging the attention mechanism of transformers, making it more suitable for real-time robotic applications without sacrificing performance.