Direct Graphical Models  v.1.7.0
DirectGraphicalModels::CPowell Class Reference

The Powell search method class. More...

#include <Powell.h>

Collaboration diagram for DirectGraphicalModels::CPowell:

Public Member Functions

 CPowell (size_t nParams)
 Constructor. More...
 
 CPowell (const CPowell &)=delete
 
 ~CPowell (void)=default
 
const CPowelloperator= (const CPowell &)=delete
 
void reset (void)
 Resets class variables. More...
 
void setInitParams (const vec_float_t &vParams)
 Sets the initial parameters (arguments) for the search algorithm. More...
 
void setDeltas (const vec_float_t &vDeltas)
 Sets the searching steps along the parameters (arguments) More...
 
void setMinParams (const vec_float_t &vMinParam)
 Sets the lower boundary for parameters (arguments) search. More...
 
void setMaxParams (const vec_float_t &vMaxParam)
 Sets the upper boundary for parameters (arguments) search. More...
 
void setAcceleration (float acceleration)
 Sets the acceleration coefficient. More...
 
vec_float_t getParams (float val)
 Gets the updated parameters (arguments) More...
 
bool isConverged (void) const
 Indicates weather the method has converged. More...
 

Private Types

enum  { mD, oD, pD }
 coordinates of the Kappa function More...
 

Private Attributes

size_t m_nParams
 
size_t m_paramID
 
size_t m_nSteps
 
float m_midPoint
 
float m_koeff
 
float m_acceleration
 
vec_float_t m_vParams
 
vec_float_t m_vDeltas
 
vec_float_t m_vMin
 
vec_float_t m_vMax
 
vec_float_t m_vKappa
 
vec_bool_t m_vConverged
 

Detailed Description

The Powell search method class.

The Powell search method is an iterative optimisation algortihm that does not require an estimate for the gradient of the objective function: \( f:\mathbb{R}^n\rightarrow\mathbb{R} \), where \( n \) is the number of parameters (arguments). In order to find the extremum point, one may use the common case:

using namespace DirectGraphicalModels;
const word nParams = 2;
const vec_float_t vInitParams = {0.0f, 0.0f}; // coordinates of the initial point for the search algorithm
const vec_float_t vInitDeltas = {0.1f, 0.1f}; // searching steps along the parameters (arguments)
vec_float_t vParams = vInitParams;
CPowell powell(nParams);
powell.setInitParams(vInitParams);
powell.setDeltas(vInitDeltas);
while(!powell.isConverged()) {
float val = objectiveFunction(vParams);
vParams = powell.getParams(val);
}
Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 37 of file Powell.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

coordinates of the Kappa function

Enumerator
mD 

minus Delta

oD 

null Delta (current position)

pD 

plus Delta

Definition at line 130 of file Powell.h.

Constructor & Destructor Documentation

◆ CPowell() [1/2]

DirectGraphicalModels::CPowell::CPowell ( size_t  nParams)

Constructor.

Parameters
nParamsNumber of parameters (arguments) of the objective function

Definition at line 7 of file Powell.cpp.

Here is the call graph for this function:

◆ CPowell() [2/2]

DirectGraphicalModels::CPowell::CPowell ( const CPowell )
delete

◆ ~CPowell()

DirectGraphicalModels::CPowell::~CPowell ( void  )
default

Member Function Documentation

◆ getParams()

vec_float_t DirectGraphicalModels::CPowell::getParams ( float  val)

Gets the updated parameters (arguments)

This function updates the parameters (arguments) of the objective function based on its outcome value val and retunrs them (See example code for more details)

Parameters
valThe current value of the objective function
Returns
The pointer to array with the updated parameters

Definition at line 87 of file Powell.cpp.

Here is the call graph for this function:

◆ isConverged()

bool DirectGraphicalModels::CPowell::isConverged ( void  ) const

Indicates weather the method has converged.

Return values
trueif the method has converged
falseotherwise

Definition at line 176 of file Powell.cpp.

Here is the caller graph for this function:

◆ operator=()

const CPowell& DirectGraphicalModels::CPowell::operator= ( const CPowell )
delete

◆ reset()

void DirectGraphicalModels::CPowell::reset ( void  )

Resets class variables.

Definition at line 19 of file Powell.cpp.

Here is the caller graph for this function:

◆ setAcceleration()

void DirectGraphicalModels::CPowell::setAcceleration ( float  acceleration)

Sets the acceleration coefficient.

Incrasing this parameter may speed-up the convergence of the method, however too large values may affect the calculation stability

Default value is 0.1

Parameters
accelerationThe acceleration coefficient

Definition at line 81 of file Powell.cpp.

◆ setDeltas()

void DirectGraphicalModels::CPowell::setDeltas ( const vec_float_t &  vDeltas)

Sets the searching steps along the parameters (arguments)

Default values are 0.1 for all parameters (arguments)

Parameters
vDeltasAn array with the offset values for each parameter (argument)

Definition at line 74 of file Powell.cpp.

◆ setInitParams()

void DirectGraphicalModels::CPowell::setInitParams ( const vec_float_t &  vParams)

Sets the initial parameters (arguments) for the search algorithm.

Default values are 0 for all parameters (arguments)

Parameters
vParamsAn array with the initial values for the search algorithm

Definition at line 34 of file Powell.cpp.

◆ setMaxParams()

void DirectGraphicalModels::CPowell::setMaxParams ( const vec_float_t &  vMaxParam)

Sets the upper boundary for parameters (arguments) search.

Default values are \(+\infty\) for all parameters (arguments)

Parameters
vMaxParamAn array with the maximal parameter (argument) values

Definition at line 63 of file Powell.cpp.

◆ setMinParams()

void DirectGraphicalModels::CPowell::setMinParams ( const vec_float_t &  vMinParam)

Sets the lower boundary for parameters (arguments) search.

Default values are \(-\infty\) for all parameters (arguments)

Parameters
vMinParamAn array with the minimal parameter (argument) values

Definition at line 52 of file Powell.cpp.

Member Data Documentation

◆ m_acceleration

float DirectGraphicalModels::CPowell::m_acceleration
private

Definition at line 110 of file Powell.h.

◆ m_koeff

float DirectGraphicalModels::CPowell::m_koeff
private

Definition at line 109 of file Powell.h.

◆ m_midPoint

float DirectGraphicalModels::CPowell::m_midPoint
private

Definition at line 108 of file Powell.h.

◆ m_nParams

size_t DirectGraphicalModels::CPowell::m_nParams
private

Definition at line 105 of file Powell.h.

◆ m_nSteps

size_t DirectGraphicalModels::CPowell::m_nSteps
private

Definition at line 107 of file Powell.h.

◆ m_paramID

size_t DirectGraphicalModels::CPowell::m_paramID
private

Definition at line 106 of file Powell.h.

◆ m_vConverged

vec_bool_t DirectGraphicalModels::CPowell::m_vConverged
private

Definition at line 117 of file Powell.h.

◆ m_vDeltas

vec_float_t DirectGraphicalModels::CPowell::m_vDeltas
private

Definition at line 113 of file Powell.h.

◆ m_vKappa

vec_float_t DirectGraphicalModels::CPowell::m_vKappa
private

Definition at line 116 of file Powell.h.

◆ m_vMax

vec_float_t DirectGraphicalModels::CPowell::m_vMax
private

Definition at line 115 of file Powell.h.

◆ m_vMin

vec_float_t DirectGraphicalModels::CPowell::m_vMin
private

Definition at line 114 of file Powell.h.

◆ m_vParams

vec_float_t DirectGraphicalModels::CPowell::m_vParams
private

Definition at line 112 of file Powell.h.


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