Public Types | Public Member Functions | Protected Attributes | List of all members
corbo::ScalarVertex Class Reference

Vertex implementation for scalar values. More...

#include <scalar_vertex.h>

Inheritance diagram for corbo::ScalarVertex:
Inheritance graph
[legend]

Public Types

using Ptr = std::shared_ptr< ScalarVertex >
 
using UPtr = std::unique_ptr< ScalarVertex >
 
- Public Types inherited from corbo::VertexInterface
using Ptr = std::shared_ptr< VertexInterface >
 
using UPtr = std::unique_ptr< VertexInterface >
 

Public Member Functions

void clear () override
 Clear complete backup container. More...
 
void discardTop () override
 Delete the previously made backup from the stack without restoring it. More...
 
const double * getData () const override
 Get read-only raw access to the values of the vertex. More...
 
double * getDataRaw () override
 Get write access to the values of the vertex. More...
 
int getDimension () const override
 Return number of elements/values/components stored in this vertex. More...
 
int getDimensionUnfixed () const override
 Return number of unfixed elements (unfixed elements are skipped as parameters in the Hessian and Jacobian. More...
 
const double * getLowerBounds () const override
 Read-only raw access to lower bounds [getDimension() x 1]. More...
 
int getNumBackups () const override
 Return the current size/number of backups of the backup stack. More...
 
int getNumberFiniteBounds (bool unfixed_only) const override
 Get number of finite upper bounds (either upper or lower must be finite) More...
 
int getNumberFiniteLowerBounds (bool unfixed_only) const override
 Get number of finite lower bounds. More...
 
int getNumberFiniteUpperBounds (bool unfixed_only) const override
 Get number of finite upper bounds. More...
 
const double * getUpperBounds () const override
 Read-only raw access to upper bounds [getDimension() x 1]. More...
 
bool hasFiniteBounds () const override
 Check if finite bounds (lower or upper) are provided. More...
 
bool hasFiniteLowerBound (int) const override
 Check if finite lower bound for a single component is provided. More...
 
bool hasFiniteLowerBounds () const override
 Check if finite lower bounds are provided. More...
 
bool hasFiniteUpperBound (int) const override
 Check if finite upper bound for a single component is provided. More...
 
bool hasFiniteUpperBounds () const override
 Check if finite upper bounds are provided. More...
 
bool hasFixedComponents () const override
 Check if the vertex has fixed components. More...
 
bool isFixedComponent (int) const override
 Check if individual components are fixed or unfixed. More...
 
void plus (int, double inc) override
 Add value to a specific component of the vertex: x[idx] += inc. More...
 
void plus (const double *inc) override
 Define the increment for the vertex: x += inc with dim(inc)=getDimension(). More...
 
void plusUnfixed (const double *inc) override
 Define the increment for the unfixed components of the vertex: x += inc with dim(inc)=getDimensionUnfixed(). More...
 
void pop () override
 Restore the previously stored values of the backup stack and remove them from the stack. More...
 
void push () override
 Store all values into a internal backup stack. More...
 
 ScalarVertex ()
 Default constructor. More...
 
 ScalarVertex (double value)
 Construct vertex with given value. More...
 
 ScalarVertex (double value, bool fixed)
 Construct vertex with given value and fixed flag. More...
 
 ScalarVertex (double value, double lb, double ub)
 Construct vertex with given value, lower and upper bound. More...
 
 ScalarVertex (double value, double lb, double ub, bool fixed)
 Construct vertex with given value, lower and upper bound and fixed flag. More...
 
void set (double value, double lb, double ub, bool fixed)
 
void setData (int, double data) override
 Write data to to a specific component. More...
 
void setFixed (bool fixed)
 Set vertex (un)fixed. More...
 
void setLowerBound (double lb)
 Set lower bound. More...
 
void setLowerBound (int, double lb) override
 Define lower bound on a single component of the vertex (0 <= idx < getDimension()) More...
 
void setLowerBounds (const Eigen::Ref< const Eigen::VectorXd > &lb) override
 Define lower bounds on the vertex values [getDimension() x 1]. More...
 
void setUpperBound (double ub)
 Set upper bound. More...
 
void setUpperBound (int, double ub) override
 Define upper bound on a single component of the vertex (0 <= idx < getDimension()) More...
 
void setUpperBounds (const Eigen::Ref< const Eigen::VectorXd > &ub) override
 Define upper bounds on the vertex values [getDimension() x 1]. More...
 
void top () override
 Restore the previously stored values of the backup stack WITHOUT removing them from the stack. More...
 
const double & value () const
 Get underlying value. More...
 
double & value ()
 Raw access to the underlying value. More...
 
const double & values () const
 Get underlying value (this method is for compatibility purposes) More...
 
double & values ()
 Raw access to the underlying value (this method is for compatibility purposes) More...
 
- Public Member Functions inherited from corbo::VertexInterface
virtual void clearBackups ()
 
void clearConnectedEdges ()
 Clear all connected edges. More...
 
const std::set< BaseEdge * > & getConnectedEqualityEdgesRef () const
 Raw access for connected equality constraint edges. More...
 
const std::set< BaseEdge * > & getConnectedInequalityEdgesRef () const
 Raw access for connected inequality constraint edges. More...
 
const std::set< BaseEdge * > & getConnectedLsqObjectiveEdgesRef () const
 Raw access for connected least-squares objective edges. More...
 
const std::set< BaseMixedEdge * > & getConnectedMixedEdgesRef () const
 Raw access for connected mixed edges. More...
 
const std::set< BaseEdge * > & getConnectedObjectiveEdgesRef () const
 Raw access for connected objective edges. More...
 
Eigen::Map< const Eigen::VectorXd > getDataMap () const
 Get a read-only Eigen::Map to the values of the vertex. More...
 
Eigen::Map< Eigen::VectorXd > getDataRawMap ()
 Get a Eigen::Map to the values of the vertex. More...
 
Eigen::Map< const Eigen::VectorXd > getLowerBoundsMap () const
 Read-only Eigen::Map for lower bounds [getDimension() x 1]. More...
 
Eigen::Map< const Eigen::VectorXd > getUpperBoundsMap () const
 Read-only Eigen::Map for upper bounds [getDimension() x 1]. More...
 
int getVertexIdx () const
 Retrieve current edge index (warning, this value is determined within the related VertexSetInterface implementation) More...
 
virtual bool isFixed () const
 Check if all components are fixed. More...
 
void registerEqualityEdge (BaseEdge *edge)
 Register an adjacent equality constraint edge. More...
 
void registerInequalityEdge (BaseEdge *edge)
 Register an adjacent inequality constraint edge. More...
 
void registerLsqObjectiveEdge (BaseEdge *edge)
 Register an adjacent least-squares objective edge. More...
 
void registerMixedEdge (BaseMixedEdge *edge)
 Register an adjacent mixed edge. More...
 
void registerObjectiveEdge (BaseEdge *edge)
 Register an adjacent objective edge. More...
 
virtual ~VertexInterface ()
 Virtual destructor. More...
 

Protected Attributes

std::vector< double > _backup
 
bool _fixed = false
 
double _lb
 
double _ub
 
double _value
 

Detailed Description

Vertex implementation for scalar values.

This vertex is optimized for scalar (1D) values in contrast to VectorVertex which stores multi-dimensional vector.

See also
VertexInterface VectorVertex HyperGraph EdgeInterface
Author
Christoph Rösmann (chris.nosp@m.toph.nosp@m..roes.nosp@m.mann.nosp@m.@tu-d.nosp@m.ortm.nosp@m.und.d.nosp@m.e)

Definition at line 50 of file scalar_vertex.h.

Member Typedef Documentation

◆ Ptr

using corbo::ScalarVertex::Ptr = std::shared_ptr<ScalarVertex>

Definition at line 53 of file scalar_vertex.h.

◆ UPtr

using corbo::ScalarVertex::UPtr = std::unique_ptr<ScalarVertex>

Definition at line 54 of file scalar_vertex.h.

Constructor & Destructor Documentation

◆ ScalarVertex() [1/5]

corbo::ScalarVertex::ScalarVertex ( )
inline

Default constructor.

Definition at line 57 of file scalar_vertex.h.

◆ ScalarVertex() [2/5]

corbo::ScalarVertex::ScalarVertex ( double  value)
inlineexplicit

Construct vertex with given value.

Definition at line 59 of file scalar_vertex.h.

◆ ScalarVertex() [3/5]

corbo::ScalarVertex::ScalarVertex ( double  value,
bool  fixed 
)
inlineexplicit

Construct vertex with given value and fixed flag.

Definition at line 62 of file scalar_vertex.h.

◆ ScalarVertex() [4/5]

corbo::ScalarVertex::ScalarVertex ( double  value,
double  lb,
double  ub 
)
inlineexplicit

Construct vertex with given value, lower and upper bound.

Definition at line 65 of file scalar_vertex.h.

◆ ScalarVertex() [5/5]

corbo::ScalarVertex::ScalarVertex ( double  value,
double  lb,
double  ub,
bool  fixed 
)
inlineexplicit

Construct vertex with given value, lower and upper bound and fixed flag.

Definition at line 68 of file scalar_vertex.h.

Member Function Documentation

◆ clear()

void corbo::ScalarVertex::clear ( )
inlineoverridevirtual

Clear complete backup container.

Implements corbo::VertexInterface.

Definition at line 176 of file scalar_vertex.h.

◆ discardTop()

void corbo::ScalarVertex::discardTop ( )
inlineoverridevirtual

Delete the previously made backup from the stack without restoring it.

Implements corbo::VertexInterface.

Definition at line 174 of file scalar_vertex.h.

◆ getData()

const double* corbo::ScalarVertex::getData ( ) const
inlineoverridevirtual

Get read-only raw access to the values of the vertex.

Implements corbo::VertexInterface.

Definition at line 83 of file scalar_vertex.h.

◆ getDataRaw()

double* corbo::ScalarVertex::getDataRaw ( )
inlineoverridevirtual

Get write access to the values of the vertex.

Implements corbo::VertexInterface.

Definition at line 84 of file scalar_vertex.h.

◆ getDimension()

int corbo::ScalarVertex::getDimension ( ) const
inlineoverridevirtual

Return number of elements/values/components stored in this vertex.

Implements corbo::VertexInterface.

Definition at line 71 of file scalar_vertex.h.

◆ getDimensionUnfixed()

int corbo::ScalarVertex::getDimensionUnfixed ( ) const
inlineoverridevirtual

Return number of unfixed elements (unfixed elements are skipped as parameters in the Hessian and Jacobian.

Implements corbo::VertexInterface.

Definition at line 73 of file scalar_vertex.h.

◆ getLowerBounds()

const double* corbo::ScalarVertex::getLowerBounds ( ) const
inlineoverridevirtual

Read-only raw access to lower bounds [getDimension() x 1].

Implements corbo::VertexInterface.

Definition at line 154 of file scalar_vertex.h.

◆ getNumBackups()

int corbo::ScalarVertex::getNumBackups ( ) const
inlineoverridevirtual

Return the current size/number of backups of the backup stack.

Implements corbo::VertexInterface.

Definition at line 178 of file scalar_vertex.h.

◆ getNumberFiniteBounds()

int corbo::ScalarVertex::getNumberFiniteBounds ( bool  unfixed_only) const
inlineoverridevirtual

Get number of finite upper bounds (either upper or lower must be finite)

Implements corbo::VertexInterface.

Definition at line 142 of file scalar_vertex.h.

◆ getNumberFiniteLowerBounds()

int corbo::ScalarVertex::getNumberFiniteLowerBounds ( bool  unfixed_only) const
inlineoverridevirtual

Get number of finite lower bounds.

Implements corbo::VertexInterface.

Definition at line 126 of file scalar_vertex.h.

◆ getNumberFiniteUpperBounds()

int corbo::ScalarVertex::getNumberFiniteUpperBounds ( bool  unfixed_only) const
inlineoverridevirtual

Get number of finite upper bounds.

Implements corbo::VertexInterface.

Definition at line 134 of file scalar_vertex.h.

◆ getUpperBounds()

const double* corbo::ScalarVertex::getUpperBounds ( ) const
inlineoverridevirtual

Read-only raw access to upper bounds [getDimension() x 1].

Implements corbo::VertexInterface.

Definition at line 156 of file scalar_vertex.h.

◆ hasFiniteBounds()

bool corbo::ScalarVertex::hasFiniteBounds ( ) const
inlineoverridevirtual

Check if finite bounds (lower or upper) are provided.

Implements corbo::VertexInterface.

Definition at line 116 of file scalar_vertex.h.

◆ hasFiniteLowerBound()

bool corbo::ScalarVertex::hasFiniteLowerBound ( int  idx) const
inlineoverridevirtual

Check if finite lower bound for a single component is provided.

Implements corbo::VertexInterface.

Definition at line 122 of file scalar_vertex.h.

◆ hasFiniteLowerBounds()

bool corbo::ScalarVertex::hasFiniteLowerBounds ( ) const
inlineoverridevirtual

Check if finite lower bounds are provided.

Implements corbo::VertexInterface.

Definition at line 118 of file scalar_vertex.h.

◆ hasFiniteUpperBound()

bool corbo::ScalarVertex::hasFiniteUpperBound ( int  idx) const
inlineoverridevirtual

Check if finite upper bound for a single component is provided.

Implements corbo::VertexInterface.

Definition at line 124 of file scalar_vertex.h.

◆ hasFiniteUpperBounds()

bool corbo::ScalarVertex::hasFiniteUpperBounds ( ) const
inlineoverridevirtual

Check if finite upper bounds are provided.

Implements corbo::VertexInterface.

Definition at line 120 of file scalar_vertex.h.

◆ hasFixedComponents()

bool corbo::ScalarVertex::hasFixedComponents ( ) const
inlineoverridevirtual

Check if the vertex has fixed components.

Implements corbo::VertexInterface.

Definition at line 99 of file scalar_vertex.h.

◆ isFixedComponent()

bool corbo::ScalarVertex::isFixedComponent ( int  idx) const
inlineoverridevirtual

Check if individual components are fixed or unfixed.

Implements corbo::VertexInterface.

Definition at line 101 of file scalar_vertex.h.

◆ plus() [1/2]

void corbo::ScalarVertex::plus ( int  idx,
double  inc 
)
inlineoverridevirtual

Add value to a specific component of the vertex: x[idx] += inc.

Implements corbo::VertexInterface.

Definition at line 76 of file scalar_vertex.h.

◆ plus() [2/2]

void corbo::ScalarVertex::plus ( const double *  inc)
inlineoverridevirtual

Define the increment for the vertex: x += inc with dim(inc)=getDimension().

Implements corbo::VertexInterface.

Definition at line 78 of file scalar_vertex.h.

◆ plusUnfixed()

void corbo::ScalarVertex::plusUnfixed ( const double *  inc)
inlineoverridevirtual

Define the increment for the unfixed components of the vertex: x += inc with dim(inc)=getDimensionUnfixed().

Implements corbo::VertexInterface.

Definition at line 80 of file scalar_vertex.h.

◆ pop()

void corbo::ScalarVertex::pop ( )
inlineoverridevirtual

Restore the previously stored values of the backup stack and remove them from the stack.

Implements corbo::VertexInterface.

Definition at line 162 of file scalar_vertex.h.

◆ push()

void corbo::ScalarVertex::push ( )
inlineoverridevirtual

Store all values into a internal backup stack.

Implements corbo::VertexInterface.

Definition at line 160 of file scalar_vertex.h.

◆ set()

void corbo::ScalarVertex::set ( double  value,
double  lb,
double  ub,
bool  fixed 
)
inline

Definition at line 90 of file scalar_vertex.h.

◆ setData()

void corbo::ScalarVertex::setData ( int  idx,
double  data 
)
inlineoverridevirtual

Write data to to a specific component.

Implements corbo::VertexInterface.

Definition at line 87 of file scalar_vertex.h.

◆ setFixed()

void corbo::ScalarVertex::setFixed ( bool  fixed)
inline

Set vertex (un)fixed.

Definition at line 151 of file scalar_vertex.h.

◆ setLowerBound() [1/2]

void corbo::ScalarVertex::setLowerBound ( double  lb)
inline

Set lower bound.

Definition at line 104 of file scalar_vertex.h.

◆ setLowerBound() [2/2]

void corbo::ScalarVertex::setLowerBound ( int  idx,
double  lb 
)
inlineoverridevirtual

Define lower bound on a single component of the vertex (0 <= idx < getDimension())

Implements corbo::VertexInterface.

Definition at line 112 of file scalar_vertex.h.

◆ setLowerBounds()

void corbo::ScalarVertex::setLowerBounds ( const Eigen::Ref< const Eigen::VectorXd > &  lb)
inlineoverridevirtual

Define lower bounds on the vertex values [getDimension() x 1].

Implements corbo::VertexInterface.

Definition at line 108 of file scalar_vertex.h.

◆ setUpperBound() [1/2]

void corbo::ScalarVertex::setUpperBound ( double  ub)
inline

Set upper bound.

Definition at line 106 of file scalar_vertex.h.

◆ setUpperBound() [2/2]

void corbo::ScalarVertex::setUpperBound ( int  idx,
double  ub 
)
inlineoverridevirtual

Define upper bound on a single component of the vertex (0 <= idx < getDimension())

Implements corbo::VertexInterface.

Definition at line 114 of file scalar_vertex.h.

◆ setUpperBounds()

void corbo::ScalarVertex::setUpperBounds ( const Eigen::Ref< const Eigen::VectorXd > &  ub)
inlineoverridevirtual

Define upper bounds on the vertex values [getDimension() x 1].

Implements corbo::VertexInterface.

Definition at line 110 of file scalar_vertex.h.

◆ top()

void corbo::ScalarVertex::top ( )
inlineoverridevirtual

Restore the previously stored values of the backup stack WITHOUT removing them from the stack.

Implements corbo::VertexInterface.

Definition at line 168 of file scalar_vertex.h.

◆ value() [1/2]

const double& corbo::ScalarVertex::value ( ) const
inline

Get underlying value.

Definition at line 181 of file scalar_vertex.h.

◆ value() [2/2]

double& corbo::ScalarVertex::value ( )
inline

Raw access to the underlying value.

Definition at line 183 of file scalar_vertex.h.

◆ values() [1/2]

const double& corbo::ScalarVertex::values ( ) const
inline

Get underlying value (this method is for compatibility purposes)

Definition at line 186 of file scalar_vertex.h.

◆ values() [2/2]

double& corbo::ScalarVertex::values ( )
inline

Raw access to the underlying value (this method is for compatibility purposes)

Definition at line 188 of file scalar_vertex.h.

Member Data Documentation

◆ _backup

std::vector<double> corbo::ScalarVertex::_backup
protected

Definition at line 197 of file scalar_vertex.h.

◆ _fixed

bool corbo::ScalarVertex::_fixed = false
protected

Definition at line 195 of file scalar_vertex.h.

◆ _lb

double corbo::ScalarVertex::_lb
protected

Definition at line 192 of file scalar_vertex.h.

◆ _ub

double corbo::ScalarVertex::_ub
protected

Definition at line 193 of file scalar_vertex.h.

◆ _value

double corbo::ScalarVertex::_value
protected

Definition at line 191 of file scalar_vertex.h.


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


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:08:03