Nested grid search. More...
#include <shark/Algorithms/DirectSearch/GridSearch.h>
Public Member Functions | |
NestedGridSearch () | |
Constructor. More... | |
std::string | name () const |
From INameable: return the class name. More... | |
void | configure (const std::vector< double > &min, const std::vector< double > &max) |
Initialization of the nested grid search. More... | |
void | configure (size_t parameters, double min, double max) |
Initialization of the nested grid search. 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... | |
virtual void | init (ObjectiveFunctionType const &objectiveFunction, SearchPointType const &startingPoint) |
if NestedGridSearch was not configured before this call, it is default initialized ti the range[-1,1] for every parameter More... | |
void | step (ObjectiveFunctionType const &objectiveFunction) |
Public Member Functions inherited from shark::AbstractSingleObjectiveOptimizer< RealVector > | |
std::size_t | numInitPoints () const |
By default most single objective optimizers only require a single point. More... | |
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. More... | |
virtual const SolutionType & | solution () const |
returns the current solution of the optimizer More... | |
Public Member Functions inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > > | |
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. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Public Member Functions inherited from shark::ISerializable | |
virtual | ~ISerializable () |
Virtual d'tor. 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 Attributes | |
std::vector< double > | m_minimum |
minimum parameter value to check More... | |
std::vector< double > | m_maximum |
maximum parameter value to check More... | |
std::vector< double > | m_stepsize |
current step size for every parameter More... | |
bool | m_configured |
Protected Attributes inherited from shark::AbstractSingleObjectiveOptimizer< RealVector > | |
SolutionType | m_best |
Current solution of the optimizer. More... | |
Protected Attributes inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > > | |
Features | m_features |
Additional Inherited Members | |
Public Types inherited from shark::AbstractSingleObjectiveOptimizer< RealVector > | |
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< RealVector, double, SingleObjectiveResultSet< RealVector > > | |
enum | Feature |
Models features that the optimizer requires from the objective function. More... | |
typedef RealVector | SearchPointType |
typedef double | ResultType |
typedef SingleObjectiveResultSet< RealVector > | SolutionType |
typedef AbstractObjectiveFunction< RealVector, ResultType > | ObjectiveFunctionType |
typedef TypedFlags< Feature > | Features |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Protected Member Functions inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > > | |
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... | |
Nested grid search.
Definition at line 373 of file GridSearch.h.
|
inline |
Constructor.
Definition at line 377 of file GridSearch.h.
References shark::GridSearch::m_configured.
|
inline |
Initialization of the nested grid search.
min | lower end of the parameter range |
max | upper end of the parameter range |
Definition at line 398 of file GridSearch.h.
|
inline |
Initialization of the nested grid search.
parameters | number of parameters to optimize |
min | lower end of the parameter range |
max | upper end of the parameter range |
Definition at line 427 of file GridSearch.h.
|
inlinevirtual |
if NestedGridSearch was not configured before this call, it is default initialized ti the range[-1,1] for every parameter
Implements shark::AbstractSingleObjectiveOptimizer< RealVector >.
Definition at line 465 of file GridSearch.h.
References shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >::checkFeatures(), shark::GridSearch::configure(), shark::GridSearch::m_configured, and SIZE_CHECK.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 383 of file GridSearch.h.
|
inlinevirtual |
Read the component from the supplied archive.
[in,out] | archive | The archive to read from. |
Reimplemented from shark::ISerializable.
Definition at line 444 of file GridSearch.h.
References shark::AbstractSingleObjectiveOptimizer< RealVector >::m_best, shark::GridSearch::m_configured, shark::ResultSet< SearchPointT, ResultT >::point, and shark::ResultSet< SearchPointT, ResultT >::value.
|
inlinevirtual |
Every call of the optimization member computes the error landscape on the current grid. It picks the best error value and zooms into the error landscape by a factor of 2.
Implements shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >.
Definition at line 480 of file GridSearch.h.
References shark::AbstractObjectiveFunction< PointType, ResultT >::eval(), shark::AbstractObjectiveFunction< PointType, ResultT >::isFeasible(), shark::AbstractSingleObjectiveOptimizer< RealVector >::m_best, shark::ResultSet< SearchPointT, ResultT >::point, SIZE_CHECK, shark::GridSearch::step(), and shark::ResultSet< SearchPointT, ResultT >::value.
|
inlinevirtual |
Write the component to the supplied archive.
[in,out] | archive | The archive to write to. |
Reimplemented from shark::ISerializable.
Definition at line 454 of file GridSearch.h.
References shark::AbstractSingleObjectiveOptimizer< RealVector >::m_best, shark::GridSearch::m_configured, shark::ResultSet< SearchPointT, ResultT >::point, and shark::ResultSet< SearchPointT, ResultT >::value.
|
protected |
Definition at line 544 of file GridSearch.h.
|
protected |
maximum parameter value to check
Definition at line 539 of file GridSearch.h.
|
protected |
minimum parameter value to check
Definition at line 536 of file GridSearch.h.
|
protected |
current step size for every parameter
Definition at line 542 of file GridSearch.h.