Model Predictive Control (MPC) in Julia


I am considering using Julia and JuMP for my Master Thesis in learning based robust economic Model Predictive Control. I hope to get some feedback from the community on what packages to use or on what functionalities are still missing, where I could possibly help contributing to julia.

In principle, implementing an MPC Controller means solving a constraint finite horizon Optimal Control Problem repeatedly. Additionally, it is important to be able to calculate invariant sets, i.e. computing the Minkowski Sum of two sets repeatedly (e.g. the sum of polyhedral and an ellipsoidal set).

At my University, we have a Matlab heavy control lab, and therefore we are also using Matlab for MPC. Specifically the Yalmip toolbox (for optimization) and the Multi-Parametric Toolbox ( for the set calculations. I’d like to replace these toolboxes and Matlab by a Julia framework.
From my experience, with JuMP I should be able to define and solve the optimization problems. But for the set manipulations, I haven’t found any packages suitable for my needs.

So I was wondering, if there is already some work done on MPC in general and invariant set calculation in special or if there are plans to do so. Or if there are general caveats on using JuMP for MPC?


Sounds exciting! For polyhedron calculations you can use . What else is missing?

1 Like

Ok, I see, positive invariant set calculation. The Matlab code has GPL license, so you could convert it directly to julia if you know exactly which functions you need. Not so nice, LGPL or MIT license is more common for Julia libraries.


Thanks :slight_smile: . Yes, I saw the Polyhedra.jl package, but as you mentioned, the functionality of calculating the Minkowsky sum is missing (as far as I know). And most likely, I also need to do the calculations with ellipsoidal sets.


You can certainly do MPC in JuMP (see for a very simple example), and if your baseline is Yalmip in MATLAB then the performance should be good.

An alternative to JuMP is , which focuses on making it easy to update a problem in-place very efficiently. That can make your problem setup much faster than it would be with JuMP. Parametron.jl and JuMP both use the same solver interface tools, so it should be relatively easy to switch between them.


SetProg.jl is designed for computing invariant sets, it can compute ellipsoidal or polynomial controlled invariant sets that can be used for MPC, Polyhedral invariant sets is not implemented yet but it’s a few lines with Polyhedra.jl:
Could you describe what form of invariant set (polyhedra, ellipsoidal ?) you are looking form and what is the system (do you want it to be controlled invariant or just invariant ?)


Is Parametron.jl expected to be more efficient for MPC than ParameterJuMP (


Perhaps, but we haven’t tested it. The real difference is that they’re focused on different things: ParameterJuMP focuses on scalar parameters and lets you extract the duals corresponding to those parameters, while Parametron.jl takes a much more broad view of what a “parameter” is. In Parametron.jl, a Parameter can be literally anything as long as you can provide a value for it and a way to update that value. For example, the entire state of your robot might be a Parameter in Paramteron.jl. Parametron.jl also provides tools to construct affine expressions that can reference parameters, including the ability to update those expressions in-place when your parameters change. On the other hand, Parametron.jl doesn’t provide any ability to query duals of parameters.

1 Like

Ah, thank you for describing the different intended uses of these two packages.


Thanks, I will have a closer look at SetProg.jl.

Since I am still working on the theoretical description of my system which will be an economic MPC scheme with a learned model, I haven’t figured out everything concerning the implementation yet.
However, I intended to work with a polyhedral invariant set if it is computationally feasible. In MPC term, this would be the minimal robust positive invariant set (mRPI), respectively an invariant approximation of it as e.g. shown in Invariant Approximation of mRPI.


See this example for how to compute a minimal robust positive invariant set with Polyhedra.jl.

1 Like