rsLQR  0.1
riccati_solver.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 #include "lqr_problem.h"
16 #include "matrix.h"
17 
62 typedef struct {
63  // clang-format off
65  int nhorizon;
66  int nstates;
67  int ninputs;
68  int nvars;
69  double* data;
70  Matrix* K;
71  Matrix* d;
72  Matrix* P;
73  Matrix* p;
74  Matrix* X;
75  Matrix* U;
76  Matrix* Y;
82  double t_solve_ms;
85  // clang-format on
87 
97 
106 
125 
147 
148 int ndlqr_GetNumVarsRiccati(RiccatiSolver* solver);
149 
161 int ndlqr_CopyRiccatiSolution(RiccatiSolver* solver, double* soln);
162 
175 int ndlqr_GetRiccatiSolveTimes(RiccatiSolver* solver, double* t_solve, double* t_bp,
176  double* t_fp);
177 
RiccatiSolver::Qu
Matrix * Qu
Gradient of the action-value function with respect to the control. N vectors of size (m,...
Definition: riccati_solver.h:78
RiccatiSolver::data
double * data
pointer to the beginning of the single block of memory allocated by the solver
Definition: riccati_solver.h:69
ndlqr_PrintRiccatiSummary
int ndlqr_PrintRiccatiSummary(RiccatiSolver *solver)
Prints a summary of the solve.
Definition: riccati_solver.c:155
RiccatiSolver::U
Matrix * U
Control trajectory. N-1 vectors of size (m,)
Definition: riccati_solver.h:75
ndlqr_FreeRiccatiSolver
int ndlqr_FreeRiccatiSolver(RiccatiSolver *solver)
Free the memory for a Riccati solver.
Definition: riccati_solver.c:139
RiccatiSolver::X
Matrix * X
State trajectory. N vectors of size (n,)
Definition: riccati_solver.h:74
ndlqr_GetRiccatiSolution
Matrix ndlqr_GetRiccatiSolution(RiccatiSolver *solver)
Get the solution vector.
Definition: riccati_solver.c:167
RiccatiSolver::nstates
int nstates
size of state vector (n)
Definition: riccati_solver.h:66
RiccatiSolver::prob
LQRProblem * prob
Problem data.
Definition: riccati_solver.h:64
ndlqr_CopyRiccatiSolution
int ndlqr_CopyRiccatiSolution(RiccatiSolver *solver, double *soln)
Copies the solution to a user-supplied array.
Definition: riccati_solver.c:181
RiccatiSolver
Solver that uses Riccati recursion to solve an LQR problem.
Definition: riccati_solver.h:62
lqr_problem.h
Defines the LQRProblem type.
RiccatiSolver::t_solve_ms
double t_solve_ms
Total solve time in milliseconds.
Definition: riccati_solver.h:82
matrix.h
Matrix type and basic operations.
RiccatiSolver::t_backward_pass_ms
double t_backward_pass_ms
Time spent in the backward pass in milliseconds.
Definition: riccati_solver.h:83
RiccatiSolver::nvars
int nvars
total number of decision variables, including the dual variables
Definition: riccati_solver.h:68
Matrix
Represents a matrix of double-precision data.
Definition: matrix.h:71
ndlqr_GetRiccatiSolveTimes
int ndlqr_GetRiccatiSolveTimes(RiccatiSolver *solver, double *t_solve, double *t_bp, double *t_fp)
Get the Riccati solve times.
Definition: riccati_solver.c:187
RiccatiSolver::Qux
Matrix * Qux
Cross-term Hessian of the action-value function. N vectors of size (m,n).
Definition: riccati_solver.h:80
RiccatiSolver::ninputs
int ninputs
number of control inputs (m)
Definition: riccati_solver.h:67
RiccatiSolver::Y
Matrix * Y
Lagrange multipliers. N vectors of size (n,)
Definition: riccati_solver.h:76
RiccatiSolver::Qxx
Matrix * Qxx
Hessian of the action-value function with respect to the state. N vectors of size (n,...
Definition: riccati_solver.h:79
RiccatiSolver::Quu
Matrix * Quu
Hessian of the action-value function with respect to the control. N vectors of size (m,...
Definition: riccati_solver.h:81
RiccatiSolver::Qx
Matrix * Qx
Gradient of the action-value function with respect to the state. N vectors of size (n,...
Definition: riccati_solver.h:77
RiccatiSolver::t_forward_pass_ms
double t_forward_pass_ms
Time spent in the forward pass in milliseconds.
Definition: riccati_solver.h:84
RiccatiSolver::d
Matrix * d
N-1 feedforward gains of size (m,)
Definition: riccati_solver.h:71
RiccatiSolver::nhorizon
int nhorizon
length of the time horizon
Definition: riccati_solver.h:65
RiccatiSolver::p
Matrix * p
N cost-to-go gradients of size (n,)
Definition: riccati_solver.h:73
RiccatiSolver::K
Matrix * K
N-1 feedback gain matrices of size (m,n)
Definition: riccati_solver.h:70
RiccatiSolver::P
Matrix * P
N cost-to-go Hessians of size (n,n)
Definition: riccati_solver.h:72
LQRProblem
Describes an LQR problem with affine terms.
Definition: lqr_problem.h:31
ndlqr_NewRiccatiSolver
RiccatiSolver * ndlqr_NewRiccatiSolver(LQRProblem *lqrprob)
Initialize a new Riccati solver.
Definition: riccati_solver.c:7