rsLQR  0.1
NdLqrSolver Struct Reference

Main solver for rsLQR. More...

#include <solver.h>

Data Fields

int nstates
 size of state vector
 
int ninputs
 number of control inputs
 
int nhorizon
 length of the time horizon
 
int depth
 depth of the binary tree
 
int nvars
 number of decision variables (size of the linear system)
 
OrderedBinaryTree tree
 
Matrixdiagonals
 (nhorizon,2) array of diagonal blocks (Q,R)
 
NdDatadata
 original matrix data
 
NdDatafact
 factorization
 
NdDatasoln
 solution vector (also the initial RHS)
 
NdLqrCholeskyFactorscholfacts
 
double solve_time_ms
 total solve time in milliseconds.
 
double linalg_time_ms
 
NdLqrProfile profile
 
int num_threads
 Number of threads used by the solver.
 

Detailed Description

Main solver for rsLQR.

Core struct for solving problems with rsLQR. Allocates all the required memory up front to avoid any dynamic memory allocations at runtime. Right now, the horizon length is required to be a power of 2 (e.g. 32,64,128,256,etc.).

Construction and destruction

Use ndlqr_NewNdLqrSolver() to initialize a new solver. This should always be paired with a single call to ndlqr_FreeNdLqrSolver().

Typical Usage

LQRProblem* lqrprob = ndlqr_ReadTestLQRProblem(); // your data here
int nstates = lqrprob->lqrdata[0]->nstates;
int ninputs = lqrprob->lqrdata[0]->ninputs;
int nhorizon = lqrprob->nhorizon;
ndlqr_Solve(solver);

Methods


The documentation for this struct was generated from the following file:
NdLqrSolver::nhorizon
int nhorizon
length of the time horizon
Definition: solver.h:117
NdLqrSolver::ninputs
int ninputs
number of control inputs
Definition: solver.h:116
ndlqr_FreeLQRProblem
int ndlqr_FreeLQRProblem(LQRProblem *lqrprob)
Free the data stored by and LQRProblem.
Definition: lqr_problem.c:38
NdLqrSolver
Main solver for rsLQR.
Definition: solver.h:114
NdLqrSolver::nstates
int nstates
size of state vector
Definition: solver.h:115
ndlqr_InitializeWithLQRProblem
int ndlqr_InitializeWithLQRProblem(const LQRProblem *lqrprob, NdLqrSolver *solver)
Initialize the solver with data from an LQR Problem.
Definition: solver.c:122
ndlqr_Solve
int ndlqr_Solve(NdLqrSolver *solver)
Solve an LQR problem using rsLQR.
Definition: solve.c:38
ndlqr_PrintSolveSummary
void ndlqr_PrintSolveSummary(NdLqrSolver *solver)
Prints a summary of the solve.
Definition: solver.c:196
ndlqr_NewNdLqrSolver
NdLqrSolver * ndlqr_NewNdLqrSolver(int nstates, int ninputs, int nhorizon)
Create a new solver, allocating all the required memory.
Definition: solver.c:61
LQRProblem
Describes an LQR problem with affine terms.
Definition: lqr_problem.h:31
ndlqr_FreeNdLqrSolver
int ndlqr_FreeNdLqrSolver(NdLqrSolver *solver)
Deallocates the memory for the solver.
Definition: solver.c:108