43 #ifndef ILQGAMES_CONSTRAINT_AFFINE_SCALAR_CONSTRAINT_H 44 #define ILQGAMES_CONSTRAINT_AFFINE_SCALAR_CONSTRAINT_H 46 #include <ilqgames/constraint/time_invariant_constraint.h> 47 #include <ilqgames/utils/types.h> 49 #include <glog/logging.h> 59 const std::string& name =
"")
63 hess_of_sq_(a * a.transpose()) {}
66 float Evaluate(
const VectorXf& input)
const {
67 CHECK_EQ(a_.size(), input.size());
68 return a_.transpose() * input - b_;
73 void Quadraticize(Time t,
const VectorXf& input, MatrixXf* hess,
74 VectorXf* grad)
const {
77 CHECK_EQ(input.size(), a_.size());
78 CHECK_EQ(hess->rows(), input.size());
79 CHECK_EQ(hess->cols(), input.size());
80 CHECK_EQ(grad->size(), input.size());
83 const float lambda = Lambda(t);
84 const float mu = Mu(t, input);
87 (*grad) += lambda * a_ + mu * (hess_of_sq_ * input - b_ * a_);
88 (*hess) += mu * hess_of_sq_;
97 const MatrixXf hess_of_sq_;