Base class for all single objective optimizer. More...
#include <shark/Algorithms/AbstractSingleObjectiveOptimizer.h>
Public Types | |
typedef base_type::SearchPointType | SearchPointType |
typedef base_type::SolutionType | SolutionType |
typedef base_type::ResultType | ResultType |
typedef base_type::ObjectiveFunctionType | ObjectiveFunctionType |
Public Types inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > > | |
enum | Feature |
Models features that the optimizer requires from the objective function. More... | |
typedef PointType | SearchPointType |
typedef double | ResultType |
typedef SingleObjectiveResultSet< PointType > | SolutionType |
typedef AbstractObjectiveFunction< PointType, ResultType > | ObjectiveFunctionType |
typedef TypedFlags< Feature > | Features |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Member Functions | |
std::size_t | numInitPoints () const |
By default most single objective optimizers only require a single point. | |
virtual void | init (ObjectiveFunctionType const &function, std::vector< SearchPointType > const &initPoints) |
Initialize the optimizer for the supplied objective function using a set of initialisation points. | |
virtual void | init (ObjectiveFunctionType const &function, SearchPointType const &startingPoint)=0 |
initializes the optimizer using a predefined starting point | |
virtual const SolutionType & | solution () const |
returns the current solution of the optimizer | |
Public Member Functions inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > > | |
const Features & | features () const |
virtual void | updateFeatures () |
bool | requiresValue () const |
bool | requiresFirstDerivative () const |
bool | requiresSecondDerivative () const |
bool | canSolveConstrained () const |
bool | requiresClosestFeasible () const |
virtual | ~AbstractOptimizer () |
virtual void | init (ObjectiveFunctionType const &function) |
Initialize the optimizer for the supplied objective function. | |
virtual void | step (ObjectiveFunctionType const &function)=0 |
Carry out one step of the optimizer for the supplied objective function. | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
virtual std::string | name () const |
returns the name of the object | |
Public Member Functions inherited from shark::ISerializable | |
virtual | ~ISerializable () |
Virtual d'tor. | |
virtual void | read (InArchive &archive) |
Read the component from the supplied archive. | |
virtual void | write (OutArchive &archive) const |
Write the component to the supplied archive. | |
void | load (InArchive &archive, unsigned int version) |
Versioned loading of components, calls read(...). | |
void | save (OutArchive &archive, unsigned int version) const |
Versioned storing of components, calls write(...). | |
BOOST_SERIALIZATION_SPLIT_MEMBER () | |
Protected Attributes | |
SolutionType | m_best |
Current solution of the optimizer. | |
Protected Attributes inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > > | |
Features | m_features |
Additional Inherited Members | |
Protected Member Functions inherited from shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > > | |
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. | |
Base class for all single objective optimizer.
This class is a spezialization of the AbstractOptimizer itnerface for the class of single objective optimizers. A single objective optimizer is an optimizer which can only optimize functions with a single objective. This is the default case for most optimisation problems. the class requires the ObjectiveFunction to provide a feasible starting point. If this is not possible, a second version of init is provided where the starting point can be explicitely defined. The Return type of an SingleObjectiveOptimizer is the SingleObjectiveResultSet which is a struct returning the best value of the function and together with it's point.
Definition at line 61 of file AbstractSingleObjectiveOptimizer.h.
typedef base_type::ObjectiveFunctionType shark::AbstractSingleObjectiveOptimizer< PointType >::ObjectiveFunctionType |
Definition at line 68 of file AbstractSingleObjectiveOptimizer.h.
typedef base_type::ResultType shark::AbstractSingleObjectiveOptimizer< PointType >::ResultType |
Definition at line 67 of file AbstractSingleObjectiveOptimizer.h.
typedef base_type::SearchPointType shark::AbstractSingleObjectiveOptimizer< PointType >::SearchPointType |
Definition at line 65 of file AbstractSingleObjectiveOptimizer.h.
typedef base_type::SolutionType shark::AbstractSingleObjectiveOptimizer< PointType >::SolutionType |
Definition at line 66 of file AbstractSingleObjectiveOptimizer.h.
|
pure virtual |
initializes the optimizer using a predefined starting point
Implemented in shark::CMA, shark::CMSA, shark::CrossEntropyMethod, shark::ElitistCMA, shark::LMCMA, shark::VDCMA, shark::GridSearch, shark::NestedGridSearch, shark::PointSearch, and shark::SimplexDownhill.
|
inlinevirtual |
Initialize the optimizer for the supplied objective function using a set of initialisation points.
The default implementation picks either the first point in the set, or if it is enmpty, trys to generate one from the function.
Be aware that function.init() has to be called before calling this function!
[in] | function | The objective function to initialize for. |
[in] | initPoints | points used for initialisation. Should be at least numInitPoints(). |
Implements shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > >.
Definition at line 86 of file AbstractSingleObjectiveOptimizer.h.
References shark::AbstractSingleObjectiveOptimizer< PointType >::init().
Referenced by shark::AbstractSingleObjectiveOptimizer< PointType >::init(), and shark::OptimizationTrainer< Model, LabelTypeT >::train().
|
inlinevirtual |
By default most single objective optimizers only require a single point.
Implements shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > >.
Definition at line 71 of file AbstractSingleObjectiveOptimizer.h.
|
inlinevirtual |
returns the current solution of the optimizer
Implements shark::AbstractOptimizer< PointType, double, SingleObjectiveResultSet< PointType > >.
Definition at line 96 of file AbstractSingleObjectiveOptimizer.h.
References shark::AbstractSingleObjectiveOptimizer< PointType >::m_best.
Referenced by main(), main(), run_one_trial(), shark::OptimizationTrainer< Model, LabelTypeT >::train(), and trainRBM().
|
protected |
Current solution of the optimizer.
Definition at line 102 of file AbstractSingleObjectiveOptimizer.h.
Referenced by shark::Adam< SearchPointType >::init(), shark::SteepestDescent< SearchPointType >::init(), shark::Adam< SearchPointType >::read(), shark::AbstractSingleObjectiveOptimizer< PointType >::solution(), shark::Adam< SearchPointType >::step(), shark::SteepestDescent< SearchPointType >::step(), and shark::Adam< SearchPointType >::write().