robotoc
robotoc - efficient ROBOT Optimal Control solvers
|
Constraints of the switching time optimization problems. More...
#include <sto_constraints.hpp>
Public Member Functions | |
STOConstraints (const int num_switches, const double minimum_dwell_time=std::sqrt(std::numeric_limits< double >::epsilon()), const double barrier_param=1.0e-03, const double fraction_to_boundary_rule=0.995) | |
Constructor. More... | |
STOConstraints (const std::vector< double > &minimum_dwell_times, const double barrier_param=1.0e-03, const double fraction_to_boundary_rule=0.995) | |
Constructor. More... | |
STOConstraints (const Eigen::VectorXd &minimum_dwell_times, const double barrier_param=1.0e-03, const double fraction_to_boundary_rule=0.995) | |
Constructor. More... | |
STOConstraints () | |
Default constructor. More... | |
~STOConstraints ()=default | |
Default destructor. More... | |
STOConstraints (const STOConstraints &)=default | |
Default copy constructor. More... | |
STOConstraints & | operator= (const STOConstraints &)=default |
Default copy operator. More... | |
STOConstraints (STOConstraints &&) noexcept=default | |
Default move constructor. More... | |
STOConstraints & | operator= (STOConstraints &&) noexcept=default |
Default move assign operator. More... | |
void | setMinimumDwellTimes (const double minimum_dwell_time=std::sqrt(std::numeric_limits< double >::epsilon())) |
Sets the minimum dwell times. More... | |
void | setMinimumDwellTimes (const std::vector< double > &minimum_dwell_times) |
Sets the minimum dwell times. More... | |
void | setMinimumDwellTimes (const Eigen::VectorXd &minimum_dwell_times) |
Sets the minimum dwell times. More... | |
const Eigen::VectorXd & | getMinimumDwellTimes () const |
Gets the minimum dwell times. More... | |
void | setBarrierParam (const double barrier_param) |
Sets the barrier parameter for all the constraint components. More... | |
void | setFractionToBoundaryRule (const double fraction_to_boundary_rule) |
Sets the parameter of the fraction-to-boundary-rule for all the constraint components. More... | |
double | getBarrierParam () const |
Gets the barrier parameter. More... | |
double | getFractionToBoundaryRule () const |
Gets the parameter of the fraction-to-boundary-rule. More... | |
ConstraintComponentData | createConstraintsData (const TimeDiscretization &time_discretization) const |
Creates the data for this constraints. More... | |
bool | isFeasible (const TimeDiscretization &time_discretization, ConstraintComponentData &data) const |
Checks whether the current split solution s is feasible or not. More... | |
void | setSlackAndDual (const TimeDiscretization &time_discretization, ConstraintComponentData &data) const |
Sets the slack and dual variables of constraints. More... | |
void | evalConstraint (const TimeDiscretization &time_discretization, ConstraintComponentData &data) const |
Computes the primal residual, residual in the complementary slackness, and the log-barrier function of the slack varible. More... | |
void | linearizeConstraints (const TimeDiscretization &time_discretization, ConstraintComponentData &data, Eigen::VectorXd <) const |
Evaluates the constraints (i.e., calls evalConstraint()) and adds the products of the Jacobian of the constraints and Lagrange multipliers. More... | |
void | condenseSlackAndDual (ConstraintComponentData &data, Eigen::VectorXd <, Eigen::MatrixXd &Qtt) const |
Condenses the slack and dual variables. linearizeConstraints() must be called before this function. More... | |
void | expandSlackAndDual (ConstraintComponentData &data, Eigen::VectorXd &dts) const |
Expands the slack and dual, i.e., computes the directions of the slack and dual variables from the directions of the primal variables. More... | |
double | maxSlackStepSize (const ConstraintComponentData &data) const |
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the directions of the slack variables. More... | |
double | maxDualStepSize (const ConstraintComponentData &data) const |
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the directions of the dual variables. More... | |
void | updateSlack (ConstraintComponentData &data, const double step_size) const |
Updates the slack variables according to step_size. More... | |
void | updateDual (ConstraintComponentData &data, const double step_size) const |
Updates the dual variables according to step_size. More... | |
Static Public Member Functions | |
static void | computeDwellTimes (const TimeDiscretization &time_discretization, Eigen::VectorXd &dwell_times) |
Computes the dwell times from the given time discretization. More... | |
Constraints of the switching time optimization problems.
robotoc::STOConstraints::STOConstraints | ( | const int | num_switches, |
const double | minimum_dwell_time = std::sqrt(std::numeric_limits< double >::epsilon()) , |
||
const double | barrier_param = 1.0e-03 , |
||
const double | fraction_to_boundary_rule = 0.995 |
||
) |
Constructor.
[in] | num_switches | The number of switches. |
[in] | minimum_dwell_time | Minimum dwell time. Must be non-negative. The all minimum dwell times are set to this value. Default is std::sqrt(std::numeric_limits<double>::epsilon()). |
[in] | barrier_param | Barrier parameter. Must be positive. Should be small. Default is 1.0e-03. |
[in] | fraction_to_boundary_rule | Parameter of the fraction-to-boundary-rule Must be larger than 0 and smaller than 1. Should be between 0.9 and 0.995. Default is 0.995. |
robotoc::STOConstraints::STOConstraints | ( | const std::vector< double > & | minimum_dwell_times, |
const double | barrier_param = 1.0e-03 , |
||
const double | fraction_to_boundary_rule = 0.995 |
||
) |
Constructor.
[in] | minimum_dwell_times | Minimum dwell times. Each component must be non-negative. |
[in] | barrier_param | Barrier parameter. Must be positive. Should be small. Default is 1.0e-03. |
[in] | fraction_to_boundary_rule | Parameter of the fraction-to-boundary-rule Must be larger than 0 and smaller than 1. Should be between 0.9 and 0.995. Default is 0.995. |
robotoc::STOConstraints::STOConstraints | ( | const Eigen::VectorXd & | minimum_dwell_times, |
const double | barrier_param = 1.0e-03 , |
||
const double | fraction_to_boundary_rule = 0.995 |
||
) |
Constructor.
[in] | minimum_dwell_times | Minimum dwell times. Each component must be non-negative. |
[in] | barrier_param | Barrier parameter. Must be positive. Should be small. Default is 1.0e-03. |
[in] | fraction_to_boundary_rule | Parameter of the fraction-to-boundary-rule Must be larger than 0 and smaller than 1. Should be between 0.9 and 0.995. Default is 0.995. |
robotoc::STOConstraints::STOConstraints | ( | ) |
Default constructor.
|
default |
Default destructor.
|
default |
Default copy constructor.
|
defaultnoexcept |
Default move constructor.
|
static |
Computes the dwell times from the given time discretization.
[in] | time_discretization | Time discretization. |
[in,out] | dwell_times | Dwell times. |
void robotoc::STOConstraints::condenseSlackAndDual | ( | ConstraintComponentData & | data, |
Eigen::VectorXd & | lt, | ||
Eigen::MatrixXd & | Qtt | ||
) | const |
Condenses the slack and dual variables. linearizeConstraints() must be called before this function.
[in,out] | data | Constraints data. |
[in,out] | lt | The derivatives of the Lagrangian w.r.t. the switching times. |
[in,out] | Qtt | The Hessian of the Lagrangian w.r.t. the switching times. |
ConstraintComponentData robotoc::STOConstraints::createConstraintsData | ( | const TimeDiscretization & | time_discretization | ) | const |
Creates the data for this constraints.
[in] | time_discretization | Time discretization. |
void robotoc::STOConstraints::evalConstraint | ( | const TimeDiscretization & | time_discretization, |
ConstraintComponentData & | data | ||
) | const |
Computes the primal residual, residual in the complementary slackness, and the log-barrier function of the slack varible.
[in] | time_discretization | Time discretization. |
[in,out] | data | Constraints data. |
void robotoc::STOConstraints::expandSlackAndDual | ( | ConstraintComponentData & | data, |
Eigen::VectorXd & | dts | ||
) | const |
Expands the slack and dual, i.e., computes the directions of the slack and dual variables from the directions of the primal variables.
[in,out] | data | Constraints data. |
[in,out] | dts | The direction of the switching times. |
double robotoc::STOConstraints::getBarrierParam | ( | ) | const |
Gets the barrier parameter.
double robotoc::STOConstraints::getFractionToBoundaryRule | ( | ) | const |
Gets the parameter of the fraction-to-boundary-rule.
const Eigen::VectorXd & robotoc::STOConstraints::getMinimumDwellTimes | ( | ) | const |
Gets the minimum dwell times.
bool robotoc::STOConstraints::isFeasible | ( | const TimeDiscretization & | time_discretization, |
ConstraintComponentData & | data | ||
) | const |
Checks whether the current split solution s is feasible or not.
[in] | time_discretization | Time discretization. |
[in,out] | data | Constraints data. |
void robotoc::STOConstraints::linearizeConstraints | ( | const TimeDiscretization & | time_discretization, |
ConstraintComponentData & | data, | ||
Eigen::VectorXd & | lt | ||
) | const |
Evaluates the constraints (i.e., calls evalConstraint()) and adds the products of the Jacobian of the constraints and Lagrange multipliers.
[in] | time_discretization | Time discretization. |
[in,out] | data | Constraints data. |
[in,out] | lt | The derivatives of the Lagrangian w.r.t. the switching times. |
double robotoc::STOConstraints::maxDualStepSize | ( | const ConstraintComponentData & | data | ) | const |
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the directions of the dual variables.
[in] | data | Constraints data. |
double robotoc::STOConstraints::maxSlackStepSize | ( | const ConstraintComponentData & | data | ) | const |
Computes and returns the maximum step size by applying fraction-to-boundary-rule to the directions of the slack variables.
[in] | data | Constraints data. |
|
default |
Default copy operator.
|
defaultnoexcept |
Default move assign operator.
void robotoc::STOConstraints::setBarrierParam | ( | const double | barrier_param | ) |
Sets the barrier parameter for all the constraint components.
[in] | barrier_param | Barrier parameter. Must be positive. Should be small. |
void robotoc::STOConstraints::setFractionToBoundaryRule | ( | const double | fraction_to_boundary_rule | ) |
Sets the parameter of the fraction-to-boundary-rule for all the constraint components.
[in] | fraction_to_boundary_rule | Must be larger than 0 and smaller than 1. Should be between 0.9 and 0.995. |
void robotoc::STOConstraints::setMinimumDwellTimes | ( | const double | minimum_dwell_time = std::sqrt(std::numeric_limits< double >::epsilon()) | ) |
Sets the minimum dwell times.
[in] | minimum_dwell_time | Minimum dwell time. Must be non-negative. The all minimum dwell times are set to this value. Default is std::sqrt(std::numeric_limits<double>::epsilon()). |
void robotoc::STOConstraints::setMinimumDwellTimes | ( | const Eigen::VectorXd & | minimum_dwell_times | ) |
Sets the minimum dwell times.
[in] | minimum_dwell_times | Minimum dwell times. Each component must be non-negative. |
void robotoc::STOConstraints::setMinimumDwellTimes | ( | const std::vector< double > & | minimum_dwell_times | ) |
Sets the minimum dwell times.
[in] | minimum_dwell_times | Minimum dwell times. Each component must be non-negative. |
void robotoc::STOConstraints::setSlackAndDual | ( | const TimeDiscretization & | time_discretization, |
ConstraintComponentData & | data | ||
) | const |
Sets the slack and dual variables of constraints.
[in] | time_discretization | Time discretization. |
[in,out] | data | Constraints data. |
void robotoc::STOConstraints::updateDual | ( | ConstraintComponentData & | data, |
const double | step_size | ||
) | const |
Updates the dual variables according to step_size.
[in,out] | data | Constraints data. |
[in] | step_size | Step size. |
void robotoc::STOConstraints::updateSlack | ( | ConstraintComponentData & | data, |
const double | step_size | ||
) | const |
Updates the slack variables according to step_size.
[in,out] | data | Constraints data. |
[in] | step_size | Step size. |