shark::PointSearch Class Reference

Optimize by trying out predefined configurations. More...

#include <shark/Algorithms/DirectSearch/GridSearch.h>

+ Inheritance diagram for shark::PointSearch:
+ Collaboration diagram for shark::PointSearch:

Public Member Functions

 PointSearch ()
 Constructor. More...
 
std::string name () const
 From INameable: return the class name. More...
 
void configure (const std::vector< RealVector > &points)
 
void configure (size_t parameters, size_t samples, double min, double max)
 samples random points in the range [min,max]^parameters 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 init (const ObjectiveFunctionType &objectiveFunction, const SearchPointType &startingPoint)
 If the class wasn't configured before, this method samples random uniform distributed points in [-1,1]^n. More...
 
void step (const ObjectiveFunctionType &objectiveFunction)
 
- Public Member Functions inherited from shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >
virtual void init (ObjectiveFunctionType const &function)
 
virtual const SolutionSetTypesolution () const
 returns the current solution of the optimizer More...
 
- Public Member Functions inherited from shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >
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...
 
- 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 ()
 
- 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< RealVector > m_points
 The array holds one parameter configuration in every column. More...
 
bool m_configured
 verbosity level More...
 
- Protected Attributes inherited from shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >
SolutionSetType m_best
 current solution of the optimizer More...
 
- Protected Attributes inherited from shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >
Features m_features
 

Additional Inherited Members

- Public Types inherited from shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >
typedef base_type::SearchSpaceType SearchSpaceType
 
typedef base_type::SearchPointType SearchPointType
 
typedef base_type::SolutionSetType SolutionSetType
 
typedef base_type::ResultType ResultType
 
typedef
base_type::ObjectiveFunctionType 
ObjectiveFunctionType
 
- Protected Member Functions inherited from shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >
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...
 

Detailed Description

Optimize by trying out predefined configurations.

The PointSearch class is similair to the GridSearch class by the property that it optimizes a model in a single pass just trying out a predefined number of parameter configurations. The main difference is that every parameter configuration has to be explicitly defined. It is not possible to define a set of values for every axis; see GridSearch for this purpose. Thus, the PointSearch class allows for more flexibility.

If no configure method is called, this class just samples random points. They are uniformly distributed in [-1,1]. parameters^2 points but minimum 20 are sampled in this case.

Definition at line 541 of file GridSearch.h.

Constructor & Destructor Documentation

shark::PointSearch::PointSearch ( )
inline

Constructor.

Definition at line 545 of file GridSearch.h.

References m_configured.

Member Function Documentation

void shark::PointSearch::configure ( const std::vector< RealVector > &  points)
inline

Initialization of the search points.

Parameters
pointsarray of points to evaluate

Definition at line 555 of file GridSearch.h.

References m_configured, and m_points.

Referenced by init().

void shark::PointSearch::configure ( size_t  parameters,
size_t  samples,
double  min,
double  max 
)
inline

samples random points in the range [min,max]^parameters

Definition at line 561 of file GridSearch.h.

References m_configured, m_points, shark::parameters(), and RANGE_CHECK.

void shark::PointSearch::init ( const ObjectiveFunctionType objectiveFunction,
const SearchPointType startingPoint 
)
inlinevirtual

If the class wasn't configured before, this method samples random uniform distributed points in [-1,1]^n.

Implements shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >.

Definition at line 592 of file GridSearch.h.

References configure(), m_configured, shark::blas::min(), shark::parameters(), and shark::sqr().

std::string shark::PointSearch::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 550 of file GridSearch.h.

virtual void shark::PointSearch::read ( InArchive archive)
inlinevirtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Definition at line 575 of file GridSearch.h.

References shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >::m_best, m_configured, and m_points.

void shark::PointSearch::step ( const ObjectiveFunctionType objectiveFunction)
inlinevirtual

Please note that for the point search optimizer it does not make sense to call step more than once, as the solution does not improve iteratively.

Implements shark::AbstractOptimizer< SearchSpaceT, ResultT, SetT >.

Definition at line 606 of file GridSearch.h.

References shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::eval(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::isFeasible(), shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >::m_best, and m_points.

virtual void shark::PointSearch::write ( OutArchive archive) const
inlinevirtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Definition at line 583 of file GridSearch.h.

References shark::AbstractSingleObjectiveOptimizer< VectorSpace< double > >::m_best, m_configured, and m_points.

Member Data Documentation

bool shark::PointSearch::m_configured
protected

verbosity level

Definition at line 633 of file GridSearch.h.

Referenced by configure(), init(), PointSearch(), read(), and write().

std::vector<RealVector> shark::PointSearch::m_points
protected

The array holds one parameter configuration in every column.

Definition at line 630 of file GridSearch.h.

Referenced by configure(), read(), step(), and write().


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