An optimizer that optimizes general objective functions. More...
#include <shark/Algorithms/AbstractOptimizer.h>
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 PointType | SearchPointType |
typedef ResultT | ResultType |
typedef SolutionTypeT | SolutionType |
typedef AbstractObjectiveFunction< PointType, 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 &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 SolutionType const & | solution () const =0 |
Accesses the best solution obtained so far. More... | |
![]() | |
virtual | ~INameable () |
virtual std::string | name () const |
returns the name of the object More... | |
![]() | |
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 (ObjectiveFunctionType const &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.
PointType | The type of search space the optimizer works upon. |
ResultT | The objective space the optimizer works upon. |
SolutionTypeT | The type of the final solution. |
Definition at line 70 of file AbstractOptimizer.h.
typedef TypedFeatureNotAvailableException<Feature> shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >::FeatureNotAvailableException |
Definition at line 89 of file AbstractOptimizer.h.
typedef TypedFlags<Feature> shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >::Features |
Definition at line 89 of file AbstractOptimizer.h.
typedef AbstractObjectiveFunction<PointType,ResultType> shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >::ObjectiveFunctionType |
Definition at line 75 of file AbstractOptimizer.h.
typedef ResultT shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >::ResultType |
Definition at line 73 of file AbstractOptimizer.h.
typedef PointType shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >::SearchPointType |
Definition at line 72 of file AbstractOptimizer.h.
typedef SolutionTypeT shark::AbstractOptimizer< PointType, ResultT, SolutionTypeT >::SolutionType |
Definition at line 74 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 81 of file AbstractOptimizer.h.
|
inlinevirtual |
Empty virtual d'tor.
Definition at line 111 of file AbstractOptimizer.h.
|
inline |
Definition at line 101 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 140 of file AbstractOptimizer.h.
|
inline |
Definition at line 89 of file AbstractOptimizer.h.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::canSolveConstrained(), shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::requiresClosestFeasible(), shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::requiresFirstDerivative(), shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::requiresSecondDerivative(), and shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::requiresValue().
|
pure virtual |
Initialize the optimizer for the supplied objective function.
This will also call function->init() to reset the internal state of the function, for example the evaluation counter
[in] | function | The objective function to initialize for. |
Implemented in shark::CrossEntropyMethod, shark::IndicatorBasedRealCodedNSGAII< Indicator >, shark::IndicatorBasedMOCMA< Indicator >, shark::IndicatorBasedSteadyStateMOCMA< Indicator >, shark::AbstractMultiObjectiveOptimizer< PointTypeT >, shark::AbstractMultiObjectiveOptimizer< RealVector >, shark::AbstractSingleObjectiveOptimizer< PointType >, and shark::AbstractSingleObjectiveOptimizer< RealVector >.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::~AbstractOptimizer().
|
inline |
Definition at line 104 of file AbstractOptimizer.h.
|
inline |
Definition at line 95 of file AbstractOptimizer.h.
|
inline |
Definition at line 98 of file AbstractOptimizer.h.
|
inline |
Definition at line 91 of file AbstractOptimizer.h.
|
pure virtual |
Accesses the best solution obtained so far.
Implemented in shark::AbstractMultiObjectiveOptimizer< PointTypeT >, shark::AbstractMultiObjectiveOptimizer< RealVector >, shark::AbstractSingleObjectiveOptimizer< PointType >, and shark::AbstractSingleObjectiveOptimizer< RealVector >.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::~AbstractOptimizer().
|
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::IRpropPlusFull, shark::IRpropPlus, shark::LMCMA, shark::GridSearch, shark::RpropPlus, shark::IndicatorBasedRealCodedNSGAII< Indicator >, shark::CrossEntropyMethod, shark::IndicatorBasedMOCMA< Indicator >, shark::SMSEMOA, shark::IndicatorBasedSteadyStateMOCMA< Indicator >, shark::VDCMA, shark::CMA, shark::CMSA, shark::RpropMinus, shark::SimplexDownhill, shark::TrustRegionNewton, shark::SteepestDescent, shark::ElitistCMA, and shark::AbstractLineSearchOptimizer.
Referenced by shark::OptimizationTrainer< Model, LabelTypeT >::train(), and shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::~AbstractOptimizer().
|
inlinevirtual |
Definition at line 89 of file AbstractOptimizer.h.
|
protected |
Definition at line 89 of file AbstractOptimizer.h.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::checkFeatures().