Software setup
Complete these steps before Lesson 4 (30/09/2026). All required software is free and open source.
Julia (MPC and identification)
- Install Julia using the official installer
juliaup, following the instructions at julialang.org/downloads. - Open the Julia REPL and install the packages used in the course:
using Pkg
Pkg.add(["JuMP", "HiGHS", "Plots"])- Check that everything works by solving a tiny optimization problem:
using JuMP, HiGHS
model = Model(HiGHS.Optimizer)
@variable(model, 0 <= x <= 4)
@variable(model, y >= 0, Int)
@constraint(model, x + y <= 5)
@objective(model, Max, 2x + 3y)
optimize!(model)
println(value(x), " ", value(y)) # expected: 0.0 5.0JuMP is the modelling language we use to write MPC problems; HiGHS is an open-source solver for linear, quadratic and mixed-integer problems. HiGHS is enough for the whole course. Students who want to try Gurobi can follow the optional instructions below.
Packages for the identification part (such as ControlSystemIdentification) will be installed later in the course.
Optional: Gurobi with a free academic licence
Gurobi is a commercial solver, often faster than HiGHS on large mixed-integer problems. It is free for students.
- Register on gurobi.com with your Sapienza email and request a free Named-User Academic licence from the academic program page. You will get a licence key of the form
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. - Activate the key while connected to the university network (for example the campus Wi-Fi): Gurobi checks that the request comes from an academic domain. In Julia, run:
import Pkg
Pkg.add(["Gurobi", "Gurobi_jll"])
import Gurobi_jll
key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # replace with your key
run(`$(Gurobi_jll.grbgetkey()) $key`)When asked where to save gurobi.lic, accept the default location (your home directory). Pkg.add("Gurobi") also downloads the Gurobi binaries, so you do not need to install Gurobi separately.
- Test it by solving the same problem as above with Gurobi:
using JuMP, Gurobi
model = Model(Gurobi.Optimizer)
@variable(model, 0 <= x <= 4)
@variable(model, y >= 0, Int)
@constraint(model, x + y <= 5)
@objective(model, Max, 2x + 3y)
optimize!(model)
println(value(x), " ", value(y)) # expected: 0.0 5.0In the course code you can switch solver by changing a single line: Model(HiGHS.Optimizer) or Model(Gurobi.Optimizer).
If Julia does not find the licence, set the environment variable GRB_LICENSE_FILE to the full path of the file itself (for example C:\Users\name\gurobi.lic), not to its folder, and restart Julia. More details in the Gurobi.jl documentation.
Python (reinforcement learning)
For the deep RL experiments we use Python with Gymnasium and Stable-Baselines3. Instructions will be given before the RL part starts (26/10).
Editor
Any editor works. Visual Studio Code with the Julia and Python extensions is a good choice.