25 #ifndef SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_SCALAR_VERTEX_H_ 26 #define SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_SCALAR_VERTEX_H_ 53 using Ptr = std::shared_ptr<ScalarVertex>;
54 using UPtr = std::unique_ptr<ScalarVertex>;
78 void plus(
const double* inc)
override {
_value += *inc; }
90 void set(
double value,
double lb,
double ub,
bool fixed)
128 if (unfixed_only &&
_fixed)
136 if (unfixed_only &&
_fixed)
144 if (unfixed_only &&
_fixed)
202 #endif // SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_SCALAR_VERTEX_H_ double * getDataRaw() override
Get write access to the values of the vertex.
const double & values() const
Get underlying value (this method is for compatibility purposes)
std::shared_ptr< ScalarVertex > Ptr
const double * getUpperBounds() const override
Read-only raw access to upper bounds [getDimension() x 1].
bool hasFixedComponents() const override
Check if the vertex has fixed components.
void setFixed(bool fixed)
Set vertex (un)fixed.
std::vector< double > _backup
double & values()
Raw access to the underlying value (this method is for compatibility purposes)
void setLowerBounds(const Eigen::Ref< const Eigen::VectorXd > &lb) override
Define lower bounds on the vertex values [getDimension() x 1].
std::unique_ptr< ScalarVertex > UPtr
ScalarVertex(double value, bool fixed)
Construct vertex with given value and fixed flag.
Generic interface class for vertices.
bool hasFiniteUpperBounds() const override
Check if finite upper bounds are provided.
bool hasFiniteBounds() const override
Check if finite bounds (lower or upper) are provided.
int getNumberFiniteBounds(bool unfixed_only) const override
Get number of finite upper bounds (either upper or lower must be finite)
const double * getLowerBounds() const override
Read-only raw access to lower bounds [getDimension() x 1].
Vertex implementation for scalar values.
double & value()
Raw access to the underlying value.
int getNumberFiniteLowerBounds(bool unfixed_only) const override
Get number of finite lower bounds.
bool hasFiniteUpperBound(int) const override
Check if finite upper bound for a single component is provided.
ScalarVertex(double value, double lb, double ub)
Construct vertex with given value, lower and upper bound.
int getNumBackups() const override
Return the current size/number of backups of the backup stack.
int getDimension() const override
Return number of elements/values/components stored in this vertex.
void plus(const double *inc) override
Define the increment for the vertex: x += inc with dim(inc)=getDimension().
void setData(int, double data) override
Write data to to a specific component.
bool hasFiniteLowerBounds() const override
Check if finite lower bounds are provided.
constexpr const double CORBO_INF_DBL
Representation for infinity (double version)
void discardTop() override
Delete the previously made backup from the stack without restoring it.
const double & value() const
Get underlying value.
void clear() override
Clear complete backup container.
int getNumberFiniteUpperBounds(bool unfixed_only) const override
Get number of finite upper bounds.
A matrix or vector expression mapping an existing expression.
void setUpperBounds(const Eigen::Ref< const Eigen::VectorXd > &ub) override
Define upper bounds on the vertex values [getDimension() x 1].
bool isFixedComponent(int) const override
Check if individual components are fixed or unfixed.
void setUpperBound(double ub)
Set upper bound.
void pop() override
Restore the previously stored values of the backup stack and remove them from the stack...
ScalarVertex(double value, double lb, double ub, bool fixed)
Construct vertex with given value, lower and upper bound and fixed flag.
void setLowerBound(double lb)
Set lower bound.
int getDimensionUnfixed() const override
Return number of unfixed elements (unfixed elements are skipped as parameters in the Hessian and Jaco...
ScalarVertex(double value)
Construct vertex with given value.
void plusUnfixed(const double *inc) override
Define the increment for the unfixed components of the vertex: x += inc with dim(inc)=getDimensionUnf...
void top() override
Restore the previously stored values of the backup stack WITHOUT removing them from the stack...
void setUpperBound(int, double ub) override
Define upper bound on a single component of the vertex (0 <= idx < getDimension()) ...
void push() override
Store all values into a internal backup stack.
const double * getData() const override
Get read-only raw access to the values of the vertex.
void setLowerBound(int, double lb) override
Define lower bound on a single component of the vertex (0 <= idx < getDimension()) ...
bool hasFiniteLowerBound(int) const override
Check if finite lower bound for a single component is provided.
void plus(int, double inc) override
Add value to a specific component of the vertex: x[idx] += inc.
ScalarVertex()
Default constructor.