robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
robotoc::STOConstraints Class Reference

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...
 
STOConstraintsoperator= (const STOConstraints &)=default
 Default copy operator. More...
 
 STOConstraints (STOConstraints &&) noexcept=default
 Default move constructor. More...
 
STOConstraintsoperator= (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 &lt) 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 &lt, 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...
 

Detailed Description

Constraints of the switching time optimization problems.

Constructor & Destructor Documentation

◆ STOConstraints() [1/6]

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.

Parameters
[in]num_switchesThe number of switches.
[in]minimum_dwell_timeMinimum 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_paramBarrier parameter. Must be positive. Should be small. Default is 1.0e-03.
[in]fraction_to_boundary_ruleParameter 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.

◆ STOConstraints() [2/6]

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.

Parameters
[in]minimum_dwell_timesMinimum dwell times. Each component must be non-negative.
[in]barrier_paramBarrier parameter. Must be positive. Should be small. Default is 1.0e-03.
[in]fraction_to_boundary_ruleParameter 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.

◆ STOConstraints() [3/6]

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.

Parameters
[in]minimum_dwell_timesMinimum dwell times. Each component must be non-negative.
[in]barrier_paramBarrier parameter. Must be positive. Should be small. Default is 1.0e-03.
[in]fraction_to_boundary_ruleParameter 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.

◆ STOConstraints() [4/6]

robotoc::STOConstraints::STOConstraints ( )

Default constructor.

◆ ~STOConstraints()

robotoc::STOConstraints::~STOConstraints ( )
default

Default destructor.

◆ STOConstraints() [5/6]

robotoc::STOConstraints::STOConstraints ( const STOConstraints )
default

Default copy constructor.

◆ STOConstraints() [6/6]

robotoc::STOConstraints::STOConstraints ( STOConstraints &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ computeDwellTimes()

static void robotoc::STOConstraints::computeDwellTimes ( const TimeDiscretization time_discretization,
Eigen::VectorXd &  dwell_times 
)
static

Computes the dwell times from the given time discretization.

Parameters
[in]time_discretizationTime discretization.
[in,out]dwell_timesDwell times.

◆ condenseSlackAndDual()

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.

Parameters
[in,out]dataConstraints data.
[in,out]ltThe derivatives of the Lagrangian w.r.t. the switching times.
[in,out]QttThe Hessian of the Lagrangian w.r.t. the switching times.

◆ createConstraintsData()

ConstraintComponentData robotoc::STOConstraints::createConstraintsData ( const TimeDiscretization time_discretization) const

Creates the data for this constraints.

Parameters
[in]time_discretizationTime discretization.
Returns
The constraint data for this constraints.

◆ evalConstraint()

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.

Parameters
[in]time_discretizationTime discretization.
[in,out]dataConstraints data.

◆ expandSlackAndDual()

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.

Parameters
[in,out]dataConstraints data.
[in,out]dtsThe direction of the switching times.

◆ getBarrierParam()

double robotoc::STOConstraints::getBarrierParam ( ) const

Gets the barrier parameter.

Returns
Barrier parameter.

◆ getFractionToBoundaryRule()

double robotoc::STOConstraints::getFractionToBoundaryRule ( ) const

Gets the parameter of the fraction-to-boundary-rule.

Returns
The parameter of the fraction-to-boundary-rule.

◆ getMinimumDwellTimes()

const Eigen::VectorXd & robotoc::STOConstraints::getMinimumDwellTimes ( ) const

Gets the minimum dwell times.

Returns
const reference to the minimum dwell times.

◆ isFeasible()

bool robotoc::STOConstraints::isFeasible ( const TimeDiscretization time_discretization,
ConstraintComponentData data 
) const

Checks whether the current split solution s is feasible or not.

Parameters
[in]time_discretizationTime discretization.
[in,out]dataConstraints data.
Returns
true if s is feasible. false if not.

◆ linearizeConstraints()

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.

Parameters
[in]time_discretizationTime discretization.
[in,out]dataConstraints data.
[in,out]ltThe derivatives of the Lagrangian w.r.t. the switching times.

◆ maxDualStepSize()

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.

Parameters
[in]dataConstraints data.
Returns
Maximum step size regarding the dual variables.

◆ maxSlackStepSize()

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.

Parameters
[in]dataConstraints data.
Returns
Maximum step size regarding the slack variables.

◆ operator=() [1/2]

STOConstraints & robotoc::STOConstraints::operator= ( const STOConstraints )
default

Default copy operator.

◆ operator=() [2/2]

STOConstraints & robotoc::STOConstraints::operator= ( STOConstraints &&  )
defaultnoexcept

Default move assign operator.

◆ setBarrierParam()

void robotoc::STOConstraints::setBarrierParam ( const double  barrier_param)

Sets the barrier parameter for all the constraint components.

Parameters
[in]barrier_paramBarrier parameter. Must be positive. Should be small.

◆ setFractionToBoundaryRule()

void robotoc::STOConstraints::setFractionToBoundaryRule ( const double  fraction_to_boundary_rule)

Sets the parameter of the fraction-to-boundary-rule for all the constraint components.

Parameters
[in]fraction_to_boundary_ruleMust be larger than 0 and smaller than 1. Should be between 0.9 and 0.995.

◆ setMinimumDwellTimes() [1/3]

void robotoc::STOConstraints::setMinimumDwellTimes ( const double  minimum_dwell_time = std::sqrt(std::numeric_limits< double >::epsilon()))

Sets the minimum dwell times.

Parameters
[in]minimum_dwell_timeMinimum 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()).

◆ setMinimumDwellTimes() [2/3]

void robotoc::STOConstraints::setMinimumDwellTimes ( const Eigen::VectorXd &  minimum_dwell_times)

Sets the minimum dwell times.

Parameters
[in]minimum_dwell_timesMinimum dwell times. Each component must be non-negative.

◆ setMinimumDwellTimes() [3/3]

void robotoc::STOConstraints::setMinimumDwellTimes ( const std::vector< double > &  minimum_dwell_times)

Sets the minimum dwell times.

Parameters
[in]minimum_dwell_timesMinimum dwell times. Each component must be non-negative.

◆ setSlackAndDual()

void robotoc::STOConstraints::setSlackAndDual ( const TimeDiscretization time_discretization,
ConstraintComponentData data 
) const

Sets the slack and dual variables of constraints.

Parameters
[in]time_discretizationTime discretization.
[in,out]dataConstraints data.

◆ updateDual()

void robotoc::STOConstraints::updateDual ( ConstraintComponentData data,
const double  step_size 
) const

Updates the dual variables according to step_size.

Parameters
[in,out]dataConstraints data.
[in]step_sizeStep size.

◆ updateSlack()

void robotoc::STOConstraints::updateSlack ( ConstraintComponentData data,
const double  step_size 
) const

Updates the slack variables according to step_size.

Parameters
[in,out]dataConstraints data.
[in]step_sizeStep size.

The documentation for this class was generated from the following file: