36 #ifndef IFOPT_INCLUDE_OPT_COMPOSITE_H_ 37 #define IFOPT_INCLUDE_OPT_COMPOSITE_H_ 43 #include <Eigen/Dense> 44 #include <Eigen/Sparse> 73 using Ptr = std::shared_ptr<Component>;
75 using Jacobian = Eigen::SparseMatrix<double, Eigen::RowMajor>;
89 Component(
int num_rows,
const std::string& name);
140 virtual void Print()
const;
170 using Ptr = std::shared_ptr<Composite>;
181 Composite(
const std::string& name,
bool is_cost);
189 void Print()
const override;
204 template<
typename T> std::shared_ptr<T>
205 GetComponent(
const std::string& name)
const;
215 void ClearComponents();
233 return std::dynamic_pointer_cast<T>(c);
virtual VectorXd GetValues() const =0
Returns the "values" of whatever this component represents.
const Component::Ptr GetComponent(std::string name) const
Access generic component with the specified name.
static const int kSpecifyLater
Component(int num_rows, const std::string &name)
Creates a component.
std::vector< Component::Ptr > ComponentVec
std::string GetName() const
Returns the name (id) of this component.
std::shared_ptr< Component > Ptr
virtual void SetVariables(const VectorXd &x)=0
Sets the optimization variables from an Eigen vector.
void SetRows(int num_rows)
Sets the number of rows of this component.
Eigen::SparseMatrix< double, Eigen::RowMajor > Jacobian
virtual Jacobian GetJacobian() const =0
Returns derivatives of each row w.r.t. the variables.
Interface representing either Variable, Cost or Constraint.
virtual void Print() const
Prints the relevant information (name, rows, values) of this component.
A collection of components which is treated as another Component.
std::vector< Bounds > VecBound
int GetRows() const
Returns the number of rows of this component.
virtual ~Component()=default
virtual VecBound GetBounds() const =0
Returns the "bounds" of this component.