1#ifndef ROBOTOC_IMPACT_CONSTRAINT_COMPONENT_BASE_HXX_
2#define ROBOTOC_IMPACT_CONSTRAINT_COMPONENT_BASE_HXX_
26 assert(step_size > 0);
33 assert(step_size > 0);
34 data.
dual.noalias() += step_size * data.
ddual;
38template <
typename Derived>
40 auto ptr = shared_from_this();
41 auto derived_ptr = std::dynamic_pointer_cast<Derived>(ptr);
42 if (derived_ptr ==
nullptr) {
43 throw std::runtime_error(
"[ImpactConstraintComponentBase] runtime error: failed in down-casting!");
64 pdipm::computeComplementarySlackness<Size>(barrier_, data, start);
69 const double slack,
const double dual)
const {
89 pdipm::computeCondensingCoeffcient<Size>(data, start);
94 const double slack,
const double dual,
const double residual,
115 pdipm::computeDualDirection<Size>(data, start);
120 const double slack,
const double dual,
const double dslack,
122 return (- (dual * dslack + cmpl) / slack);
126template <
typename VectorType>
128 const Eigen::MatrixBase<VectorType>& slack)
const {
Data used in constraint components. Composed by slack, dual (Lagrange multiplier),...
Definition: constraint_component_data.hpp:17
Eigen::VectorXd ddual
Newton direction of the dual. Size is ConstraintComponentData::dimc().
Definition: constraint_component_data.hpp:91
Eigen::VectorXd dslack
Newton direction of the slack. Size is ConstraintComponentData::dimc().
Definition: constraint_component_data.hpp:85
Eigen::VectorXd slack
Slack variable of the constraint. Size is ConstraintComponentData::dimc(). All elements must be posit...
Definition: constraint_component_data.hpp:61
Eigen::VectorXd dual
Dual variable (Lagrange multiplier) of the constraint. Size is ConstraintComponentData::dimc()....
Definition: constraint_component_data.hpp:67
static void computeDualDirection(ConstraintComponentData &data)
Computes the direction of the dual variable from slack, primal residual, complementarity slackness,...
Definition: impact_constraint_component_base.hxx:100
static void computeCondensingCoeffcient(ConstraintComponentData &data)
Computes the coefficient of the condensing.
Definition: impact_constraint_component_base.hxx:74
double maxSlackStepSize(const ConstraintComponentData &data) const
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the direction of ...
Definition: impact_constraint_component_base.hxx:12
void computeComplementarySlackness(ConstraintComponentData &data) const
Computes the residual in the complementarity slackness between the slack and dual variables.
Definition: impact_constraint_component_base.hxx:49
double logBarrier(const Eigen::MatrixBase< VectorType > &slack) const
Computes the log barrier function of the slack variable.
Definition: impact_constraint_component_base.hxx:127
double maxDualStepSize(const ConstraintComponentData &data) const
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the direction of ...
Definition: impact_constraint_component_base.hxx:18
static void updateSlack(ConstraintComponentData &data, const double step_size)
Updates the slack variable according to the step size.
Definition: impact_constraint_component_base.hxx:24
static void updateDual(ConstraintComponentData &data, const double step_size)
Updates the dual variable according to the step size.
Definition: impact_constraint_component_base.hxx:31
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: impact_constraint_component_base.hxx:39
void computeCondensingCoeffcient(ConstraintComponentData &data)
Computes the coefficient of the condensing.
Definition: pdipm.hxx:66
void computeComplementarySlackness(const double barrier_param, ConstraintComponentData &data)
Computes the residual in the complementarity slackness between the slack and dual variables.
Definition: pdipm.hxx:27
void computeDualDirection(ConstraintComponentData &data)
Computes the direction of the dual variable from slack, primal residual, complementary slackness,...
Definition: pdipm.hxx:159
double fractionToBoundaryDual(const double fraction_rate, const ConstraintComponentData &data)
Applies the fraction-to-boundary-rule to the directions of the dual variables.
Definition: pdipm.hxx:112
double fractionToBoundarySlack(const double fraction_rate, const ConstraintComponentData &data)
Applies the fraction-to-boundary-rule to the directions of the slack variables.
Definition: pdipm.hxx:103
double logBarrier(const double barrier_param, const Eigen::MatrixBase< VectorType > &vec)
Computes the log barrier function.
Definition: pdipm.hxx:195
Definition: constraint_component_base.hpp:17