94 Scalar prec = std::numeric_limits<Scalar>::epsilon())
const;
124 assert(check_allocators());
148 this->G0 = std::move(other.G0);
149 this->g0 = std::move(other.g0);
150 this->stages = std::move(other.stages);
160 stages[i].addParameterization(nth);
174 !
g0.isApprox(other.
g0))
185 evaluate(
const VectorOfVectors &xs,
const VectorOfVectors &us,
186 const std::optional<ConstVectorRef> &theta)
const;
192 [[nodiscard]]
bool check_allocators()
const {
198template <
typename Scalar>
201 return (lhs.
nx == rhs.
nx) && (lhs.
nu == rhs.
nu) && (lhs.
nc == rhs.
nc) &&
205template <
typename Scalar>
208 oss << fmt::format(
"\n nx: {:d}", self.
nx)
209 << fmt::format(
"\n nu: {:d}", self.
nu)
210 << fmt::format(
"\n nc: {:d}", self.
nc);
212 oss << fmt::format(
"\n nth: {:d}", self.
nth);
239#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
240extern template struct LqrKnotTpl<context::Scalar>;
241extern template struct LqrProblemTpl<context::Scalar>;
allocator_type get_allocator() const noexcept
A convenience subclass of std::pmr::polymorphic_allocator for bytes.
std::ostream & operator<<(std::ostream &oss, const LqrKnotTpl< Scalar > &self)
bool lqrKnotsSameDim(const LqrKnotTpl< Scalar > &lhs, const LqrKnotTpl< Scalar > &rhs)
auto eigenPrintWithPreamble(const Eigen::EigenBase< D > &mat, const std::string &text, Eigen::IOFormat ft=EIGEN_DEFAULT_IO_FORMAT)
Struct describing a stage of a constrained LQ problem.
LqrKnotTpl(LqrKnotTpl &&other) noexcept
Move constructor. Allocator will be moved from other. Other will be have m_empty_after_move set to tr...
ArenaMatrix< MatrixXs > Gv
allocator_type get_allocator() const
LqrKnotTpl(LqrKnotTpl &&other, const allocator_type &alloc)
Extended move constructor.
void assign(const LqrKnotTpl< Scalar > &other)
Assign matrices (and dimensions) from another LqrKnotTpl.
static constexpr int Alignment
LqrKnotTpl(uint nx, uint nu, uint nc, uint nx2, uint nth, allocator_type alloc={})
friend bool operator==(const LqrKnotTpl &lhs, const LqrKnotTpl &rhs)
ArenaMatrix< MatrixXs > A
LqrKnotTpl(uint nx, uint nu, uint nc, allocator_type alloc={})
Delegating constructor, assumes nx2 = nx, and nth = 0.
LqrKnotTpl(const allocator_type &alloc)
ArenaMatrix< MatrixXs > D
bool isApprox(const LqrKnotTpl &other, Scalar prec=std::numeric_limits< Scalar >::epsilon()) const
LqrKnotTpl & operator=(LqrKnotTpl &&)
Move assignment. Other allocator will be stolen.
ArenaMatrix< MatrixXs > Q
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
ArenaMatrix< VectorXs > q
ArenaMatrix< MatrixXs > Gx
ArenaMatrix< MatrixXs > Gth
ArenaMatrix< MatrixXs > B
ArenaMatrix< MatrixXs > R
LqrKnotTpl & addParameterization(uint nth)
LqrKnotTpl(const LqrKnotTpl &other, allocator_type alloc={})
Copy constructor. Allocator must be given.
polymorphic_allocator allocator_type
ArenaMatrix< MatrixXs > S
ArenaMatrix< VectorXs > d
ArenaMatrix< VectorXs > gamma
ArenaMatrix< MatrixXs > Gu
ArenaMatrix< MatrixXs > C
ArenaMatrix< VectorXs > r
LqrKnotTpl & operator=(const LqrKnotTpl &other)
Copy assignment. Current allocator will be reused if required.
LqrKnotTpl(uint nx, uint nu, uint nc, uint nx2, allocator_type alloc={})
Delegating constructor, assumes nth = 0.
ArenaMatrix< VectorXs > f
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
LqrProblemTpl(const LqrProblemTpl &other, allocator_type alloc={})
Copy constructor. Will copy the allocator from other.
std::pmr::vector< KnotType > KnotVector
void addParameterization(uint nth)
allocator_type get_allocator() const
LqrProblemTpl(allocator_type alloc={})
ArenaMatrix< VectorXs > g0
LqrProblemTpl & operator=(LqrProblemTpl &&other)
LqrKnotTpl< Scalar > KnotType
Scalar evaluate(const VectorOfVectors &xs, const VectorOfVectors &us, const std::optional< ConstVectorRef > &theta) const
Evaluate the quadratic objective.
bool isInitialized() const
ArenaMatrix< MatrixXs > G0
bool isParameterized() const
polymorphic_allocator allocator_type
LqrProblemTpl(const KnotVector &knots, long nc0, allocator_type alloc={})
This constructor will take the knots as-is.
LqrProblemTpl(LqrProblemTpl &&other)
Move constructor - we steal the allocator from the source object.
static constexpr int Alignment
int horizon() const noexcept
uint nc0() const noexcept
Dimension of the initial condition constraint.
bool isApprox(const LqrProblemTpl &other)
LqrProblemTpl(KnotVector &&knots, long nc0)
This constructor will take the knots as-is, copying their specified allocator.