aligator  0.9.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
cholmod-solver.hpp
Go to the documentation of this file.
1
3#pragma once
4
5#ifdef ALIGATOR_WITH_CHOLMOD
6#include <Eigen/CholmodSupport>
7
8#include "lqr-problem.hpp"
10
11namespace aligator::gar {
12
14template <typename _Scalar> class CholmodLqSolver {
15public:
16 using Scalar = _Scalar;
18 using Problem = LQRProblemTpl<Scalar>;
19 using SparseType = Eigen::SparseMatrix<Scalar>;
20 using Triplet = Eigen::Triplet<Scalar>;
21
22 explicit CholmodLqSolver(const Problem &problem, uint numRefinementSteps = 1);
23
24 bool backward(const Scalar mudyn, const Scalar mueq);
25
26 bool forward(std::vector<VectorXs> &xs, std::vector<VectorXs> &us,
27 std::vector<VectorXs> &vs, std::vector<VectorXs> &lbdas) const;
28
29 inline Scalar computeSparseResidual() const {
30 kktResidual = kktRhs;
31 kktResidual.noalias() += kktMatrix * kktSol;
32 return math::infty_norm(kktResidual);
33 }
34
36 SparseType kktMatrix;
38 VectorXs kktRhs;
40 mutable VectorXs kktResidual;
42 mutable VectorXs kktSol;
43 Eigen::CholmodSimplicialLDLT<SparseType> cholmod;
45 uint numRefinementSteps;
46
47protected:
48 const Problem *problem_;
49};
50
51#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
52extern template class CholmodLqSolver<context::Scalar>;
53#endif
54
55} // namespace aligator::gar
56#endif
#define ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
Definition math.hpp:8
unsigned int uint
Definition logger.hpp:10