Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
ipo::detail::ModelFunction Class Referenceabstract

Abstract base class for Objective and Constraint. More...

#include <ModelFunction.hpp>

Inheritance diagram for ipo::detail::ModelFunction:
Inheritance graph
Collaboration diagram for ipo::detail::ModelFunction:
Collaboration graph

Public Member Functions

 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...
 
virtual ipo::ArraygetVariables ()=0
 Get variables used by Objective or Constraint function. More...
 
virtual void addVariable (ipo::Variable &variable)
 Add a Variable to the end of the Array of variables. 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::FunctiongetFunction ()
 Get function. More...
 

Protected Attributes

SharedFunctionPtr function
 The objective or constraint function. More...
 

Detailed Description

Abstract base class for Objective and Constraint.

Definition at line 32 of file ModelFunction.hpp.

Constructor & Destructor Documentation

ModelFunction::ModelFunction ( SharedFunctionPtr  function)

Use this constructor to construct from a SharedFunctionPtr object.

Parameters
functionA SharedFunctionPtr object

Definition at line 28 of file ModelFunction.cc.

ModelFunction::ModelFunction ( ipo_function::Function function)

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.

Parameters
functionA pointer to an object of a subclass of ipo_function::Function

Definition at line 31 of file ModelFunction.cc.

ModelFunction::ModelFunction ( ipo_function::Function function)

Use this constructor to construct from a ipo_function::Function object by reference.

The Function object must remain in scope for the Objective object to be useable.

Parameters
functionAn object of a subclass of ipo_function::Function

Definition at line 34 of file ModelFunction.cc.

Member Function Documentation

void ModelFunction::addVariable ( ipo::Variable variable)
virtual

Add a Variable to the end of the Array of variables.

Parameters
variableThe Variable to add
Exceptions
IPOExceptionif Model objects do not match

Reimplemented in ipo::Objective.

Definition at line 45 of file ModelFunction.cc.

References getVariables(), ipo::Array::push_back(), and RETHROW.

bool ModelFunction::checkSize ( ) const

Check size of vector for function arguments matches number of variables supplied.

If the function vector size is not specified, return true.

Returns
true or false according as size of vector for function arguments matches number of variables supplied or not
See also
Model::checkSize()

Definition at line 38 of file ModelFunction.cc.

References getVariables(), and ipo::Array::size().

Referenced by ipo::Model::checkSize().

virtual::ipo_function::Function* ipo::detail::ModelFunction::getFunction ( )
inline
std::tuple< size_t, size_t > ModelFunction::getSizes ( ) const

Get size of vector for function arguments and number of variables supplied.

Returns
size of vector for function arguments and number of variables supplied.

Definition at line 54 of file ModelFunction.cc.

References getVariables(), and ipo::Array::size().

Referenced by ipo::Model::testSizes().

virtual ipo::Array& ipo::detail::ModelFunction::getVariables ( )
pure virtual

Get variables used by Objective or Constraint function.

Returns
variables The variables used by Constraint function

Implemented in ipo::Objective.

Referenced by addVariable(), checkSize(), and getSizes().

Member Data Documentation

SharedFunctionPtr ipo::detail::ModelFunction::function
protected

The objective or constraint function.

Definition at line 86 of file ModelFunction.hpp.

Referenced by ipo::Objective::operator=(), and ipo::Constraint::operator=().


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