cyqlone develop
Fast, parallel and vectorized solver for linear systems with optimal control structure.
Loading...
Searching...
No Matches
cyqlone::LinearOCPStorage Struct Reference

#include <cyqlone/ocp.hpp>

Detailed Description

Storage for a linear-quadratic OCP of the form.

ₙ₋₁
minimize ∑ [½ uᵢᵀ Rᵢ uᵢ + uᵢᵀ S xᵢ + ½ xᵢᵀ Qᵢ xᵢ + rᵢᵀuᵢ + qᵢᵀxᵢ] + ½ xₙᵀ Qₙ xₙ + qₙᵀ xₙ
ⁱ⁼⁰
s.t. x₀ = b₀
xᵢ₊₁ = Aᵢ xᵢ + Bᵢ uᵢ + bᵢ₊₁
lᵢ ≤ Cᵢ xᵢ + Dᵢ uᵢ ≤ uᵢ
lₙ ≤ Cₙ xₙ ≤ uₙ
guanaqo::MatrixView< real_t, index_t > S(index_t i)
Definition ocp.hpp:85
Examples
solve-ocp.cpp.

Definition at line 37 of file ocp.hpp.

Classes

struct  Solution
struct  KKTError

Public Member Functions

guanaqo::MatrixView< real_t, index_t > H (index_t i)
guanaqo::MatrixView< real_t, index_t > Q (index_t i)
guanaqo::MatrixView< real_t, index_t > R (index_t i)
guanaqo::MatrixView< real_t, index_t > S (index_t i)
guanaqo::MatrixView< real_t, index_t > S_trans (index_t i)
guanaqo::MatrixView< real_t, index_t > CD (index_t i)
guanaqo::MatrixView< real_t, index_t > C (index_t i)
guanaqo::MatrixView< real_t, index_t > D (index_t i)
guanaqo::MatrixView< real_t, index_t > AB (index_t i)
guanaqo::MatrixView< real_t, index_t > A (index_t i)
guanaqo::MatrixView< real_t, index_t > B (index_t i)
guanaqo::MatrixView< const real_t, index_t > H (index_t i) const
guanaqo::MatrixView< const real_t, index_t > Q (index_t i) const
guanaqo::MatrixView< const real_t, index_t > R (index_t i) const
guanaqo::MatrixView< const real_t, index_t > S (index_t i) const
guanaqo::MatrixView< const real_t, index_t > S_trans (index_t i) const
guanaqo::MatrixView< const real_t, index_t > CD (index_t i) const
guanaqo::MatrixView< const real_t, index_t > C (index_t i) const
guanaqo::MatrixView< const real_t, index_t > D (index_t i) const
guanaqo::MatrixView< const real_t, index_t > AB (index_t i) const
guanaqo::MatrixView< const real_t, index_t > A (index_t i) const
guanaqo::MatrixView< const real_t, index_t > B (index_t i) const
index_t num_variables () const
index_t num_constraints () const
index_t num_dynamics_constraints () const
guanaqo::MatrixView< real_t, index_t > qr ()
guanaqo::MatrixView< real_t, index_t > qr (index_t i)
guanaqo::MatrixView< real_t, index_t > q (index_t i)
guanaqo::MatrixView< real_t, index_t > r (index_t i)
guanaqo::MatrixView< real_t, index_t > b ()
guanaqo::MatrixView< real_t, index_t > b (index_t i)
guanaqo::MatrixView< real_t, index_t > b_min ()
guanaqo::MatrixView< real_t, index_t > b_min (index_t i)
guanaqo::MatrixView< real_t, index_t > b_max ()
guanaqo::MatrixView< real_t, index_t > b_max (index_t i)
guanaqo::MatrixView< const real_t, index_t > qr () const
guanaqo::MatrixView< const real_t, index_t > qr (index_t i) const
guanaqo::MatrixView< const real_t, index_t > q (index_t i) const
guanaqo::MatrixView< const real_t, index_t > r (index_t i) const
guanaqo::MatrixView< const real_t, index_t > b () const
guanaqo::MatrixView< const real_t, index_t > b (index_t i) const
guanaqo::MatrixView< const real_t, index_t > b_min () const
guanaqo::MatrixView< const real_t, index_t > b_min (index_t i) const
guanaqo::MatrixView< const real_t, index_t > b_max () const
guanaqo::MatrixView< const real_t, index_t > b_max (index_t i) const
KKTError compute_kkt_error (const Solution &sol) const

Static Public Member Functions

static std::vector< real_t > create_storage (OCPDim dim)

Public Attributes

OCPDim dim {}
std::vector< real_t > storage = create_storage(dim)
 Create a single contiguous storage for all problem data.

Class Documentation

◆ cyqlone::LinearOCPStorage::KKTError

struct cyqlone::LinearOCPStorage::KKTError
Class Members
real_t stationarity
real_t inequality_residual
real_t equality_residual
real_t complementarity

Member Function Documentation

◆ create_storage()

std::vector< real_t > cyqlone::LinearOCPStorage::create_storage ( OCPDim dim)
inlinestatic

Definition at line 58 of file ocp.hpp.

◆ H() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::H ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 64 of file ocp.hpp.

◆ Q() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::Q ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 75 of file ocp.hpp.

◆ R() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::R ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 80 of file ocp.hpp.

◆ S() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::S ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 85 of file ocp.hpp.

◆ S_trans() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::S_trans ( index_t i)
inlinenodiscard

Definition at line 90 of file ocp.hpp.

◆ CD() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::CD ( index_t i)
inlinenodiscard

Definition at line 95 of file ocp.hpp.

◆ C() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::C ( index_t i)
inlinenodiscard

Definition at line 106 of file ocp.hpp.

◆ D() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::D ( index_t i)
inlinenodiscard

Definition at line 111 of file ocp.hpp.

◆ AB() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::AB ( index_t i)
inlinenodiscard

Definition at line 116 of file ocp.hpp.

◆ A() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::A ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 127 of file ocp.hpp.

◆ B() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::B ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 132 of file ocp.hpp.

◆ H() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::H ( index_t i) const
inlinenodiscard

Definition at line 138 of file ocp.hpp.

◆ Q() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::Q ( index_t i) const
inlinenodiscard

Definition at line 149 of file ocp.hpp.

◆ R() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::R ( index_t i) const
inlinenodiscard

Definition at line 154 of file ocp.hpp.

◆ S() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::S ( index_t i) const
inlinenodiscard

Definition at line 159 of file ocp.hpp.

◆ S_trans() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::S_trans ( index_t i) const
inlinenodiscard

Definition at line 164 of file ocp.hpp.

◆ CD() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::CD ( index_t i) const
inlinenodiscard

Definition at line 169 of file ocp.hpp.

◆ C() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::C ( index_t i) const
inlinenodiscard

Definition at line 180 of file ocp.hpp.

◆ D() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::D ( index_t i) const
inlinenodiscard

Definition at line 185 of file ocp.hpp.

◆ AB() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::AB ( index_t i) const
inlinenodiscard

Definition at line 190 of file ocp.hpp.

◆ A() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::A ( index_t i) const
inlinenodiscard

Definition at line 201 of file ocp.hpp.

◆ B() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::B ( index_t i) const
inlinenodiscard

Definition at line 206 of file ocp.hpp.

◆ num_variables()

index_t cyqlone::LinearOCPStorage::num_variables ( ) const
inlinenodiscard

Definition at line 212 of file ocp.hpp.

◆ num_constraints()

index_t cyqlone::LinearOCPStorage::num_constraints ( ) const
inlinenodiscard

Definition at line 216 of file ocp.hpp.

◆ num_dynamics_constraints()

index_t cyqlone::LinearOCPStorage::num_dynamics_constraints ( ) const
inlinenodiscard

Definition at line 220 of file ocp.hpp.

◆ qr() [1/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::qr ( )
inlinenodiscard

Definition at line 225 of file ocp.hpp.

◆ qr() [2/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::qr ( index_t i)
inlinenodiscard

Definition at line 234 of file ocp.hpp.

◆ q() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::q ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 240 of file ocp.hpp.

◆ r() [1/2]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::r ( index_t i)
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 245 of file ocp.hpp.

◆ b() [1/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::b ( )
inlinenodiscard
Examples
solve-ocp.cpp.

Definition at line 251 of file ocp.hpp.

◆ b() [2/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::b ( index_t i)
inlinenodiscard

Definition at line 260 of file ocp.hpp.

◆ b_min() [1/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::b_min ( )
inlinenodiscard

Definition at line 267 of file ocp.hpp.

◆ b_min() [2/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::b_min ( index_t i)
inlinenodiscard

Definition at line 276 of file ocp.hpp.

◆ b_max() [1/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::b_max ( )
inlinenodiscard

Definition at line 283 of file ocp.hpp.

◆ b_max() [2/4]

guanaqo::MatrixView< real_t, index_t > cyqlone::LinearOCPStorage::b_max ( index_t i)
inlinenodiscard

Definition at line 293 of file ocp.hpp.

◆ qr() [3/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::qr ( ) const
inlinenodiscard

Definition at line 300 of file ocp.hpp.

◆ qr() [4/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::qr ( index_t i) const
inlinenodiscard

Definition at line 309 of file ocp.hpp.

◆ q() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::q ( index_t i) const
inlinenodiscard

Definition at line 315 of file ocp.hpp.

◆ r() [2/2]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::r ( index_t i) const
inlinenodiscard

Definition at line 320 of file ocp.hpp.

◆ b() [3/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::b ( ) const
inlinenodiscard

Definition at line 326 of file ocp.hpp.

◆ b() [4/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::b ( index_t i) const
inlinenodiscard

Definition at line 335 of file ocp.hpp.

◆ b_min() [3/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::b_min ( ) const
inlinenodiscard

Definition at line 342 of file ocp.hpp.

◆ b_min() [4/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::b_min ( index_t i) const
inlinenodiscard

Definition at line 351 of file ocp.hpp.

◆ b_max() [3/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::b_max ( ) const
inlinenodiscard

Definition at line 358 of file ocp.hpp.

◆ b_max() [4/4]

guanaqo::MatrixView< const real_t, index_t > cyqlone::LinearOCPStorage::b_max ( index_t i) const
inlinenodiscard

Definition at line 368 of file ocp.hpp.

◆ compute_kkt_error()

auto cyqlone::LinearOCPStorage::compute_kkt_error ( const Solution & sol) const
nodiscard

Definition at line 10 of file ocp.cpp.

Member Data Documentation

◆ dim

OCPDim cyqlone::LinearOCPStorage::dim {}

Definition at line 38 of file ocp.hpp.

◆ storage

std::vector<real_t> cyqlone::LinearOCPStorage::storage = create_storage(dim)

Create a single contiguous storage for all problem data.

Storage layout: size offset
N × [ Q Sᵀ] = H (nx+nu)² 0
[ S R ]
1 × [ Q ] nx² N (nx+nu)²
N × [ C D ] ny(nx+nu) N (nx+nu)² + nx²
1 × [ C ] ny_N nx N (nx+nu+ny)(nx+nu) + nx²
N × [ A B ] nx(nx+nu) N (nx+nu+ny)(nx+nu) + (nx+ny_N)nx
N × [ q r ] nx+nu N (2nx+nu+ny)(nx+nu) + (nx+ny_N)nx
1 × [ q ] nx N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N)nx
N+1 × [ b ] nx N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+1)nx
N × [ l ] ny N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx
1 × [ l ] ny_N N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N ny
N × [ u ] ny N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N ny + ny_N
1 × [ u ] ny_N N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N (2ny) + ny_N
N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N (2ny) + 2ny_N
guanaqo::MatrixView< real_t, index_t > r(index_t i)
Definition ocp.hpp:245
guanaqo::MatrixView< real_t, index_t > q(index_t i)
Definition ocp.hpp:240
guanaqo::MatrixView< real_t, index_t > B(index_t i)
Definition ocp.hpp:132
guanaqo::MatrixView< real_t, index_t > D(index_t i)
Definition ocp.hpp:111
guanaqo::MatrixView< real_t, index_t > b()
Definition ocp.hpp:251
guanaqo::MatrixView< real_t, index_t > R(index_t i)
Definition ocp.hpp:80
guanaqo::MatrixView< real_t, index_t > H(index_t i)
Definition ocp.hpp:64
guanaqo::MatrixView< real_t, index_t > C(index_t i)
Definition ocp.hpp:106
guanaqo::MatrixView< real_t, index_t > Q(index_t i)
Definition ocp.hpp:75
guanaqo::MatrixView< real_t, index_t > A(index_t i)
Definition ocp.hpp:127

Definition at line 57 of file ocp.hpp.


The documentation for this struct was generated from the following files: