Video summary

Optimal Control of the Lotka-Volterra Equations (mpc-Casadi)

Main summary

Key takeaways

Educational

Main ideas / concepts conveyed

  • The video demonstrates how to solve a Lotka–Volterra-type dynamical system (called “Lotka, Volterra model” in the subtitles) by: 1) solving without control (control input set to zero), and then 2) solving with Model Predictive Control (MPC) using a cost (objective) function and constraints.
  • It highlights the workflow of:
    • converting differential equations into a discrete-time model over a time horizon, then
    • formulating and solving an optimal control problem.
  • It uses a CasADi-style MPC formulation (the title mentions “mpc-Casadi”) and constructs:
    • a state-space prediction model (discretized dynamics),
    • a quadratic tracking cost (weighted error in state and control),
    • constraints on state and control,
    • an optimization routine producing an optimal control sequence over a horizon.
  • The goal is to drive the state (notably (x_1)) toward a target/reference value:
    • described as reaching (x_1 = 1) when control is applied,
    • with observed convergence/stabilization after roughly ~100 seconds (per the subtitles).

Method / procedure shown (step-by-step, detailed)

A) Define the dynamical system (Lotka–Volterra-like model)

  • Begin with differential equations (subtitles are noisy, but the structure matches Lotka–Volterra dynamics).
  • Identify constants and parameters:
    • mentions parameters such as (\alpha) (alpha), (\beta) (beta), (c), etc. (positive constants)
    • includes a time discretization using time step / (\Delta t).
  • Define states:
    • (x_1), and also another variable in the Lotka–Volterra context (e.g., (x_2) / (y)).
  • Define the control input:
    • a control variable ((u) / “control”) with a bounded range (subtitles suggest bounds like 0 to 1).
  • Describe constraints on variables:
    • state constraints appear to involve nonnegativity and upper/lower bounds (subtitles are confusing, but indicate sign/bound restrictions such as “from zero to infinity” and other bound logic)
    • control must satisfy bounds (not exceed the specified maximum control).

B) Discretize the differential equations for simulation / MPC

  • Introduce a discrete-time update using (\Delta t).
  • Use a forward-Euler-like form suggested by the subtitles:
    • expressions of the form:
      • (x(k+1) = x(k) + (\dots)\Delta t)
    • include Lotka–Volterra-style terms involving state products and parameters, plus the control input.

C) Define the simulation setup (without MPC)

  • Build a numerical simulation using an explicit update function:
    • mentions something like (F) to compute the next state from current state and control.
  • Choose a time horizon for simulation:
    • mentions 0 to 200 seconds.
  • Run the system with control = 0:
    • compute trajectories over the time horizon.
  • Plot results:
    • show state evolution (at least (x_1) and the other state variable).

D) Define the MPC objective (cost / objective function)

  • Introduce an objective function based on tracking error:
    • penalize deviation of the state from a reference value.
  • Use a quadratic form:
    • subtitles explicitly reference structures like:
      • (x^T Q x) (and similarly (u^T R u)), where:
        • (Q) weights state error,
        • (R) weights control effort.
  • Include a terminal cost:
    • referenced as (Q_f) (or similar).
  • Define the MPC horizon:
    • subtitles mention something like 30 steps.

E) Convert the prediction/control problem into an optimization model

  • Formulate an MPC optimization problem with:
    • decision variables: the predicted state trajectory over the horizon and control inputs (stacked into vectors),
    • constraints:
      • dynamics constraints enforcing (x(k) \to x(k+1)) through the prediction model,
      • bounds on state and control,
      • terminal/boundary constraints (subtitles mention “robot”/“Robin” confusion; likely boundary conditions).
  • Implement dynamics constraints using a function handle / builder:
    • subtitles mention something like make_f / f to construct the prediction steps.

F) Solve MPC repeatedly in closed loop (receding horizon)

  • At each control update:
    • take the current measured/estimated state (x_{\text{current}}),
    • solve the optimization to get:
      • the optimal control sequence and predicted state trajectory.
  • Apply only the first control action:
    • classic MPC receding horizon behavior (“apply the first move”)
    • subtitles suggest the control is applied as a step across the next interval.
  • Repeat until the end of the simulation window (again, 0–200 seconds).
  • Plot MPC results:
    • state trajectories under MPC,
    • the control input trajectory,
    • convergence: state stabilizes near 1 after about ~100 seconds.
  • Enforce control feasibility:
    • the control respects the bound (not exceeding 1).

Key lessons / takeaways

  • Validate the model first by simulating without control.
  • Then apply MPC by:
    • building a prediction model from differential equations,
    • choosing quadratic tracking cost weights ((Q, R)) and a terminal weight ((Q_f)),
    • enforcing constraints on states and controls,
    • solving an optimization problem over a horizon and using only the first control action.
  • The resulting MPC behavior stabilizes/tracks the target (driving (x_1) to 1).

Speakers / sources featured

  • No specific individual person is clearly identified by name in the subtitles.
  • Source referenced (as described in subtitles):
    • an article titled along the lines of “Optimal Control for the Lotka-Volterra (RA) system” / “Optim Control for the RA system”,
    • used as the differential-equation source.
  • Tools mentioned:
    • CasADi (implied by the video title and the CasADi-like MPC workflow),
    • plus plotting/simulation/visualization tools (subtitles mention “animation/draw images”).

Original video