cyqlone develop
Fast, parallel and vectorized solver for linear systems with optimal control structure.
Loading...
Searching...
No Matches
ocp.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file
4/// Data structure for optimal control problems.
5/// @ingroup topic-ocp-formulations
6
7#include <cyqlone/config.hpp>
8#include <batmat/config.hpp>
9#include <guanaqo/mat-view.hpp>
10#include <vector>
11
12namespace cyqlone {
13
14/// Dimensions of an optimal control problem.
15/// @ingroup topic-ocp-formulations
16struct OCPDim {
17 index_t N_horiz; ///< Horizon length (one less than the number of stages)
18 index_t nx; ///< Number of state variables.
19 index_t nu; ///< Number of input variables.
20 index_t ny; ///< Number of output variables.
21 index_t ny_N = ny; ///< Number of output variables in the last stage.
22 friend constexpr bool operator==(OCPDim, OCPDim) = default;
23 friend constexpr bool operator!=(OCPDim, OCPDim) = default;
24};
25
26/// Storage for a linear-quadratic OCP of the form
27/// ~~~
28/// ₙ₋₁
29/// minimize ∑ [½ uᵢᵀ Rᵢ uᵢ + uᵢᵀ S xᵢ + ½ xᵢᵀ Qᵢ xᵢ + rᵢᵀuᵢ + qᵢᵀxᵢ] + ½ xₙᵀ Qₙ xₙ + qₙᵀ xₙ
30/// ⁱ⁼⁰
31/// s.t. x₀ = b₀
32/// xᵢ₊₁ = Aᵢ xᵢ + Bᵢ uᵢ + bᵢ₊₁
33/// lᵢ ≤ Cᵢ xᵢ + Dᵢ uᵢ ≤ uᵢ
34/// lₙ ≤ Cₙ xₙ ≤ uₙ
35/// ~~~
36/// @ingroup topic-ocp-formulations
39 /// Create a single contiguous storage for all problem data.
40 /// ~~~
41 /// Storage layout: size offset
42 /// N × [ Q Sᵀ] = H (nx+nu)² 0
43 /// [ S R ]
44 /// 1 × [ Q ] nx² N (nx+nu)²
45 /// N × [ C D ] ny(nx+nu) N (nx+nu)² + nx²
46 /// 1 × [ C ] ny_N nx N (nx+nu+ny)(nx+nu) + nx²
47 /// N × [ A B ] nx(nx+nu) N (nx+nu+ny)(nx+nu) + (nx+ny_N)nx
48 /// N × [ q r ] nx+nu N (2nx+nu+ny)(nx+nu) + (nx+ny_N)nx
49 /// 1 × [ q ] nx N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N)nx
50 /// N+1 × [ b ] nx N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+1)nx
51 /// N × [ l ] ny N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx
52 /// 1 × [ l ] ny_N N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N ny
53 /// N × [ u ] ny N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N ny + ny_N
54 /// 1 × [ u ] ny_N N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N (2ny) + ny_N
55 /// N (2nx+nu+ny+1)(nx+nu) + (nx+ny_N+2+N)nx + N (2ny) + 2ny_N
56 /// ~~~
57 std::vector<real_t> storage = create_storage(dim);
58 static std::vector<real_t> create_storage(OCPDim dim) {
59 auto [N, nx, nu, ny, ny_N] = dim;
60 index_t size = N * (2 * nx + nu + ny + 1) * (nx + nu) + (nx + ny_N + 2 + N) * nx +
61 2 * N * ny + 2 * ny_N;
62 return std::vector<real_t>(size);
63 }
64 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> H(index_t i) {
65 auto [N, nx, nu, ny, ny_N] = dim;
66 assert(i <= N);
67 index_t offset = 0;
68 index_t size = (nx + nu) * (nx + nu);
69 return {{
70 .data = &storage[offset + i * size],
71 .rows = i < N ? nx + nu : nx,
72 .cols = i < N ? nx + nu : nx,
73 }};
74 }
75 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> Q(index_t i) {
76 auto [N, nx, nu, ny, ny_N] = dim;
77 assert(i <= N);
78 return H(i).top_left(nx, nx);
79 }
80 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> R(index_t i) {
81 auto [N, nx, nu, ny, ny_N] = dim;
82 assert(i < N);
83 return H(i).bottom_right(nu, nu);
84 }
85 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> S(index_t i) {
86 auto [N, nx, nu, ny, ny_N] = dim;
87 assert(i < N);
88 return H(i).bottom_left(nu, nx);
89 }
91 auto [N, nx, nu, ny, ny_N] = dim;
92 assert(i < N);
93 return H(i).top_right(nx, nu);
94 }
95 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> CD(index_t i) {
96 auto [N, nx, nu, ny, ny_N] = dim;
97 assert(i <= N);
98 index_t offset = N * (nx + nu) * (nx + nu) + nx * nx;
99 index_t size = ny * (nx + nu);
100 return {{
101 .data = &storage[offset + i * size],
102 .rows = i < N ? ny : ny_N,
103 .cols = i < N ? nx + nu : nx,
104 }};
105 }
106 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> C(index_t i) {
107 auto [N, nx, nu, ny, ny_N] = dim;
108 assert(i <= N);
109 return CD(i).left_cols(nx);
110 }
111 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> D(index_t i) {
112 auto [N, nx, nu, ny, ny_N] = dim;
113 assert(i < N);
114 return CD(i).right_cols(nu);
115 }
116 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> AB(index_t i) {
117 auto [N, nx, nu, ny, ny_N] = dim;
118 assert(i < N);
119 index_t offset = N * (nx + nu + ny) * (nx + nu) + (nx + ny_N) * nx;
120 index_t size = nx * (nx + nu);
121 return {{
122 .data = &storage[offset + i * size],
123 .rows = nx,
124 .cols = nx + nu,
125 }};
126 }
127 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> A(index_t i) {
128 auto [N, nx, nu, ny, ny_N] = dim;
129 assert(i < N);
130 return AB(i).left_cols(nx);
131 }
132 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> B(index_t i) {
133 auto [N, nx, nu, ny, ny_N] = dim;
134 assert(i < N);
135 return AB(i).right_cols(nu);
136 }
137
138 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> H(index_t i) const {
139 auto [N, nx, nu, ny, ny_N] = dim;
140 assert(i <= N);
141 index_t offset = 0;
142 index_t size = (nx + nu) * (nx + nu);
143 return {{
144 .data = &storage[offset + i * size],
145 .rows = i < N ? nx + nu : nx,
146 .cols = i < N ? nx + nu : nx,
147 }};
148 }
149 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> Q(index_t i) const {
150 auto [N, nx, nu, ny, ny_N] = dim;
151 assert(i <= N);
152 return H(i).top_left(nx, nx);
153 }
154 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> R(index_t i) const {
155 auto [N, nx, nu, ny, ny_N] = dim;
156 assert(i < N);
157 return H(i).bottom_right(nu, nu);
158 }
159 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> S(index_t i) const {
160 auto [N, nx, nu, ny, ny_N] = dim;
161 assert(i < N);
162 return H(i).bottom_left(nu, nx);
163 }
165 auto [N, nx, nu, ny, ny_N] = dim;
166 assert(i < N);
167 return H(i).top_right(nx, nu);
168 }
169 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> CD(index_t i) const {
170 auto [N, nx, nu, ny, ny_N] = dim;
171 assert(i <= N);
172 index_t offset = N * (nx + nu) * (nx + nu) + nx * nx;
173 index_t size = ny * (nx + nu);
174 return {{
175 .data = &storage[offset + i * size],
176 .rows = i < N ? ny : ny_N,
177 .cols = i < N ? nx + nu : nx,
178 }};
179 }
180 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> C(index_t i) const {
181 auto [N, nx, nu, ny, ny_N] = dim;
182 assert(i <= N);
183 return CD(i).left_cols(nx);
184 }
185 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> D(index_t i) const {
186 auto [N, nx, nu, ny, ny_N] = dim;
187 assert(i < N);
188 return CD(i).right_cols(nu);
189 }
190 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> AB(index_t i) const {
191 auto [N, nx, nu, ny, ny_N] = dim;
192 assert(i < N);
193 index_t offset = N * (nx + nu + ny) * (nx + nu) + (nx + ny_N) * nx;
194 index_t size = nx * (nx + nu);
195 return {{
196 .data = &storage[offset + i * size],
197 .rows = nx,
198 .cols = nx + nu,
199 }};
200 }
201 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> A(index_t i) const {
202 auto [N, nx, nu, ny, ny_N] = dim;
203 assert(i < N);
204 return AB(i).left_cols(nx);
205 }
206 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> B(index_t i) const {
207 auto [N, nx, nu, ny, ny_N] = dim;
208 assert(i < N);
209 return AB(i).right_cols(nu);
210 }
211
212 [[nodiscard]] index_t num_variables() const {
213 auto [N, nx, nu, ny, ny_N] = dim;
214 return N * (nx + nu) + nx;
215 }
216 [[nodiscard]] index_t num_constraints() const {
217 auto [N, nx, nu, ny, ny_N] = dim;
218 return N * ny + ny_N;
219 }
220 [[nodiscard]] index_t num_dynamics_constraints() const {
221 auto [N, nx, nu, ny, ny_N] = dim;
222 return (N + 1) * nx;
223 }
224
226 auto [N, nx, nu, ny, ny_N] = dim;
227 index_t offset = N * (2 * nx + nu + ny) * (nx + nu) + (nx + ny_N) * nx;
228 return {{
229 .data = storage.data() + offset,
230 .rows = N * (nx + nu) + nx,
231 .cols = 1,
232 }};
233 }
234 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> qr(index_t i) {
235 auto [N, nx, nu, ny, ny_N] = dim;
236 assert(i <= N);
237 index_t size = nx + nu;
238 return qr().middle_rows(i * size, i < N ? size : nx);
239 }
240 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> q(index_t i) {
241 auto [N, nx, nu, ny, ny_N] = dim;
242 assert(i <= N);
243 return qr(i).top_rows(nx);
244 }
245 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> r(index_t i) {
246 auto [N, nx, nu, ny, ny_N] = dim;
247 assert(i < N);
248 return qr(i).bottom_rows(nu);
249 }
250
252 auto [N, nx, nu, ny, ny_N] = dim;
253 index_t offset = N * (2 * nx + nu + ny + 1) * (nx + nu) + (nx + ny_N + 1) * nx;
254 return {{
255 .data = storage.data() + offset,
256 .rows = (N + 1) * nx,
257 .cols = 1,
258 }};
259 }
260 [[nodiscard]] guanaqo::MatrixView<real_t, index_t> b(index_t i) {
261 auto [N, nx, nu, ny, ny_N] = dim;
262 assert(i <= N);
263 index_t size = nx;
264 return b().middle_rows(i * size, size);
265 }
266
268 auto [N, nx, nu, ny, ny_N] = dim;
269 index_t offset = N * (2 * nx + nu + ny + 1) * (nx + nu) + (nx + ny_N + 2 + N) * nx;
270 return {{
271 .data = storage.data() + offset,
272 .rows = N * ny + ny_N,
273 .cols = 1,
274 }};
275 }
277 auto [N, nx, nu, ny, ny_N] = dim;
278 assert(i <= N);
279 index_t size = ny;
280 return b_min().middle_rows(i * size, i < N ? size : ny_N);
281 }
282
284 auto [N, nx, nu, ny, ny_N] = dim;
285 index_t offset =
286 N * (2 * nx + nu + ny + 1) * (nx + nu) + (nx + ny_N + 2 + N) * nx + N * ny + ny_N;
287 return {{
288 .data = storage.data() + offset,
289 .rows = N * ny + ny_N,
290 .cols = 1,
291 }};
292 }
294 auto [N, nx, nu, ny, ny_N] = dim;
295 assert(i <= N);
296 index_t size = ny;
297 return b_max().middle_rows(i * size, i < N ? size : ny_N);
298 }
299
301 auto [N, nx, nu, ny, ny_N] = dim;
302 index_t offset = N * (2 * nx + nu + ny) * (nx + nu) + (nx + ny_N) * nx;
303 return {{
304 .data = storage.data() + offset,
305 .rows = N * (nx + nu) + nx,
306 .cols = 1,
307 }};
308 }
309 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> qr(index_t i) const {
310 auto [N, nx, nu, ny, ny_N] = dim;
311 assert(i <= N);
312 index_t size = nx + nu;
313 return qr().middle_rows(i * size, i < N ? size : nx);
314 }
315 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> q(index_t i) const {
316 auto [N, nx, nu, ny, ny_N] = dim;
317 assert(i <= N);
318 return qr(i).top_rows(nx);
319 }
320 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> r(index_t i) const {
321 auto [N, nx, nu, ny, ny_N] = dim;
322 assert(i < N);
323 return qr(i).bottom_rows(nu);
324 }
325
327 auto [N, nx, nu, ny, ny_N] = dim;
328 index_t offset = N * (2 * nx + nu + ny + 1) * (nx + nu) + (nx + ny_N + 1) * nx;
329 return {{
330 .data = storage.data() + offset,
331 .rows = (N + 1) * nx,
332 .cols = 1,
333 }};
334 }
335 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> b(index_t i) const {
336 auto [N, nx, nu, ny, ny_N] = dim;
337 assert(i <= N);
338 index_t size = nx;
339 return b().middle_rows(i * size, size);
340 }
341
343 auto [N, nx, nu, ny, ny_N] = dim;
344 index_t offset = N * (2 * nx + nu + ny + 1) * (nx + nu) + (nx + ny_N + 2 + N) * nx;
345 return {{
346 .data = storage.data() + offset,
347 .rows = N * ny + ny_N,
348 .cols = 1,
349 }};
350 }
351 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> b_min(index_t i) const {
352 auto [N, nx, nu, ny, ny_N] = dim;
353 assert(i <= N);
354 index_t size = ny;
355 return b_min().middle_rows(i * size, i < N ? size : ny_N);
356 }
357
359 auto [N, nx, nu, ny, ny_N] = dim;
360 index_t offset =
361 N * (2 * nx + nu + ny + 1) * (nx + nu) + (nx + ny_N + 2 + N) * nx + N * ny + ny_N;
362 return {{
363 .data = storage.data() + offset,
364 .rows = N * ny + ny_N,
365 .cols = 1,
366 }};
367 }
368 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> b_max(index_t i) const {
369 auto [N, nx, nu, ny, ny_N] = dim;
370 assert(i <= N);
371 index_t size = ny;
372 return b_max().middle_rows(i * size, i < N ? size : ny_N);
373 }
374
375 struct Solution {
377
379 auto [N, nx, nu, ny, ny_N] = dim;
380 return {{.data = solution.data(), .rows = nx, .cols = N + 1, .outer_stride = nx + nu}};
381 }
383 auto [N, nx, nu, ny, ny_N] = dim;
384 return {{.data = solution.data(), .rows = nx, .cols = N + 1, .outer_stride = nx + nu}};
385 }
387 return x(dim).middle_cols(i, 1);
388 }
389 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> x(OCPDim dim, index_t i) const {
390 return x(dim).middle_cols(i, 1);
391 }
392
394 auto [N, nx, nu, ny, ny_N] = dim;
395 return {{.data = solution.data() + nx, .rows = nu, .cols = N, .outer_stride = nx + nu}};
396 }
398 auto [N, nx, nu, ny, ny_N] = dim;
399 return {{.data = solution.data() + nx, .rows = nu, .cols = N, .outer_stride = nx + nu}};
400 }
402 return u(dim).middle_cols(i, 1);
403 }
404 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> u(OCPDim dim, index_t i) const {
405 return u(dim).middle_cols(i, 1);
406 }
407
409 auto [N, nx, nu, ny, ny_N] = dim;
410 return {{.data = equality_multipliers.data(),
411 .rows = nx,
412 .cols = N + 1,
413 .outer_stride = nx}};
414 }
416 auto [N, nx, nu, ny, ny_N] = dim;
417 return {{.data = equality_multipliers.data(),
418 .rows = nx,
419 .cols = N + 1,
420 .outer_stride = nx}};
421 }
423 return λ(dim).middle_cols(i, 1);
424 }
425 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> λ(OCPDim dim, index_t i) const {
426 return λ(dim).middle_cols(i, 1);
427 }
428
430 auto [N, nx, nu, ny, ny_N] = dim;
431 return {{.data = inequality_multipliers.data() + i * ny,
432 .rows = i < N ? ny : ny_N,
433 .cols = 1}};
434 }
435 [[nodiscard]] guanaqo::MatrixView<const real_t, index_t> y(OCPDim dim, index_t i) const {
436 auto [N, nx, nu, ny, ny_N] = dim;
437 return {{.data = inequality_multipliers.data() + i * ny,
438 .rows = i < N ? ny : ny_N,
439 .cols = 1}};
440 }
441 };
442
446
447 [[nodiscard]] KKTError compute_kkt_error(const Solution &sol) const;
448};
449
450} // namespace cyqlone
guanaqo::MatrixView< real_t, index_t > u(OCPDim dim)
Definition ocp.hpp:393
std::vector< real_t > inequality_multipliers
Definition ocp.hpp:376
guanaqo::MatrixView< real_t, index_t > u(OCPDim dim, index_t i)
Definition ocp.hpp:401
guanaqo::MatrixView< const real_t, index_t > y(OCPDim dim, index_t i) const
Definition ocp.hpp:435
std::vector< real_t > solution
Definition ocp.hpp:376
guanaqo::MatrixView< real_t, index_t > x(OCPDim dim)
Definition ocp.hpp:378
guanaqo::MatrixView< real_t, index_t > y(OCPDim dim, index_t i)
Definition ocp.hpp:429
guanaqo::MatrixView< real_t, index_t > x(OCPDim dim, index_t i)
Definition ocp.hpp:386
guanaqo::MatrixView< const real_t, index_t > x(OCPDim dim) const
Definition ocp.hpp:382
guanaqo::MatrixView< const real_t, index_t > u(OCPDim dim) const
Definition ocp.hpp:397
guanaqo::MatrixView< real_t, index_t > λ(OCPDim dim, index_t i)
Definition ocp.hpp:422
std::vector< real_t > equality_multipliers
Definition ocp.hpp:376
guanaqo::MatrixView< real_t, index_t > λ(OCPDim dim)
Definition ocp.hpp:408
guanaqo::MatrixView< const real_t, index_t > x(OCPDim dim, index_t i) const
Definition ocp.hpp:389
guanaqo::MatrixView< const real_t, index_t > u(OCPDim dim, index_t i) const
Definition ocp.hpp:404
guanaqo::MatrixView< const real_t, index_t > λ(OCPDim dim) const
Definition ocp.hpp:415
guanaqo::MatrixView< const real_t, index_t > λ(OCPDim dim, index_t i) const
Definition ocp.hpp:425
Storage for a linear-quadratic OCP of the form.
Definition ocp.hpp:37
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 > qr(index_t i)
Definition ocp.hpp:234
std::vector< real_t > storage
Create a single contiguous storage for all problem data.
Definition ocp.hpp:57
guanaqo::MatrixView< const real_t, index_t > b_max(index_t i) const
Definition ocp.hpp:368
guanaqo::MatrixView< const real_t, index_t > A(index_t i) const
Definition ocp.hpp:201
guanaqo::MatrixView< real_t, index_t > B(index_t i)
Definition ocp.hpp:132
guanaqo::MatrixView< real_t, index_t > CD(index_t i)
Definition ocp.hpp:95
guanaqo::MatrixView< real_t, index_t > D(index_t i)
Definition ocp.hpp:111
guanaqo::MatrixView< real_t, index_t > b_min()
Definition ocp.hpp:267
KKTError compute_kkt_error(const Solution &sol) const
Definition ocp.cpp:10
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< const real_t, index_t > S(index_t i) const
Definition ocp.hpp:159
guanaqo::MatrixView< const real_t, index_t > CD(index_t i) const
Definition ocp.hpp:169
guanaqo::MatrixView< const real_t, index_t > q(index_t i) const
Definition ocp.hpp:315
guanaqo::MatrixView< real_t, index_t > H(index_t i)
Definition ocp.hpp:64
guanaqo::MatrixView< const real_t, index_t > H(index_t i) const
Definition ocp.hpp:138
guanaqo::MatrixView< const real_t, index_t > B(index_t i) const
Definition ocp.hpp:206
static std::vector< real_t > create_storage(OCPDim dim)
Definition ocp.hpp:58
guanaqo::MatrixView< const real_t, index_t > D(index_t i) const
Definition ocp.hpp:185
guanaqo::MatrixView< const real_t, index_t > b_min() const
Definition ocp.hpp:342
guanaqo::MatrixView< real_t, index_t > C(index_t i)
Definition ocp.hpp:106
guanaqo::MatrixView< real_t, index_t > S(index_t i)
Definition ocp.hpp:85
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
guanaqo::MatrixView< real_t, index_t > S_trans(index_t i)
Definition ocp.hpp:90
guanaqo::MatrixView< real_t, index_t > b_max()
Definition ocp.hpp:283
guanaqo::MatrixView< const real_t, index_t > b() const
Definition ocp.hpp:326
index_t num_constraints() const
Definition ocp.hpp:216
index_t num_dynamics_constraints() const
Definition ocp.hpp:220
guanaqo::MatrixView< real_t, index_t > b_min(index_t i)
Definition ocp.hpp:276
guanaqo::MatrixView< const real_t, index_t > S_trans(index_t i) const
Definition ocp.hpp:164
guanaqo::MatrixView< real_t, index_t > AB(index_t i)
Definition ocp.hpp:116
guanaqo::MatrixView< const real_t, index_t > C(index_t i) const
Definition ocp.hpp:180
guanaqo::MatrixView< const real_t, index_t > b_max() const
Definition ocp.hpp:358
guanaqo::MatrixView< const real_t, index_t > R(index_t i) const
Definition ocp.hpp:154
guanaqo::MatrixView< const real_t, index_t > qr(index_t i) const
Definition ocp.hpp:309
guanaqo::MatrixView< const real_t, index_t > r(index_t i) const
Definition ocp.hpp:320
index_t num_variables() const
Definition ocp.hpp:212
guanaqo::MatrixView< real_t, index_t > qr()
Definition ocp.hpp:225
guanaqo::MatrixView< real_t, index_t > b(index_t i)
Definition ocp.hpp:260
guanaqo::MatrixView< const real_t, index_t > b(index_t i) const
Definition ocp.hpp:335
guanaqo::MatrixView< const real_t, index_t > qr() const
Definition ocp.hpp:300
guanaqo::MatrixView< const real_t, index_t > AB(index_t i) const
Definition ocp.hpp:190
guanaqo::MatrixView< const real_t, index_t > b_min(index_t i) const
Definition ocp.hpp:351
guanaqo::MatrixView< real_t, index_t > b_max(index_t i)
Definition ocp.hpp:293
guanaqo::MatrixView< const real_t, index_t > Q(index_t i) const
Definition ocp.hpp:149
Dimensions of an optimal control problem.
Definition ocp.hpp:16
index_t ny
Number of output variables.
Definition ocp.hpp:20
index_t nu
Number of input variables.
Definition ocp.hpp:19
index_t ny_N
Number of output variables in the last stage.
Definition ocp.hpp:21
friend constexpr bool operator==(OCPDim, OCPDim)=default
index_t nx
Number of state variables.
Definition ocp.hpp:18
friend constexpr bool operator!=(OCPDim, OCPDim)=default
index_t N_horiz
Horizon length (one less than the number of stages).
Definition ocp.hpp:17