1#ifndef ROBOTOC_CONSTRAINT_COMPONENT_BASE_HXX_
2#define ROBOTOC_CONSTRAINT_COMPONENT_BASE_HXX_
26 const double step_size) {
27 assert(step_size > 0);
33 const double step_size) {
34 assert(step_size > 0);
35 data.
dual.noalias() += step_size * data.
ddual;
39template <
typename Derived>
41 auto ptr = shared_from_this();
42 auto derived_ptr = std::dynamic_pointer_cast<Derived>(ptr);
43 if (derived_ptr ==
nullptr) {
44 throw std::runtime_error(
"[ConstraintComponentBase] runtime error: failed in down-casting!");
65 pdipm::computeComplementarySlackness<Size>(barrier_, data, start);
70 const double slack,
const double dual)
const {
90 pdipm::computeCondensingCoeffcient<Size>(data, start);
95 const double slack,
const double dual,
const double residual,
116 pdipm::computeDualDirection<Size>(data, start);
121 const double slack,
const double dual,
const double dslack,
127template <
typename VectorType>
129 const Eigen::MatrixBase<VectorType>& slack)
const {
static void updateDual(ConstraintComponentData &data, const double step_size)
Updates the dual variable according to the step size.
Definition: constraint_component_base.hxx:32
double logBarrier(const Eigen::MatrixBase< VectorType > &slack) const
Computes the log barrier function of the slack variable.
Definition: constraint_component_base.hxx:128
static void computeDualDirection(ConstraintComponentData &data)
Computes the direction of the dual variable from slack, primal residual, complementary slackness,...
Definition: constraint_component_base.hxx:101
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
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
static void updateSlack(ConstraintComponentData &data, const double step_size)
Updates the slack variable according to the step size.
Definition: constraint_component_base.hxx:25
static void computeCondensingCoeffcient(ConstraintComponentData &data)
Computes the coefficient of the condensing.
Definition: constraint_component_base.hxx:75
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
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
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