5#include <proxsuite-nlp/manifold-base.hpp>
6#include <proxsuite-nlp/modelling/spaces/vector-space.hpp>
10template <
typename Scalar>
struct QuadraticCostDataTpl;
21 using VectorSpace = proxsuite::nlp::VectorSpaceTpl<Scalar, Eigen::Dynamic>;
22 using Manifold = proxsuite::nlp::ManifoldAbstractTpl<Scalar>;
54 const ConstMatrixRef &w_cross,
65 VectorXs::Zero(w_u.cols())) {}
68 const ConstMatrixRef &w_cross)
70 VectorXs::Zero(w_u.cols())) {}
72 void evaluate(
const ConstVectorRef &x,
const ConstVectorRef &u,
99 auto data = std::make_shared<Data>(this->
ndx(), this->
nu);
103 data->Lux_ =
Wxu_.transpose();
122 static void _check_dim_equal(
long n,
long m,
const std::string &msg =
"") {
128 void debug_check_dims()
const {
129 _check_dim_equal(
Wxx_.rows(),
Wxx_.cols(),
" for x weights");
130 _check_dim_equal(
Wuu_.rows(),
Wuu_.cols(),
" for u weights");
131 _check_dim_equal(
Wxu_.rows(), this->ndx(),
" for cross-term weight");
132 _check_dim_equal(
Wxu_.cols(), this->nu,
" for cross-term weight");
134 " for x weights and intercept");
136 " for u weights and intercept");
140template <
typename Scalar>
158#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
159#include "./quad-costs.txx"
#define ALIGATOR_RUNTIME_ERROR(...)
Stage costs for control problems.
Data struct for CostAbstractTpl.
QuadraticCostDataTpl(const int nx, const int nu)
typename Base::VectorXs VectorXs
Euclidean quadratic cost.
proxsuite::nlp::ManifoldAbstractTpl< Scalar > Manifold
VectorXs interp_x
Affine term in .
QuadraticCostTpl(const ConstMatrixRef &w_x, const ConstMatrixRef &w_u)
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
VectorXs interp_u
Affine term in .
void computeGradients(const ConstVectorRef &, const ConstVectorRef &, CostData &data) const
QuadraticCostTpl(const ConstMatrixRef &w_x, const ConstMatrixRef &w_u, const ConstMatrixRef &w_cross)
shared_ptr< CostData > createData() const
void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, CostData &data) const
MatrixXs Wxu_
Weight N for term .
bool has_cross_term_
Whether a cross term exists.
ConstMatrixRef getCrossWeights() const
bool hasCrossTerm() const
Whether a cross term exists.
QuadraticCostTpl(const ConstMatrixRef &w_x, const ConstMatrixRef &w_u, const ConstVectorRef &interp_x, const ConstVectorRef &interp_u)
static auto get_vector_space(Eigen::Index nx)
proxsuite::nlp::VectorSpaceTpl< Scalar, Eigen::Dynamic > VectorSpace
void computeHessians(const ConstVectorRef &, const ConstVectorRef &, CostData &) const
void setCrossWeight(const ConstMatrixRef &w)
QuadraticCostTpl(const ConstMatrixRef &w_x, const ConstMatrixRef &w_u, const ConstMatrixRef &w_cross, const ConstVectorRef &interp_x, const ConstVectorRef &interp_u)