Go to the documentation of this file.
25 #ifndef SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_VECTOR_VERTEX_H_
26 #define SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_VECTOR_VERTEX_H_
51 class VectorVertex :
public VertexInterface
54 using Ptr = std::shared_ptr<VectorVertex>;
55 using UPtr = std::unique_ptr<VectorVertex>;
89 assert(
values.size() == lb.size());
90 assert(
values.size() == ub.size());
103 _values = Eigen::VectorXd::Zero(dim);
110 void plus(
int idx,
double inc)
override {
_values[idx] += inc; }
123 void setData(
int idx,
double data)
override {
_values[idx] = data; }
130 assert(
values.size() == ub.size());
176 assert(idx <
_lb.size());
182 assert(idx <
_lb.size());
196 if (unfixed_only &&
_fixed)
203 if (unfixed_only &&
_fixed)
258 std::vector<Eigen::VectorXd>
_backup;
279 using Ptr = std::shared_ptr<PartiallyFixedVectorVertex>;
280 using UPtr = std::unique_ptr<PartiallyFixedVectorVertex>;
330 assert(
values.size() == lb.size());
343 assert(
values.size() == lb.size());
344 assert(
values.size() == ub.size());
450 #endif // SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_VECTOR_VERTEX_H_
int getNumberFiniteLowerBounds(bool unfixed_only) const override
Get number of finite lower bounds.
void setUpperBounds(const Eigen::Ref< const Eigen::VectorXd > &ub) override
Define upper bounds on the vertex values [getDimension() x 1].
bool isFixedComponent(int idx) const override
Check if individual components are fixed or unfixed.
void setFixed(int idx, bool fixed)
Set component with idx (0 <= idx < dimension()) to (un)fixed.
int getNumberFiniteUpperBounds(bool unfixed_only) const override
Get number of finite upper bounds.
void plusUnfixed(const double *inc) override
Define the increment for the unfixed components of the vertex: x += inc with dim(inc)=getDimensionUnf...
int getDimension() const override
Return number of elements/values/components stored in this vertex.
bool hasFiniteBounds() const override
Check if finite bounds (lower or upper) are provided.
const Eigen::VectorXd & upperBound() const
Read-access to the underlying upper bound vector.
void pop() override
Restore the previously stored values of the backup stack and remove them from the stack.
bool hasFiniteUpperBound(int idx) const override
Check if finite upper bound for a single component is provided.
void setDimension(int dim) override
Change the dimension of the vertex (lower and upper bounds needs to be redefined)
bool hasFiniteLowerBound(int idx) const override
Check if finite lower bound for a single component is provided.
int getDimensionUnfixed() const override
Return number of unfixed elements (unfixed elements are skipped as parameters in the Hessian and Jaco...
constexpr const double CORBO_INF_DBL
Representation for infinity (double version)
bool hasFixedComponents() const override
Check if the vertex has fixed components.
VectorVertex()=default
Default constructor.
int getNumBackups() const override
Return the current size/number of backups of the backup stack.
const Eigen::VectorXd & values() const
Read-access to the underlying value vector.
EIGEN_DEVICE_FUNC Derived & setConstant(Index size, const Scalar &val)
void setData(int idx, double data) override
Write data to to a specific component.
std::shared_ptr< VectorVertex > Ptr
int getNumberFiniteUpperBounds(bool unfixed_only) const override
Get number of finite upper bounds.
PartiallyFixedVectorVertex()=default
Default constructor.
void setLowerBound(int idx, double lb) override
Define lower bound on a single component of the vertex (0 <= idx < getDimension())
void plus(int idx, double inc) override
Add value to a specific component of the vertex: x[idx] += inc.
const double * getData() const override
Get read-only raw access to the values of the vertex.
bool hasFiniteLowerBounds() const override
Check if finite lower bounds are provided.
void clear() override
Clear complete backup container.
int getDimensionUnfixed() const override
Return number of unfixed elements (unfixed elements are skipped as parameters in the Hessian and Jaco...
void plusUnfixed(const double *inc) override
Define the increment for the unfixed components of the vertex: x += inc with dim(inc)=getDimensionUnf...
int getNumberFiniteBounds(bool unfixed_only) const override
Get number of finite upper bounds (either upper or lower must be finite)
virtual void setDimension(int dim)
Change the dimension of the vertex (lower and upper bounds needs to be redefined)
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW
const Eigen::Array< bool, -1, 1 > fixedArray() const
Read-only access to the underlying logical array for fixed components.
const double * getUpperBounds() const override
Read-only raw access to upper bounds [getDimension() x 1].
A matrix or vector expression mapping an existing array of data.
const double * getLowerBounds() const override
Read-only raw access to lower bounds [getDimension() x 1].
bool isFixedComponent(int) const override
Check if individual components are fixed or unfixed.
A matrix or vector expression mapping an existing expression.
virtual void set(const Eigen::Ref< const Eigen::VectorXd > &values, const Eigen::Ref< const Eigen::VectorXd > &lb, const Eigen::Ref< const Eigen::VectorXd > &ub, bool fixed=false)
Set values and bounds at once.
void setLowerBounds(const Eigen::Ref< const Eigen::VectorXd > &lb) override
Define lower bounds on the vertex values [getDimension() x 1].
void set(const Eigen::Ref< const Eigen::VectorXd > &values, const Eigen::Ref< const Eigen::VectorXd > &lb, const Eigen::Ref< const Eigen::VectorXd > &ub, bool fixed=false) override
Set values and bounds at once.
std::unique_ptr< VectorVertex > UPtr
double * getDataRaw() override
Get write access to the values of the vertex.
void push() override
Store all values into a internal backup stack.
bool hasFiniteUpperBounds() const override
Check if finite upper bounds are provided.
void discardTop() override
Delete the previously made backup from the stack without restoring it.
void setUpperBound(int idx, double ub) override
Define upper bound on a single component of the vertex (0 <= idx < getDimension())
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
int getNumberFiniteLowerBounds(bool unfixed_only) const override
Get number of finite lower bounds.
const Eigen::VectorXd & lowerBound() const
Read-access to the underlying lower bound vector.
Vertex implementation that stores an Eigen::VectorXd (dynamic dimension)
std::vector< Eigen::VectorXd > _backup
virtual void setFixed(bool fixed)
Set complete vertex to fixed (and hence skip during optimization)
void top() override
Restore the previously stored values of the backup stack WITHOUT removing them from the stack.
bool hasFixedComponents() const override
Check if the vertex has fixed components.
int getNumberFiniteBounds(bool unfixed_only) const override
Get number of finite upper bounds (either upper or lower must be finite)
Vector based vertex with support for partially fixed components.
Eigen::Array< bool, -1, 1 > _fixed
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:07:14