shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT > Class Template Referenceabstract

An optimizer that optimizes general objective functions. More...

#include <shark/Algorithms/AbstractOptimizer.h>

+ Inheritance diagram for shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >:
+ Collaboration diagram for shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >:

Public Types

enum  Feature {
  REQUIRES_VALUE = 1, REQUIRES_FIRST_DERIVATIVE = 2, REQUIRES_SECOND_DERIVATIVE = 4, CAN_SOLVE_CONSTRAINED = 8,
  REQUIRES_CLOSEST_FEASIBLE = 16
}
 Models features that the optimizer requires from the objective function. More...
 
typedef SearchSpaceT SearchSpaceType
 
typedef SearchSpaceType::PointType SearchPointType
 
typedef ResultT ResultType
 
typedef SetT SolutionSetType
 
typedef
AbstractObjectiveFunction
< SearchSpaceType, ResultType
ObjectiveFunctionType
 
typedef TypedFlags< FeatureFeatures
 
typedef
TypedFeatureNotAvailableException
< Feature
FeatureNotAvailableException
 

Public Member Functions

const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool requiresValue () const
 
bool requiresFirstDerivative () const
 
bool requiresSecondDerivative () const
 
bool canSolveConstrained () const
 
bool requiresClosestFeasible () const
 
virtual ~AbstractOptimizer ()
 Empty virtual d'tor. More...
 
virtual void init (ObjectiveFunctionType const &function)=0
 Initialize the optimizer for the supplied objective function. More...
 
virtual void step (ObjectiveFunctionType const &function)=0
 Carry out one step of the optimizer for the supplied objective function. More...
 
virtual SolutionSetType const & solution () const =0
 Accesses the best solution obtained so far. More...
 
- Public Member Functions inherited from shark::IConfigurable
virtual ~IConfigurable ()
 Virtual d'tor. More...
 
virtual void configure (const PropertyTree &node)
 Configures the component given a property tree. More...
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
virtual std::string name () const
 returns the name of the object More...
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
virtual void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
virtual void write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Member Functions

void checkFeatures (const ObjectiveFunctionType &objectiveFunction)
 Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer. More...
 

Protected Attributes

Features m_features
 

Detailed Description

template<typename SearchSpaceT, typename ResultT, typename SetT>
class shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >

An optimizer that optimizes general objective functions.

After construction and configurationg the optimizer, init() is called with the objective function to be used. After that step() can be called until the required solution is found. The solution can be queried using solution(). The type of the solution depends on the optimisation problem at hand. It is allowed to add constrains on the features the objective function needs to offer

These are:

  • REQUIRES_VALUE: The function is evaluated to use the optimizer and the HAS_VALUE-flag must be set
  • REQUIRES_FIRST_DERIVATIVE: The first derivative needs to be evaluated and
  • HAS_FIRST_DERIVATIVE must be set
  • REQUIRES_SECOND_DERIVATIVE: The second derivative needs to be evaluated and
  • HAS_SECOND_DERIVATIVE must be set
  • CAN_SOLVE_CONSTRAINED: The optimizer can solve functions which are constrained and where the IS_CONSTRAINED_FEATURE is set.
  • REQUIRES_CLOSEST_FEASIBLE: If the function is constrained, it must offer a way to construct the closest feasible point and
  • CAN_PROVIDE_CLOSEST_FEASIBLE must be set

Also when init() is called as offered by the AbstractOptimizer interface, the function is required to have the CAN_PROPOSE_STARTING_POINT flag.

Template Parameters
SearchSpaceTThe type of search space the optimizer works upon.
ResultTThe objective space the optimizer works upon.
SetTDon't know.

Definition at line 74 of file AbstractOptimizer.h.

Member Typedef Documentation

template<typename SearchSpaceT, typename ResultT, typename SetT>
typedef TypedFeatureNotAvailableException<Feature> shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::FeatureNotAvailableException

Definition at line 94 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
typedef TypedFlags<Feature> shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::Features

Definition at line 94 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
typedef AbstractObjectiveFunction<SearchSpaceType,ResultType> shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::ObjectiveFunctionType

Definition at line 80 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
typedef ResultT shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::ResultType

Definition at line 78 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
typedef SearchSpaceType::PointType shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::SearchPointType

Definition at line 77 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
typedef SearchSpaceT shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::SearchSpaceType

Definition at line 76 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
typedef SetT shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::SolutionSetType

Definition at line 79 of file AbstractOptimizer.h.

Member Enumeration Documentation

template<typename SearchSpaceT, typename ResultT, typename SetT>
enum shark::AbstractOptimizer::Feature

Models features that the optimizer requires from the objective function.

See Also
AbstractObjectiveFunction
Enumerator
REQUIRES_VALUE 
REQUIRES_FIRST_DERIVATIVE 
REQUIRES_SECOND_DERIVATIVE 
CAN_SOLVE_CONSTRAINED 
REQUIRES_CLOSEST_FEASIBLE 

Definition at line 86 of file AbstractOptimizer.h.

Constructor & Destructor Documentation

template<typename SearchSpaceT, typename ResultT, typename SetT>
virtual shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::~AbstractOptimizer ( )
inlinevirtual

Empty virtual d'tor.

Definition at line 116 of file AbstractOptimizer.h.

Member Function Documentation

template<typename SearchSpaceT, typename ResultT, typename SetT>
bool shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::canSolveConstrained ( ) const
inline

Definition at line 106 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
void shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::checkFeatures ( const ObjectiveFunctionType objectiveFunction)
inlineprotected

Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer.

Parameters
[in]objectiveFunctionThe function to match with.
Exceptions
shark::Exception

Definition at line 142 of file AbstractOptimizer.h.

Referenced by shark::CG::init(), shark::SteepestDescent::init(), shark::IRLS::init(), shark::BFGS::init(), shark::LBFGS::init(), shark::NoisyRprop::init(), shark::Quickprop::init(), shark::RpropMinus::init(), shark::QuickpropOriginal::init(), and shark::IRpropPlus::init().

template<typename SearchSpaceT, typename ResultT, typename SetT>
virtual void shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::init ( ObjectiveFunctionType const &  function)
pure virtual

Initialize the optimizer for the supplied objective function.

Parameters
[in]functionThe objective function to initialize for.

Implemented in shark::AbstractMultiObjectiveOptimizer< SearchSpace >, shark::AbstractSingleObjectiveOptimizer< SearchSpace >, and shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >.

template<typename SearchSpaceT, typename ResultT, typename SetT>
bool shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::requiresClosestFeasible ( ) const
inline

Definition at line 109 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
bool shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::requiresFirstDerivative ( ) const
inline

Definition at line 100 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
bool shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::requiresSecondDerivative ( ) const
inline

Definition at line 103 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
bool shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::requiresValue ( ) const
inline

Definition at line 96 of file AbstractOptimizer.h.

template<typename SearchSpaceT, typename ResultT, typename SetT>
virtual SolutionSetType const& shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::solution ( ) const
pure virtual

Accesses the best solution obtained so far.

Returns
An immutable reference to the best solution obtained so far.

Implemented in shark::AbstractMultiObjectiveOptimizer< SearchSpace >, shark::AbstractSingleObjectiveOptimizer< SearchSpace >, and shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >.

template<typename SearchSpaceT, typename ResultT, typename SetT>
virtual void shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::step ( ObjectiveFunctionType const &  function)
pure virtual
template<typename SearchSpaceT, typename ResultT, typename SetT>
virtual void shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::updateFeatures ( )
inlinevirtual

Definition at line 94 of file AbstractOptimizer.h.

Member Data Documentation


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