1#ifndef ROBOTOC_CONSTRAINT_COMPONENT_BASE_HPP_
2#define ROBOTOC_CONSTRAINT_COMPONENT_BASE_HPP_
45 const double fraction_to_boundary_rule=0.995);
228 const
double fraction_to_boundary_rule) final;
236 template <typename Derived>
256 const
int size) const;
267 const
int start) const;
277 const
double dual) const;
292 const
int start, const
int size);
315 const
double residual,
333 const
int start, const
int size);
356 const
double dslack, const
double cmpl);
363 template <typename VectorType>
364 double logBarrier(const Eigen::MatrixBase<VectorType>& slack) const;
367 double barrier_, fraction_to_boundary_rule_;
373#include "robotoc/constraints/constraint_component_base.hxx"
Base class for constraint components.
Definition: constraint_component_base.hpp:34
static void updateDual(ConstraintComponentData &data, const double step_size)
Updates the dual variable according to the step size.
Definition: constraint_component_base.hxx:32
virtual bool isFeasible(Robot &robot, const ContactStatus &contact_status, ConstraintComponentData &data, const SplitSolution &s) const =0
Checks whether the current solution s is feasible or not.
double logBarrier(const Eigen::MatrixBase< VectorType > &slack) const
Computes the log barrier function of the slack variable.
Definition: constraint_component_base.hxx:128
virtual void allocateExtraData(ConstraintComponentData &data) const =0
Allocates extra data in ConstraintComponentData.
virtual int dimc() const =0
Returns the size of the constraint.
ConstraintComponentBase & operator=(const ConstraintComponentBase &)=default
Default copy operator.
virtual double getFractionToBoundaryRule() const final
Gets the margin parameter of the fraction-to-boundary-rule.
void setSlackAndDualPositive(ConstraintComponentData &data) const
Sets the slack and dual variables positive.
static void computeDualDirection(ConstraintComponentData &data)
Computes the direction of the dual variable from slack, primal residual, complementary slackness,...
Definition: constraint_component_base.hxx:101
virtual KinematicsLevel kinematicsLevel() const =0
Checks the kinematics level of the constraint component.
virtual void expandSlackAndDual(const ContactStatus &contact_status, ConstraintComponentData &data, const SplitDirection &d) const =0
Expands the slack and dual, i.e., computes the directions of the slack and dual variables from the di...
void computeComplementarySlackness(ConstraintComponentData &data) const
Computes the residual in the complementarity slackness between the slack and dual variables.
Definition: constraint_component_base.hxx:50
std::shared_ptr< Derived > as_shared_ptr()
Gets the shared ptr of this object as the specified type. If this fails in dynamic casting,...
Definition: constraint_component_base.hxx:40
virtual ~ConstraintComponentBase()
Destructor.
Definition: constraint_component_base.hpp:50
ConstraintComponentBase(ConstraintComponentBase &&) noexcept=default
Default move constructor.
virtual void setBarrierParam(const double barrier_param) final
Sets the barrier parameter.
double maxDualStepSize(const ConstraintComponentData &data) const
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the direction of ...
Definition: constraint_component_base.hxx:19
ConstraintComponentBase(const double barrier_param=1.0e-03, const double fraction_to_boundary_rule=0.995)
Constructor.
static void updateSlack(ConstraintComponentData &data, const double step_size)
Updates the slack variable according to the step size.
Definition: constraint_component_base.hxx:25
virtual double getBarrierParam() const final
Gets the barrier parameter.
virtual void condenseSlackAndDual(const ContactStatus &contact_status, ConstraintComponentData &data, SplitKKTMatrix &kkt_matrix, SplitKKTResidual &kkt_residual) const =0
Condenses the slack and dual variables, i.e., factorizes the condensed Hessians and KKT residuals....
ConstraintComponentBase(const ConstraintComponentBase &)=default
Default copy constructor.
virtual void evalConstraint(Robot &robot, const ContactStatus &contact_status, ConstraintComponentData &data, const SplitSolution &s) const =0
Computes the primal residual, residual in the complementary slackness, and the log-barrier function o...
virtual void setSlack(Robot &robot, const ContactStatus &contact_status, ConstraintComponentData &data, const SplitSolution &s) const =0
Sets the slack variables of each constraint components.
virtual void setFractionToBoundaryRule(const double fraction_to_boundary_rule) final
Sets the margin parameter of the fraction-to-boundary-rule.
static void computeCondensingCoeffcient(ConstraintComponentData &data)
Computes the coefficient of the condensing.
Definition: constraint_component_base.hxx:75
virtual void evalDerivatives(Robot &robot, const ContactStatus &contact_status, ConstraintComponentData &data, const SplitSolution &s, SplitKKTResidual &kkt_residual) const =0
Computes the derivatives of the priaml residual, i.e., the Jacobian of the inequality constraint,...
double maxSlackStepSize(const ConstraintComponentData &data) const
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the direction of ...
Definition: constraint_component_base.hxx:13
Data used in constraint components. Composed by slack, dual (Lagrange multiplier),...
Definition: constraint_component_data.hpp:17
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Newton direction of the solution to the optimal control problem split into a time stage.
Definition: split_direction.hpp:20
The KKT matrix split into a time stage.
Definition: split_kkt_matrix.hpp:18
KKT residual split into each time stage.
Definition: split_kkt_residual.hpp:18
Solution to the optimal control problem split into a time stage.
Definition: split_solution.hpp:20
Definition: constraint_component_base.hpp:17
KinematicsLevel
Kinematics level of the constraint component used in ConstraintComponentBase.
Definition: constraint_component_base.hpp:24