Image Component Library (ICL)
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
icl::math::SimplexOptimizer< T, Vector > Class Template Reference

Template based implementation for the Downhill Simplex Optimiztation method. More...

#include <SimplexOptimizer.h>

Inheritance diagram for icl::math::SimplexOptimizer< T, Vector >:
icl::utils::Uncopyable

Public Types

typedef utils::Function< T, const Vector & > error_function
 error function type that is used More...
 
typedef SimplexOptimizationResult< T, Vector > Result
 
typedef utils::Function< void, const Result & > iteration_callback
 
typedef utils::Function< Vector > init_gen
 

Public Member Functions

 SimplexOptimizer (error_function f, int dim, int iterations=1E5, T minError=1.0E-10, T minDelta=1.0E-10, T a=1.0, T b=1.0, T g=0.5, T h=0.5)
 creates a new instance with given parameters More...
 
void setDim (int dim)
 sets the optimizers dimension (note, that usually the error function must be changed then as well) More...
 
void setA (T a)
 sets the reflection factor More...
 
void setB (T b)
 sets the extenxion factor More...
 
void setG (T g)
 sets the contraction factor More...
 
void setH (T h)
 sets the multiple contraction factor More...
 
void setIterations (int iterations)
 sets the maximum iteration termination criterion More...
 
void setMinError (T minError)
 sets the minimum error termination criterion More...
 
void setMinDelta (T minDelta)
 sets the minimum delta termination criterion More...
 
void setErrorFunction (error_function f)
 sets the error function More...
 
int getDim () const
 returns the data dimesions More...
 
getA () const
 returns the reflection factor More...
 
getB () const
 returns the extension factor More...
 
getG () const
 returns the contraction factor More...
 
getH () const
 returns the multiple contraction factor More...
 
int getIterations () const
 returns the maximum iteration termination criterion More...
 
getMinError () const
 returns the minimum error termination criterion More...
 
getMinDelta () const
 returns the minimum delta termination criterion More...
 
error_function getErrorFunction () const
 returns the curren error function More...
 
void setIterationCallback (const iteration_callback &cb)
 sets a callback function, that is called after every iteration step More...
 
Result optimize (const Vector &init)
 runs an optimization using internal parameters starting at given input vector More...
 
Result optimize (const std::vector< Vector > &init)
 runs an optimization using internal parameters using the given initial simplex More...
 
Result optimize (init_gen gen, int nInitCycles)
 uses the inititalization generator to run the optimization several times with different initialization values More...
 

Static Public Member Functions

static std::vector< Vector > createDefaultSimplex (const Vector &init)
 create a default simplex structure More...
 

Private Attributes

Data * m_data
 internal data structure More...
 

Additional Inherited Members

- Protected Member Functions inherited from icl::utils::Uncopyable
 Uncopyable ()
 Empty base constructor. More...
 

Detailed Description

template<class T, class Vector = DynColVector<T>>
class icl::math::SimplexOptimizer< T, Vector >

Template based implementation for the Downhill Simplex Optimiztation method.

Member Typedef Documentation

◆ error_function

template<class T , class Vector = DynColVector<T>>
typedef utils::Function<T, const Vector&> icl::math::SimplexOptimizer< T, Vector >::error_function

error function type that is used

◆ init_gen

template<class T , class Vector = DynColVector<T>>
typedef utils::Function<Vector> icl::math::SimplexOptimizer< T, Vector >::init_gen

◆ iteration_callback

template<class T , class Vector = DynColVector<T>>
typedef utils::Function<void,const Result &> icl::math::SimplexOptimizer< T, Vector >::iteration_callback

◆ Result

template<class T , class Vector = DynColVector<T>>
typedef SimplexOptimizationResult<T,Vector> icl::math::SimplexOptimizer< T, Vector >::Result

Constructor & Destructor Documentation

◆ SimplexOptimizer()

template<class T , class Vector = DynColVector<T>>
icl::math::SimplexOptimizer< T, Vector >::SimplexOptimizer ( error_function  f,
int  dim,
int  iterations = 1E5,
minError = 1.0E-10,
minDelta = 1.0E-10,
a = 1.0,
b = 1.0,
g = 0.5,
h = 0.5 
)

creates a new instance with given parameters

Parameters
ferror function
dimvector dimension (please note, for fixed dim vector types, this must still be set to the right value)
iterationsmaximum iteration count
minErrorminimum error termination criterion
minDeltaminimum center movement termination criterion
areflection factor (default 1.0)
bexpansion factor (default 1.0)
gcontration factor (default 0.5)
hmultiple contraction factor (default 0.5)

Member Function Documentation

◆ createDefaultSimplex()

template<class T , class Vector = DynColVector<T>>
static std::vector<Vector> icl::math::SimplexOptimizer< T, Vector >::createDefaultSimplex ( const Vector &  init)
static

create a default simplex structure

the initial simplex is created internally using the heuristic shown in the ALGO section.

◆ getA()

template<class T , class Vector = DynColVector<T>>
T icl::math::SimplexOptimizer< T, Vector >::getA ( ) const

returns the reflection factor

◆ getB()

template<class T , class Vector = DynColVector<T>>
T icl::math::SimplexOptimizer< T, Vector >::getB ( ) const

returns the extension factor

◆ getDim()

template<class T , class Vector = DynColVector<T>>
int icl::math::SimplexOptimizer< T, Vector >::getDim ( ) const

returns the data dimesions

◆ getErrorFunction()

template<class T , class Vector = DynColVector<T>>
error_function icl::math::SimplexOptimizer< T, Vector >::getErrorFunction ( ) const

returns the curren error function

◆ getG()

template<class T , class Vector = DynColVector<T>>
T icl::math::SimplexOptimizer< T, Vector >::getG ( ) const

returns the contraction factor

◆ getH()

template<class T , class Vector = DynColVector<T>>
T icl::math::SimplexOptimizer< T, Vector >::getH ( ) const

returns the multiple contraction factor

◆ getIterations()

template<class T , class Vector = DynColVector<T>>
int icl::math::SimplexOptimizer< T, Vector >::getIterations ( ) const

returns the maximum iteration termination criterion

◆ getMinDelta()

template<class T , class Vector = DynColVector<T>>
T icl::math::SimplexOptimizer< T, Vector >::getMinDelta ( ) const

returns the minimum delta termination criterion

◆ getMinError()

template<class T , class Vector = DynColVector<T>>
T icl::math::SimplexOptimizer< T, Vector >::getMinError ( ) const

returns the minimum error termination criterion

◆ optimize() [1/3]

template<class T , class Vector = DynColVector<T>>
Result icl::math::SimplexOptimizer< T, Vector >::optimize ( const Vector &  init)

runs an optimization using internal parameters starting at given input vector

the initial simplex is created internally using the heuristic shown in the ALGO section.

◆ optimize() [2/3]

template<class T , class Vector = DynColVector<T>>
Result icl::math::SimplexOptimizer< T, Vector >::optimize ( const std::vector< Vector > &  init)

runs an optimization using internal parameters using the given initial simplex

the given input simplex must have init[0].dim+1 entries !

◆ optimize() [3/3]

template<class T , class Vector = DynColVector<T>>
Result icl::math::SimplexOptimizer< T, Vector >::optimize ( init_gen  gen,
int  nInitCycles 
)

uses the inititalization generator to run the optimization several times with different initialization values

◆ setA()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setA ( a)

sets the reflection factor

◆ setB()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setB ( b)

sets the extenxion factor

◆ setDim()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setDim ( int  dim)

sets the optimizers dimension (note, that usually the error function must be changed then as well)

◆ setErrorFunction()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setErrorFunction ( error_function  f)

sets the error function

◆ setG()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setG ( g)

sets the contraction factor

◆ setH()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setH ( h)

sets the multiple contraction factor

◆ setIterationCallback()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setIterationCallback ( const iteration_callback cb)

sets a callback function, that is called after every iteration step

◆ setIterations()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setIterations ( int  iterations)

sets the maximum iteration termination criterion

◆ setMinDelta()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setMinDelta ( minDelta)

sets the minimum delta termination criterion

◆ setMinError()

template<class T , class Vector = DynColVector<T>>
void icl::math::SimplexOptimizer< T, Vector >::setMinError ( minError)

sets the minimum error termination criterion

Member Data Documentation

◆ m_data

template<class T , class Vector = DynColVector<T>>
Data* icl::math::SimplexOptimizer< T, Vector >::m_data
private

internal data structure

internal data pointer


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