Skip to main content

Lorenz Attractor (Lorenz-v0)

The Lorenz environment implements the classic Lorenz system — a three-dimensional chaotic system which, at the standard parameters, has three unstable equilibria: the origin and the two non-trivial equilibria (±β(ρ−1), ±β(ρ−1), ρ−1)(\pm\sqrt{\beta(\rho-1)},\, \pm\sqrt{\beta(\rho-1)},\, \rho - 1). The control task is to stabilise the state at the non-trivial equilibrium with positive x1,x2x_1, x_2, x∗=(β(ρ−1), β(ρ−1), ρ−1)x^* = (\sqrt{\beta(\rho-1)},\, \sqrt{\beta(\rho-1)},\, \rho - 1).

Dynamics​

x˙1=σ(x2−x1)+ux˙2=x1(ρ−x3)−x2x˙3=x1x2−βx3\begin{aligned} \dot{x}_1 &= \sigma (x_2 - x_1) + u \\ \dot{x}_2 &= x_1 (\rho - x_3) - x_2 \\ \dot{x}_3 &= x_1 x_2 - \beta x_3 \end{aligned}

Standard Lorenz parameters: σ=10\sigma = 10, ρ=28\rho = 28, β=8/3\beta = 8/3.

The action uu enters additively through x˙1\dot{x}_1. Integration uses RK45 with Δt=0.01 s\Delta t = 0.01\,\text{s}.

Spaces and limits​

PropertyValue
State dimension3
Action dimension1
x1x_1 range[−20,20][-20, 20]
x2x_2 range[−50,50][-50, 50]
x3x_3 range[0,50][0, 50]
Action range[−75,75][-75, 75]
Δt\Delta t0.01 s
Max episode steps2000 (20 s)

Reference point​

x∗=(β(ρ−1),  β(ρ−1),  ρ−1)≈(8.485,  8.485,  27.0)x^* = \bigl(\sqrt{\beta(\rho-1)},\; \sqrt{\beta(\rho-1)},\; \rho - 1\bigr) \approx (8.485,\; 8.485,\; 27.0)

Cost function​

c(x,u)=(x−x∗)⊤Q(x−x∗)+u⊤Ruc(x, u) = (x - x^*)^\top Q (x - x^*) + u^\top R u

with Q=I3Q = I_3 and R=0.001⋅I1R = 0.001 \cdot I_1. The small action cost (R=0.001R = 0.001) reflects the large control authority needed to overcome chaotic divergence.

LQR linearisation​

The LQR baseline linearises around x∗x^*:

Alin=(−σσ0ρ−z∗−10y∗x∗−β),Blin=(100)A_{\text{lin}} = \begin{pmatrix} -\sigma & \sigma & 0 \\ \rho - z^* & -1 & 0 \\ y^* & x^* & -\beta \end{pmatrix}, \qquad B_{\text{lin}} = \begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}

Usage​

uv run -m koopmanrl.soft_koopman_value_iteration --env_id Lorenz-v0
uv run -m koopmanrl.soft_actor_koopman_critic \
--config_file configurations/sakc_lorenz_hparams.json

Notes​

  • The Lorenz system is chaotic for the standard parameters; without control, trajectories diverge from x∗x^* exponentially.
  • The large action range (±75\pm 75) is needed for reliable stabilisation from arbitrary initial conditions.
  • Source: koopmanrl/environments/lorenz.py