How mpc-based-reinforcement-learning/mpc4rl works
• Core Libraries and Utilities:
• A “common” component that includes shared utilities such as integrators, policies, and other helper functions.
• Simulation Environments:
• The “rlmpc/gym” directory encapsulates simulation environments (e.g., continuous_cartpole, evaporation_process, and linear_system) that adapt gymnasium for these control problems.
• Model Predictive Control (MPC) Solvers:
• The “rlmpc/mpc” directory subdivides into subfolders (cartpole, chain_mass, evaporation_process, linear_system) along with a general MPC module. These components utilize acados to generate MPC solvers.
• Reinforcement Learning Algorithms:
• Notably, the “rlmpc/qlearning”, “rlmpc/ppo”, and “rlmpc/td3” directories represent different RL approaches to approximate or augment MPC control.
• Examples & Scripts:
• The “rlmpc/examples” along with the standalone “scripts” directory offer example implementations and experiments running various control strategies.
• Configuration & Assets:
• Testing:
• The “tests” directory holds unit tests to ensure correctness of implementations.
Architectural patterns and design principles
• Modular Separation:
• Clearly separate the environment (gym) from control strategies (MPC, RL algorithms), which facilitates extensibility and isolated testing.
• Integration Points:
• Integration areas where different control modules (MPC and RL) might run in closed-loop configurations, as evidenced in the scripts (e.g., “cartpole_mpc_as_td3_agent_closed_loop.py”).
• Use of Configuration Files:
• That the “config” module supplies parameters to the simulation environments and control algorithms.
• Multiple Approaches:
• That the project supports a variety of control methods (MPC, Q-learning, PPO, TD3), making it a hybrid control framework.
Relevant technologies and tools
• Acados is central for solving MPC problems.
• Casadi is used for symbolic and algorithmic differentiation.
• Gymnasium acts as the simulation backbone, ensuring that environments like cartpole or linear systems are standardized.