|
Interior-point-optimisation
1.0-1
Interior-pointoptimisationlibrary
|
Class for a constraint function. More...
#include <Constraint.hpp>


Public Member Functions | |
| Constraint (detail::ModelBase &model, detail::SharedFunctionPtr function, std::string const &name) | |
| Use this constructor to construct from a ipo_function::SharedFunctionPtr object. More... | |
| Constraint (detail::ModelBase &model, ipo_function::Function *function, std::string const &name) | |
| Use this constructor to construct from a pointer to a ipo_function::Function object. More... | |
| Constraint (detail::ModelBase &model, ipo_function::Function &function, std::string const &name) | |
| Constructor. More... | |
| Constraint (detail::ModelBase &model, detail::SharedFunctionPtr function, char const *const name=0) | |
| Use this constructor to construct from a ipo_function::SharedFunctionPtr object. More... | |
| Constraint (detail::ModelBase &model, ipo_function::Function *function, char const *const name=0) | |
| Use this constructor to construct from a pointer to a ipo_function::Function object. More... | |
| Constraint (detail::ModelBase &model, ipo_function::Function &function, char const *const name=0) | |
| Constructor. More... | |
| double | getUpperBound () const |
| Get upper bound of Constraint. More... | |
| double | getLowerBound () const |
| Get lower bound of Constraint. More... | |
| virtual void | setUpperBound (double const upperBound) |
| Set upper bound of Constraint. More... | |
| virtual void | setLowerBound (double const lowerBound) |
| Set lower bound of Constraint. More... | |
| Constraint (Constraint const &constraint) | |
| Copy constructor. More... | |
| Constraint & | operator= (Constraint const &constraint) |
| Assignment operator. More... | |
| Constraint (Constraint &&constraint) | |
| Move constructor. More... | |
| Constraint & | operator= (Constraint &&constraint) |
| Move assignment operator. More... | |
| virtual void | summary (std::ostream &ostream=std::cout, std::string const &prefix="") const override |
| Create a summary of this function. More... | |
Public Member Functions inherited from ipo::Objective | |
| Objective (detail::ModelBase &model, detail::SharedFunctionPtr function, std::string const &name) | |
| Use this constructor to construct from a SharedFunctionPtr object. More... | |
| Objective (detail::ModelBase &model, ipo_function::Function *function, std::string const &name) | |
| Use this constructor to construct from a pointer to a ipo_function::Function object. More... | |
| Objective (detail::ModelBase &model, ipo_function::Function &function, std::string const &name) | |
| Use this constructor to construct from a ipo_function::Function object by reference. More... | |
| Objective (detail::ModelBase &model, detail::SharedFunctionPtr function, char const *const name=0) | |
| Use this constructor to construct from a SharedFunctionPtr object. More... | |
| Objective (detail::ModelBase &model, ipo_function::Function *function, char const *const name=0) | |
| Use this constructor to construct from a pointer to a ipo_function::Function object. More... | |
| Objective (detail::ModelBase &model, ipo_function::Function &function, char const *const name=0) | |
| Constructor. More... | |
| Objective (Objective const &objective) | |
| Copy constructor. More... | |
| Objective (Objective &&objective) | |
| Move constructor. More... | |
| Objective & | operator= (Objective const &objective) |
| Assignment operator. More... | |
| Objective & | operator= (Objective &&objective) |
| Assignment operator. More... | |
| std::string | getName () const |
| Get name of variable. More... | |
| void | setName (std::string const &name) |
| Set name of Objective. More... | |
| void | setName (char *const name) |
| Set name of Objective. More... | |
| Array & | getVariables () |
| Get variables used by Objective function. More... | |
| void | addVariable (Variable &variable) |
| Add a Variable. More... | |
| void | removeVariable (Variable &variable) |
| Remove (first, and usually only occurrence of) a Variable. More... | |
| void | addArray (Array &array) |
| Add an Array. More... | |
| void | removeArray (Array &array) |
| Remove an Array. More... | |
Public Member Functions inherited from ipo::detail::Var | |
| Var (ModelBase &model) | |
| Constructor needs a model so that variable can only be attached to one model. More... | |
| virtual | ~Var ()=0 |
| Virtual destructor to make class abstract. More... | |
| Var (Var &var) | |
| Copy constructor. More... | |
| Var & | operator= (Var &var) |
| Copy assignment operator. More... | |
| Var (Var &&var) | |
| Move constructor. More... | |
| Var & | operator= (Var &&var) |
| Move assignment operator. More... | |
| ModelBase const *const | getModel () const |
| Get pointer to model. More... | |
Public Member Functions inherited from ipo::detail::ModelFunction | |
| ModelFunction (SharedFunctionPtr function) | |
| Use this constructor to construct from a SharedFunctionPtr object. More... | |
| ModelFunction (ipo_function::Function *function) | |
| Use this constructor to construct from a pointer to a ipo_function::Function object. More... | |
| ModelFunction (ipo_function::Function &function) | |
| Use this constructor to construct from a ipo_function::Function object by reference. More... | |
| bool | checkSize () const |
| Check size of vector for function arguments matches number of variables supplied. More... | |
| std::tuple< size_t, size_t > | getSizes () const |
| Get size of vector for function arguments and number of variables supplied. More... | |
| virtual ::ipo_function::Function * | getFunction () |
| Get function. More... | |
Friends | |
| bool | ipo::operator== (Constraint const &, Constraint const &) |
Additional Inherited Members | |
Protected Member Functions inherited from ipo::Objective | |
| double | value () const noexcept |
| Value of the objective function at the current value of the variables. More... | |
Protected Attributes inherited from ipo::Objective | |
| std::shared_ptr< Data > | data |
| The objective data. More... | |
Protected Attributes inherited from ipo::detail::Var | |
| ModelBase & | model |
| A Model to attach this to. More... | |
Protected Attributes inherited from ipo::detail::ModelFunction | |
| SharedFunctionPtr | function |
| The objective or constraint function. More... | |
Class for a constraint function.
The function should be set from an object of a subclass of Function. Use getVariables() = ... to specify an Array or Variable for the constraint function to use. Note that setting getVariables() also implicitly determines the size of the vector to be passed to function, but this class does not check the sizes of variables and function arguments match. Note also that if function is destructed before a Constraint object that uses it, the behaviour of the Constraint object is undefined.
A constraint has no effect unless at least one of setUpperBound() or setLowerBound() is used to set a bound. Both can be set, though this only makes sense for a linear constraint.
Definition at line 40 of file Constraint.hpp.
| Constraint::Constraint | ( | detail::ModelBase & | model, |
| detail::SharedFunctionPtr | function, | ||
| std::string const & | name | ||
| ) |
Use this constructor to construct from a ipo_function::SharedFunctionPtr object.
| model | A Model |
| function | A ipo_function::SharedFunctionPtr object |
| name | A name for this object |
Definition at line 28 of file Constraint.cc.
References ipo::detail::Var::model.
| Constraint::Constraint | ( | detail::ModelBase & | model, |
| ipo_function::Function * | function, | ||
| std::string const & | name | ||
| ) |
Use this constructor to construct from a pointer to a ipo_function::Function object.
The Function object should be constructed using new and should not be deleted explicitly.
| model | A Model |
| function | A pointer to an object of a subclass of ipo_function::Function |
| name | A name for this object |
Definition at line 32 of file Constraint.cc.
References ipo::detail::Var::model.
| Constraint::Constraint | ( | detail::ModelBase & | model, |
| ipo_function::Function & | function, | ||
| std::string const & | name | ||
| ) |
Constructor.
| model | A Model |
| function | An object of a subclass of ipo_function::Function |
| name | A name for this object |
Definition at line 36 of file Constraint.cc.
References ipo::detail::Var::model.
| Constraint::Constraint | ( | detail::ModelBase & | model, |
| detail::SharedFunctionPtr | function, | ||
| char const *const | name = 0 |
||
| ) |
Use this constructor to construct from a ipo_function::SharedFunctionPtr object.
| model | A Model |
| function | A ipo_function::SharedFunctionPtr object |
| name | A name for this object |
Definition at line 40 of file Constraint.cc.
References ipo::detail::Var::model.
| Constraint::Constraint | ( | detail::ModelBase & | model, |
| ipo_function::Function * | function, | ||
| char const *const | name = 0 |
||
| ) |
Use this constructor to construct from a pointer to a ipo_function::Function object.
The Function object should be constructed using new and should not be deleted explicitly.
| model | A Model |
| function | A pointer to an object of a subclass of ipo_function::Function |
| name | A name for this object |
Definition at line 44 of file Constraint.cc.
References ipo::detail::Var::model.
| Constraint::Constraint | ( | detail::ModelBase & | model, |
| ipo_function::Function & | function, | ||
| char const *const | name = 0 |
||
| ) |
Constructor.
| model | A Model |
| function | An object of a subclass of ipo_function::Function |
| name | A name for this object |
Definition at line 48 of file Constraint.cc.
References ipo::detail::Var::model.
| Constraint::Constraint | ( | Constraint const & | constraint | ) |
Copy constructor.
| constraint | A Constraint object to copy |
Definition at line 82 of file Constraint.cc.
|
inline |
Move constructor.
| constraint | A Constraint object to copy |
Definition at line 131 of file Constraint.hpp.
| double Constraint::getLowerBound | ( | ) | const |
Get lower bound of Constraint.
Definition at line 58 of file Constraint.cc.
References ipo::Objective::data.
Referenced by ipo::LinearConstraint::isEqualityConstraint(), and summary().
| double Constraint::getUpperBound | ( | ) | const |
Get upper bound of Constraint.
Definition at line 53 of file Constraint.cc.
References ipo::Objective::data.
Referenced by ipo::LinearConstraint::isEqualityConstraint(), and summary().
| Constraint & Constraint::operator= | ( | Constraint const & | constraint | ) |
Assignment operator.
| constraint | The constraint to be copied |
*this Definition at line 86 of file Constraint.cc.
References ipo::Objective::data, ipo::detail::ModelFunction::function, and ipo::detail::Var::model.
|
inline |
Move assignment operator.
| constraint | The constraint to be moved |
*this Definition at line 137 of file Constraint.hpp.
References ipo::Objective::data, ipo::detail::ModelFunction::function, and ipo::detail::Var::model.
|
virtual |
Set lower bound of Constraint.
This may invalidate value set if the value is less than the lower bound
| lowerBound | The new lower bound. |
| IPOException | if new lower bound greater than or equal to upper bound |
Reimplemented in ipo::LinearConstraint.
Definition at line 70 of file Constraint.cc.
References ipo::Objective::data, IPOE, and lowerBound.
|
virtual |
Set upper bound of Constraint.
This may invalidate value set if the value is not less than the upper bound
| upperBound | The new upper bound. |
| IPOException | if new upper bound less than or equal to lower bound |
Reimplemented in ipo::LinearConstraint.
Definition at line 63 of file Constraint.cc.
References ipo::Objective::data, IPOE, lowerBound, and upperBound.
|
overridevirtual |
Create a summary of this function.
This should be a description of the constraint function and its variables together with the bounds.
| ostream | The stream to print to. |
| prefix | This is put in front of every row of output, for example for indentation |
Reimplemented from ipo::Objective.
Definition at line 94 of file Constraint.cc.
References getLowerBound(), ipo::Objective::getName(), getUpperBound(), ipo::format::infinity, and ipo::Objective::value().
|
friend |