LQR: energy and distance minimisation

The energy and distance minimisation LQR problem consists in minimising

\[ 0.5\int_{0}^{5} x_1^2(t) + x_2^2(t) + u^2(t) \, \mathrm{d}t \]

subject to the constraints

\[ \dot x_1(t) = x_2(t), \quad \dot x_2(t) = -x_1(t) + u(t), \quad u(t) \in \R\]

and the limit conditions

\[ x(0) = (0,1)\]

using CTProblems
using DifferentialEquations
using Plots

You can access the problem in the CTProblems package:

prob = Problem(:lqr, :x_dim_2, :u_dim_1, :lagrange)
title           = lqr - dimension 2 - ricatti
model    (Type) = OptimalControlModel{Autonomous, Fixed}
solution (Type) = OptimalControlSolution

Then, the model is given by

prob.model

The (autonomous) optimal control problem is given by:

    t ∈ [t0, tf], time
    x ∈ R², state
    u ∈ R, control
    x(t0) == x0, initial_con
    ẋ(t) == A * x(t) + B * u(t)
    ∫(0.5 * (x₁(t) ^ 2 + x₂(t) ^ 2 + u(t) ^ 2)) → min

The (autonomous) optimal control problem is of the form:

    minimize  J(x, u) = ∫ f⁰(x(t), u(t)) dt, over [0, 5]

    subject to

        ẋ(t) = f(x(t), u(t)), t in [0, 5] a.e.,

        ϕl ≤ ϕ(x(0), x(5)) ≤ ϕu, 

    where x(t) ∈ R² and u(t) ∈ R.

Declarations (* required):
╭────────┬────────┬──────────┬──────────┬───────────┬────────────┬─────────────╮
│ times* │ state* │ control* │ variable │ dynamics* │ objective* │ constraints │
├────────┼────────┼──────────┼──────────┼───────────┼────────────┼─────────────┤
│   V    │   V    │    V     │    X     │     V     │     V      │      V      │
╰────────┴────────┴──────────┴──────────┴───────────┴────────────┴─────────────╯

You can plot the solution.

plot(prob.solution)