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< Feature > | Features |
| typedef TypedFeatureNotAvailableException < Feature > | FeatureNotAvailableException |
Public Member Functions | |
| const Features & | features () 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 |
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:
Also when init() is called as offered by the AbstractOptimizer interface, the function is required to have the CAN_PROPOSE_STARTING_POINT flag.
| SearchSpaceT | The type of search space the optimizer works upon. |
| ResultT | The objective space the optimizer works upon. |
| SetT | Don't know. |
Definition at line 74 of file AbstractOptimizer.h.
| typedef TypedFeatureNotAvailableException<Feature> shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::FeatureNotAvailableException |
Definition at line 94 of file AbstractOptimizer.h.
| typedef TypedFlags<Feature> shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::Features |
Definition at line 94 of file AbstractOptimizer.h.
| typedef AbstractObjectiveFunction<SearchSpaceType,ResultType> shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::ObjectiveFunctionType |
Definition at line 80 of file AbstractOptimizer.h.
| typedef ResultT shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::ResultType |
Definition at line 78 of file AbstractOptimizer.h.
| typedef SearchSpaceType::PointType shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::SearchPointType |
Definition at line 77 of file AbstractOptimizer.h.
| typedef SearchSpaceT shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::SearchSpaceType |
Definition at line 76 of file AbstractOptimizer.h.
| typedef SetT shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >::SolutionSetType |
Definition at line 79 of file AbstractOptimizer.h.
| enum shark::AbstractOptimizer::Feature |
Models features that the optimizer requires from the objective function.
| Enumerator | |
|---|---|
| REQUIRES_VALUE | |
| REQUIRES_FIRST_DERIVATIVE | |
| REQUIRES_SECOND_DERIVATIVE | |
| CAN_SOLVE_CONSTRAINED | |
| REQUIRES_CLOSEST_FEASIBLE | |
Definition at line 86 of file AbstractOptimizer.h.
|
inlinevirtual |
Empty virtual d'tor.
Definition at line 116 of file AbstractOptimizer.h.
|
inline |
Definition at line 106 of file AbstractOptimizer.h.
|
inlineprotected |
Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer.
| [in] | objectiveFunction | The function to match with. |
| 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().
|
inline |
Definition at line 94 of file AbstractOptimizer.h.
Referenced by shark::AbstractOptimizer< SearchSpace, double, SingleObjectiveResultSet< SearchSpace::PointType > >::canSolveConstrained(), shark::AbstractOptimizer< SearchSpace, double, SingleObjectiveResultSet< SearchSpace::PointType > >::requiresClosestFeasible(), shark::AbstractOptimizer< SearchSpace, double, SingleObjectiveResultSet< SearchSpace::PointType > >::requiresFirstDerivative(), shark::AbstractOptimizer< SearchSpace, double, SingleObjectiveResultSet< SearchSpace::PointType > >::requiresSecondDerivative(), and shark::AbstractOptimizer< SearchSpace, double, SingleObjectiveResultSet< SearchSpace::PointType > >::requiresValue().
|
pure virtual |
Initialize the optimizer for the supplied objective function.
| [in] | function | The objective function to initialize for. |
Implemented in shark::AbstractMultiObjectiveOptimizer< SearchSpace >, shark::AbstractSingleObjectiveOptimizer< SearchSpace >, and shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >.
|
inline |
Definition at line 109 of file AbstractOptimizer.h.
|
inline |
Definition at line 100 of file AbstractOptimizer.h.
|
inline |
Definition at line 103 of file AbstractOptimizer.h.
|
inline |
Definition at line 96 of file AbstractOptimizer.h.
|
pure virtual |
Accesses the best solution obtained so far.
Implemented in shark::AbstractMultiObjectiveOptimizer< SearchSpace >, shark::AbstractSingleObjectiveOptimizer< SearchSpace >, and shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >.
|
pure virtual |
Carry out one step of the optimizer for the supplied objective function.
| [in] | function | The objective function to initialize for. |
Implemented in shark::PointSearch, shark::IRpropMinus, shark::NestedGridSearch, shark::IRpropPlus, shark::RpropPlus, shark::GridSearch, shark::CMA, shark::QuickpropOriginal, shark::CMSA, shark::OnePlusOneES, shark::RpropMinus, shark::Quickprop, shark::SteepestDescent, shark::LBFGS, shark::NoisyRprop, shark::IRLS, shark::BFGS, and shark::CG.
Referenced by shark::OptimizationTrainer< Model, LabelTypeT >::train().
|
inlinevirtual |
Definition at line 94 of file AbstractOptimizer.h.
|
protected |
Definition at line 94 of file AbstractOptimizer.h.
Referenced by shark::BFGS::BFGS(), shark::CG::CG(), shark::AbstractOptimizer< SearchSpace, double, SingleObjectiveResultSet< SearchSpace::PointType > >::checkFeatures(), shark::CMA::CMA(), shark::CMSA::CMSA(), shark::IRLS::IRLS(), shark::IRpropPlus::IRpropPlus(), shark::LBFGS::LBFGS(), shark::NoisyRprop::NoisyRprop(), shark::OnePlusOneES::OnePlusOneES(), shark::Quickprop::Quickprop(), shark::QuickpropOriginal::QuickpropOriginal(), shark::RpropMinus::RpropMinus(), and shark::SteepestDescent::SteepestDescent().