aligator  0.16.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Loading...
Searching...
No Matches
aligator::gar::ParallelRiccatiSolver< _Scalar > Class Template Reference

A parallel-condensing LQ solver. More...

#include <aligator/gar/parallel-solver.hpp>

Inheritance diagram for aligator::gar::ParallelRiccatiSolver< _Scalar >:
[legend]
Collaboration diagram for aligator::gar::ParallelRiccatiSolver< _Scalar >:
[legend]

Classes

struct  CondensedKkt
 

Public Types

using Scalar = _Scalar
 
using Base = RiccatiSolverBase<Scalar>
 
using Kernel = ProximalRiccatiKernel<Scalar>
 
using KnotType = LqrKnotTpl<Scalar>
 
using BlkView = BlkMatrix<VectorRef, -1, 1>
 
using allocator_type = ::aligator::polymorphic_allocator
 
- Public Types inherited from aligator::gar::RiccatiSolverBase< _Scalar >
using Scalar = _Scalar
 
using LqrKnot = LqrKnotTpl<Scalar>
 

Public Member Functions

 ALIGATOR_DYNAMIC_TYPEDEFS_WITH_ROW_TYPES (Scalar)
 
 ParallelRiccatiSolver (LqrProblemTpl< Scalar > &problem, const uint num_threads)
 
bool backward (const Scalar mueq) override
 
void collapseFeedback () override
 
void assembleCondensedSystem (const Scalar mudyn)
 Create the sparse representation of the reduced KKT system.
 
bool forward (VectorOfVectors &xs, VectorOfVectors &us, VectorOfVectors &vs, VectorOfVectors &lbdas, const std::optional< ConstVectorRef > &=std::nullopt) const override
 
void cycleAppend (const KnotType &knot) override
 Cycle the solver data, given the specs from a given new knot.
 
VectorRef getFeedforward (size_t i) override
 
RowMatrixRef getFeedback (size_t i) override
 
allocator_type get_allocator () const
 
uint getNumThreads () const noexcept
 Number of parallel divisions in the problem: \(J+1\) in the math.
 
void initializeTridiagSystem ()
 Initialize the buffers for the block-tridiagonal system.
 
- Public Member Functions inherited from aligator::gar::RiccatiSolverBase< _Scalar >
 ALIGATOR_DYNAMIC_TYPEDEFS_WITH_ROW_TYPES (Scalar)
 
virtual bool forward (std::vector< VectorXs > &xs, std::vector< VectorXs > &us, std::vector< VectorXs > &vs, std::vector< VectorXs > &lbdas, const std::optional< ConstVectorRef > &theta_=std::nullopt) const =0
 
virtual ~RiccatiSolverBase ()=default
 

Public Attributes

std::pmr::vector< StageFactor< Scalar > > datas
 
CondensedKkt condensedKktSystem
 Block-sparse condensed KKT system.
 
ArenaMatrix< VectorXs > condensedKktRhs
 Contains the right-hand side and solution of the condensed KKT system.
 
ArenaMatrix< VectorXs > condensedKktSolution
 
ArenaMatrix< VectorXs > condensedErr
 
Scalar condensedThreshold = 1e-10
 Tolerance on condensed KKT system.
 
uint maxRefinementSteps = 5u
 Max number of refinement steps (condensed solver)
 

Protected Member Functions

void initialize ()
 

Protected Attributes

uint numThreads
 
LqrProblemTpl< Scalar > * problem_
 
std::vector< long > rhsDims_
 

Detailed Description

template<typename _Scalar>
class aligator::gar::ParallelRiccatiSolver< _Scalar >

A parallel-condensing LQ solver.

This solver condenses the problem into a reduced saddle-point problem in a subset of the states and costates, corresponding to the time indices where the problem was split up. These splitting variables are used to exploit the problem's partially-separable structure: each "leg" is then condensed into its value function with respect to both its initial state and last costate (linking to the next leg). The saddle-point is cast into a linear system which is solved by dense LDL factorization. This allows parallel resolution of a (long) linear subproblem on multiple CPU cores.

Definition at line 26 of file parallel-solver.hpp.

Member Typedef Documentation

◆ Scalar

template<typename _Scalar>
using aligator::gar::ParallelRiccatiSolver< _Scalar >::Scalar = _Scalar

Definition at line 28 of file parallel-solver.hpp.

◆ Base

template<typename _Scalar>
using aligator::gar::ParallelRiccatiSolver< _Scalar >::Base = RiccatiSolverBase<Scalar>

Definition at line 30 of file parallel-solver.hpp.

◆ Kernel

template<typename _Scalar>
using aligator::gar::ParallelRiccatiSolver< _Scalar >::Kernel = ProximalRiccatiKernel<Scalar>

Definition at line 31 of file parallel-solver.hpp.

◆ KnotType

template<typename _Scalar>
using aligator::gar::ParallelRiccatiSolver< _Scalar >::KnotType = LqrKnotTpl<Scalar>

Definition at line 32 of file parallel-solver.hpp.

◆ BlkView

template<typename _Scalar>
using aligator::gar::ParallelRiccatiSolver< _Scalar >::BlkView = BlkMatrix<VectorRef, -1, 1>

Definition at line 33 of file parallel-solver.hpp.

◆ allocator_type

template<typename _Scalar>
using aligator::gar::ParallelRiccatiSolver< _Scalar >::allocator_type = ::aligator::polymorphic_allocator

Definition at line 34 of file parallel-solver.hpp.

Constructor & Destructor Documentation

◆ ParallelRiccatiSolver()

template<typename _Scalar>
aligator::gar::ParallelRiccatiSolver< _Scalar >::ParallelRiccatiSolver ( LqrProblemTpl< Scalar > & problem,
const uint num_threads )
explicit

Member Function Documentation

◆ ALIGATOR_DYNAMIC_TYPEDEFS_WITH_ROW_TYPES()

template<typename _Scalar>
aligator::gar::ParallelRiccatiSolver< _Scalar >::ALIGATOR_DYNAMIC_TYPEDEFS_WITH_ROW_TYPES ( Scalar )

◆ backward()

template<typename _Scalar>
bool aligator::gar::ParallelRiccatiSolver< _Scalar >::backward ( const Scalar mueq)
overridevirtual

◆ collapseFeedback()

template<typename _Scalar>
void aligator::gar::ParallelRiccatiSolver< _Scalar >::collapseFeedback ( )
inlineoverridevirtual

For applicable solvers, updates the first feedback gain in-place to correspond to the first Riccati gain.

See also
aligator::gar::ParallelRiccatiSolver for a non-trivial implementation.

Reimplemented from aligator::gar::RiccatiSolverBase< _Scalar >.

Definition at line 41 of file parallel-solver.hpp.

◆ assembleCondensedSystem()

template<typename _Scalar>
void aligator::gar::ParallelRiccatiSolver< _Scalar >::assembleCondensedSystem ( const Scalar mudyn)

Create the sparse representation of the reduced KKT system.

◆ forward()

template<typename _Scalar>
bool aligator::gar::ParallelRiccatiSolver< _Scalar >::forward ( VectorOfVectors & xs,
VectorOfVectors & us,
VectorOfVectors & vs,
VectorOfVectors & lbdas,
const std::optional< ConstVectorRef > & = std::nullopt ) const
override

◆ cycleAppend()

template<typename _Scalar>
void aligator::gar::ParallelRiccatiSolver< _Scalar >::cycleAppend ( const KnotType & knot)
overridevirtual

Cycle the solver data, given the specs from a given new knot.

Implements aligator::gar::RiccatiSolverBase< _Scalar >.

◆ getFeedforward()

template<typename _Scalar>
VectorRef aligator::gar::ParallelRiccatiSolver< _Scalar >::getFeedforward ( size_t i)
inlineoverridevirtual

Implements aligator::gar::RiccatiSolverBase< _Scalar >.

Definition at line 80 of file parallel-solver.hpp.

◆ getFeedback()

template<typename _Scalar>
RowMatrixRef aligator::gar::ParallelRiccatiSolver< _Scalar >::getFeedback ( size_t i)
inlineoverridevirtual

Implements aligator::gar::RiccatiSolverBase< _Scalar >.

Definition at line 81 of file parallel-solver.hpp.

◆ get_allocator()

template<typename _Scalar>
allocator_type aligator::gar::ParallelRiccatiSolver< _Scalar >::get_allocator ( ) const
inline

Definition at line 83 of file parallel-solver.hpp.

◆ getNumThreads()

template<typename _Scalar>
uint aligator::gar::ParallelRiccatiSolver< _Scalar >::getNumThreads ( ) const
inlinenoexcept

Number of parallel divisions in the problem: \(J+1\) in the math.

Definition at line 97 of file parallel-solver.hpp.

◆ initializeTridiagSystem()

template<typename _Scalar>
void aligator::gar::ParallelRiccatiSolver< _Scalar >::initializeTridiagSystem ( )

Initialize the buffers for the block-tridiagonal system.

◆ initialize()

template<typename _Scalar>
void aligator::gar::ParallelRiccatiSolver< _Scalar >::initialize ( )
protected

Member Data Documentation

◆ datas

template<typename _Scalar>
std::pmr::vector<StageFactor<Scalar> > aligator::gar::ParallelRiccatiSolver< _Scalar >::datas

Definition at line 85 of file parallel-solver.hpp.

◆ condensedKktSystem

template<typename _Scalar>
CondensedKkt aligator::gar::ParallelRiccatiSolver< _Scalar >::condensedKktSystem

Block-sparse condensed KKT system.

Definition at line 88 of file parallel-solver.hpp.

◆ condensedKktRhs

template<typename _Scalar>
ArenaMatrix<VectorXs> aligator::gar::ParallelRiccatiSolver< _Scalar >::condensedKktRhs

Contains the right-hand side and solution of the condensed KKT system.

Definition at line 90 of file parallel-solver.hpp.

◆ condensedKktSolution

template<typename _Scalar>
ArenaMatrix<VectorXs> aligator::gar::ParallelRiccatiSolver< _Scalar >::condensedKktSolution

Definition at line 90 of file parallel-solver.hpp.

◆ condensedErr

template<typename _Scalar>
ArenaMatrix<VectorXs> aligator::gar::ParallelRiccatiSolver< _Scalar >::condensedErr

Definition at line 90 of file parallel-solver.hpp.

◆ condensedThreshold

template<typename _Scalar>
Scalar aligator::gar::ParallelRiccatiSolver< _Scalar >::condensedThreshold = 1e-10

Tolerance on condensed KKT system.

Definition at line 92 of file parallel-solver.hpp.

◆ maxRefinementSteps

template<typename _Scalar>
uint aligator::gar::ParallelRiccatiSolver< _Scalar >::maxRefinementSteps = 5u

Max number of refinement steps (condensed solver)

Definition at line 94 of file parallel-solver.hpp.

◆ numThreads

template<typename _Scalar>
uint aligator::gar::ParallelRiccatiSolver< _Scalar >::numThreads
protected

Definition at line 103 of file parallel-solver.hpp.

◆ problem_

template<typename _Scalar>
LqrProblemTpl<Scalar>* aligator::gar::ParallelRiccatiSolver< _Scalar >::problem_
protected

Definition at line 104 of file parallel-solver.hpp.

◆ rhsDims_

template<typename _Scalar>
std::vector<long> aligator::gar::ParallelRiccatiSolver< _Scalar >::rhsDims_
protected

Definition at line 105 of file parallel-solver.hpp.


The documentation for this class was generated from the following file: