ITK  4.2.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
itk::PowellOptimizer Class Reference

#include <itkPowellOptimizer.h>

+ Inheritance diagram for itk::PowellOptimizer:
+ Collaboration diagram for itk::PowellOptimizer:

List of all members.

Public Types

typedef SmartPointer< const SelfConstPointer
typedef CostFunctionType::Pointer CostFunctionPointer
typedef SingleValuedCostFunction CostFunctionType
typedef
SingleValuedNonLinearOptimizer::ParametersType 
ParametersType
typedef SmartPointer< SelfPointer
typedef PowellOptimizer Self
typedef
SingleValuedNonLinearOptimizer 
Superclass
- Public Types inherited from itk::SingleValuedNonLinearOptimizer
typedef
CostFunctionType::DerivativeType 
DerivativeType
typedef
CostFunctionType::MeasureType 
MeasureType
- Public Types inherited from itk::NonLinearOptimizer
typedef Superclass::ScalesType ScalesType
- Public Types inherited from itk::Optimizer
- Public Types inherited from itk::Object
- Public Types inherited from itk::LightObject

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother (void) const
virtual const bool & GetCatchGetValueException ()
virtual const unsigned int & GetCurrentIteration ()
virtual const unsigned int & GetCurrentLineIteration ()
virtual const double & GetMetricWorstPossibleValue ()
virtual const char * GetNameOfClass () const
const std::string GetStopConditionDescription () const
virtual void SetCatchGetValueException (bool _arg)
virtual void SetMetricWorstPossibleValue (double _arg)
void StartOptimization ()
void StopOptimization ()
virtual void SetMaximize (bool _arg)
virtual void MaximizeOn ()
virtual void MaximizeOff ()
virtual const bool & GetMaximize ()
virtual void SetMaximumIteration (unsigned int _arg)
virtual const unsigned int & GetMaximumIteration ()
virtual void SetMaximumLineIteration (unsigned int _arg)
virtual unsigned int GetMaximumLineIteration () const
virtual void SetStepLength (double _arg)
virtual const double & GetStepLength ()
virtual void SetStepTolerance (double _arg)
virtual const double & GetStepTolerance ()
virtual void SetValueTolerance (double _arg)
virtual const double & GetValueTolerance ()
virtual const MeasureTypeGetCurrentCost ()
MeasureType GetValue () const
- Public Member Functions inherited from itk::SingleValuedNonLinearOptimizer
virtual const CostFunctionTypeGetCostFunction ()
MeasureType GetValue (const ParametersType &parameters) const
virtual void SetCostFunction (CostFunctionType *costFunction)

Static Public Member Functions

static Pointer New ()

Protected Member Functions

virtual void BracketedLineOptimize (double ax, double bx, double cx, double fa, double fb, double fc, double *extX, double *extVal)
virtual void BracketedLineOptimize (double ax, double bx, double cx, double fa, double fb, double fc, double *extX, double *extVal, ParametersType &tempCoord)
double GetLineValue (double x) const
double GetLineValue (double x, ParametersType &tempCoord) const
virtual unsigned int GetSpaceDimension ()
virtual bool GetStop ()
virtual void LineBracket (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc)
virtual void LineBracket (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc, ParametersType &tempCoord)
 PowellOptimizer ()
 PowellOptimizer (const PowellOptimizer &)
void PrintSelf (std::ostream &os, Indent indent) const
virtual void SetCurrentCost (double _arg)
virtual void SetCurrentIteration (unsigned int _arg)
void SetCurrentLinePoint (double x, double fx)
void SetLine (const ParametersType &origin, const vnl_vector< double > &direction)
void SetSpaceDimension (unsigned int dim)
virtual void SetStop (bool _arg)
void Shift (double *a, double *b, double *c, double d) const
void Swap (double *a, double *b) const
virtual ~PowellOptimizer ()
- Protected Member Functions inherited from itk::SingleValuedNonLinearOptimizer
 SingleValuedNonLinearOptimizer ()
virtual ~SingleValuedNonLinearOptimizer ()
 NonLinearOptimizer ()
virtual ~NonLinearOptimizer ()
- Protected Member Functions inherited from itk::Optimizer
 Optimizer ()
virtual void SetCurrentPosition (const ParametersType &param)
virtual ~Optimizer ()
- Protected Member Functions inherited from itk::Object
 Object ()
bool PrintObservers (std::ostream &os, Indent indent) const
virtual void SetTimeStamp (const TimeStamp &time)
virtual ~Object ()
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 LightObject ()
virtual void PrintHeader (std::ostream &os, Indent indent) const
virtual void PrintTrailer (std::ostream &os, Indent indent) const
virtual ~LightObject ()

Private Attributes

bool m_CatchGetValueException
MeasureType m_CurrentCost
unsigned int m_CurrentIteration
unsigned int m_CurrentLineIteration
vnl_vector< double > m_LineDirection
ParametersType m_LineOrigin
bool m_Maximize
unsigned int m_MaximumIteration
unsigned int m_MaximumLineIteration
double m_MetricWorstPossibleValue
unsigned int m_SpaceDimension
double m_StepLength
double m_StepTolerance
bool m_Stop
std::ostringstream m_StopConditionDescription
double m_ValueTolerance

Additional Inherited Members

- Protected Attributes inherited from itk::SingleValuedNonLinearOptimizer
CostFunctionPointer m_CostFunction

Detailed Description

Implements Powell optimization using Brent line search.

The code in this class was adapted from the Wikipedia and the netlib.org zeroin function.

http://www.netlib.org/go/zeroin.f http://en.wikipedia.org/wiki/Brent_method http://en.wikipedia.org/wiki/Golden_section_search

This optimizer needs a cost function. Partial derivatives of that function are not required.

For an N-dimensional parameter space, each iteration minimizes(maximizes) the function in N (initially orthogonal) directions. Typically only 2-5 iterations are required. If gradients are available, consider a conjugate gradient line search strategy.

The SetStepLength determines the initial distance to step in a line direction when bounding the minimum (using bracketing triple spaced using a golden search strategy).

The StepTolerance terminates optimization when the parameter values are known to be within this (scaled) distance of the local extreme.

The ValueTolerance terminates optimization when the cost function values at the current parameters and at the local extreme are likely (within a second order approximation) to be within this is tolerance.

Definition at line 61 of file itkPowellOptimizer.h.


Member Typedef Documentation

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

Definition at line 69 of file itkPowellOptimizer.h.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

Definition at line 82 of file itkPowellOptimizer.h.

Type of the Cost Function

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

Definition at line 78 of file itkPowellOptimizer.h.

Parameters type. It defines a position in the optimization search space.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

Definition at line 72 of file itkPowellOptimizer.h.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

Definition at line 68 of file itkPowellOptimizer.h.

Standard "Self" typedef.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

Definition at line 66 of file itkPowellOptimizer.h.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

Definition at line 67 of file itkPowellOptimizer.h.


Constructor & Destructor Documentation

itk::PowellOptimizer::PowellOptimizer ( )
protected
itk::PowellOptimizer::PowellOptimizer ( const PowellOptimizer )
protected
virtual itk::PowellOptimizer::~PowellOptimizer ( )
protectedvirtual

Member Function Documentation

virtual void itk::PowellOptimizer::BracketedLineOptimize ( double  ax,
double  bx,
double  cx,
double  fa,
double  fb,
double  fc,
double *  extX,
double *  extVal 
)
protectedvirtual

Given a bracketing triple of points and their function values, returns a bounded extreme. These values are in parameter space, along the current line and wrt the current origin set via SetLine. Optimization terminates based on MaximumIteration, StepTolerance, or ValueTolerance. Implemented as Brent line optimers from NRC.

virtual void itk::PowellOptimizer::BracketedLineOptimize ( double  ax,
double  bx,
double  cx,
double  fa,
double  fb,
double  fc,
double *  extX,
double *  extVal,
ParametersType tempCoord 
)
protectedvirtual
virtual::itk::LightObject::Pointer itk::PowellOptimizer::CreateAnother ( void  ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

virtual const bool& itk::PowellOptimizer::GetCatchGetValueException ( )
virtual
virtual const MeasureType& itk::PowellOptimizer::GetCurrentCost ( )
virtual

Return Current Value

virtual const unsigned int& itk::PowellOptimizer::GetCurrentIteration ( )
virtual

Return Current Iteration

virtual const unsigned int& itk::PowellOptimizer::GetCurrentLineIteration ( )
virtual

Get the current line search iteration

double itk::PowellOptimizer::GetLineValue ( double  x) const
protected

Get the value of the n-dimensional cost function at this scalar step distance along the current line direction from the current line origin. Line origin and distances are set via SetLine

double itk::PowellOptimizer::GetLineValue ( double  x,
ParametersType tempCoord 
) const
protected
virtual const bool& itk::PowellOptimizer::GetMaximize ( )
virtual

Set if the Optimizer should Maximize the metric

virtual const unsigned int& itk::PowellOptimizer::GetMaximumIteration ( )
virtual

Set/Get maximum iteration limit.

virtual unsigned int itk::PowellOptimizer::GetMaximumLineIteration ( ) const
virtual

Set/Get the maximum number of line search iterations

virtual const double& itk::PowellOptimizer::GetMetricWorstPossibleValue ( )
virtual
virtual const char* itk::PowellOptimizer::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

virtual unsigned int itk::PowellOptimizer::GetSpaceDimension ( )
protectedvirtual
virtual const double& itk::PowellOptimizer::GetStepLength ( )
virtual

Set/Get StepLength for the (scaled) spacing of the sampling of parameter space while bracketing the extremum

virtual const double& itk::PowellOptimizer::GetStepTolerance ( )
virtual

Set/Get StepTolerance. Once the local extreme is known to be within this distance of the current parameter values, optimization terminates

virtual bool itk::PowellOptimizer::GetStop ( )
protectedvirtual
const std::string itk::PowellOptimizer::GetStopConditionDescription ( ) const
virtual

Get the reason for termination

Reimplemented from itk::Optimizer.

MeasureType itk::PowellOptimizer::GetValue ( ) const
inline

Return Current Value

Definition at line 121 of file itkPowellOptimizer.h.

virtual const double& itk::PowellOptimizer::GetValueTolerance ( )
virtual

Set/Get ValueTolerance. Once this current cost function value is known to be within this tolerance of the cost function value at the local extreme, optimization terminates

virtual void itk::PowellOptimizer::LineBracket ( double *  ax,
double *  bx,
double *  cx,
double *  fa,
double *  fb,
double *  fc 
)
protectedvirtual

The LineBracket routine from NRC. Later reimplemented from the description of the method available in the Wikipedia.

Uses current origin and line direction (from SetLine) to find a triple of points (ax, bx, cx) that bracket the extreme "near" the origin. Search first considers the point StepLength distance from ax.

IMPORTANT: The value of ax and the value of the function at ax (i.e., fa), must both be provided to this function.

virtual void itk::PowellOptimizer::LineBracket ( double *  ax,
double *  bx,
double *  cx,
double *  fa,
double *  fb,
double *  fc,
ParametersType tempCoord 
)
protectedvirtual
virtual void itk::PowellOptimizer::MaximizeOff ( )
virtual

Set if the Optimizer should Maximize the metric

virtual void itk::PowellOptimizer::MaximizeOn ( )
virtual

Set if the Optimizer should Maximize the metric

static Pointer itk::PowellOptimizer::New ( )
static

Method for creation through the object factory.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

void itk::PowellOptimizer::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protectedvirtual

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::SingleValuedNonLinearOptimizer.

Reimplemented in itk::FRPROptimizer.

virtual void itk::PowellOptimizer::SetCatchGetValueException ( bool  _arg)
virtual
virtual void itk::PowellOptimizer::SetCurrentCost ( double  _arg)
protectedvirtual
virtual void itk::PowellOptimizer::SetCurrentIteration ( unsigned int  _arg)
protectedvirtual
void itk::PowellOptimizer::SetCurrentLinePoint ( double  x,
double  fx 
)
protected

Set the given scalar step distance (x) and function value (fx) as the "best-so-far" optimizer values.

void itk::PowellOptimizer::SetLine ( const ParametersType origin,
const vnl_vector< double > &  direction 
)
protected

Used to specify the line direction through the n-dimensional parameter space the is currently being bracketed and optimized.

virtual void itk::PowellOptimizer::SetMaximize ( bool  _arg)
virtual

Set if the Optimizer should Maximize the metric

virtual void itk::PowellOptimizer::SetMaximumIteration ( unsigned int  _arg)
virtual

Set/Get maximum iteration limit.

virtual void itk::PowellOptimizer::SetMaximumLineIteration ( unsigned int  _arg)
virtual

Set/Get the maximum number of line search iterations

virtual void itk::PowellOptimizer::SetMetricWorstPossibleValue ( double  _arg)
virtual
void itk::PowellOptimizer::SetSpaceDimension ( unsigned int  dim)
inlineprotected

Definition at line 210 of file itkPowellOptimizer.h.

virtual void itk::PowellOptimizer::SetStepLength ( double  _arg)
virtual

Set/Get StepLength for the (scaled) spacing of the sampling of parameter space while bracketing the extremum

virtual void itk::PowellOptimizer::SetStepTolerance ( double  _arg)
virtual

Set/Get StepTolerance. Once the local extreme is known to be within this distance of the current parameter values, optimization terminates

virtual void itk::PowellOptimizer::SetStop ( bool  _arg)
protectedvirtual
virtual void itk::PowellOptimizer::SetValueTolerance ( double  _arg)
virtual

Set/Get ValueTolerance. Once this current cost function value is known to be within this tolerance of the cost function value at the local extreme, optimization terminates

void itk::PowellOptimizer::Shift ( double *  a,
double *  b,
double *  c,
double  d 
) const
protected

Used in bracketing the extreme along the current line. Adapted from NRC

void itk::PowellOptimizer::StartOptimization ( )
virtual

Start optimization.

Reimplemented from itk::Optimizer.

Reimplemented in itk::FRPROptimizer.

void itk::PowellOptimizer::StopOptimization ( )
inline

When users call StartOptimization, this value will be set false. By calling StopOptimization, this flag will be set true, and optimization will stop at the next iteration.

Definition at line 136 of file itkPowellOptimizer.h.

void itk::PowellOptimizer::Swap ( double *  a,
double *  b 
) const
protected

Used in bracketing the extreme along the current line. Adapted from NRC


Member Data Documentation

bool itk::PowellOptimizer::m_CatchGetValueException
private

Definition at line 234 of file itkPowellOptimizer.h.

MeasureType itk::PowellOptimizer::m_CurrentCost
private

Internal storage for the value type / used as a cache

Definition at line 250 of file itkPowellOptimizer.h.

unsigned int itk::PowellOptimizer::m_CurrentIteration
private

Current iteration

Definition at line 227 of file itkPowellOptimizer.h.

unsigned int itk::PowellOptimizer::m_CurrentLineIteration
private

Definition at line 228 of file itkPowellOptimizer.h.

vnl_vector< double > itk::PowellOptimizer::m_LineDirection
private

Definition at line 245 of file itkPowellOptimizer.h.

ParametersType itk::PowellOptimizer::m_LineOrigin
private

Definition at line 244 of file itkPowellOptimizer.h.

bool itk::PowellOptimizer::m_Maximize
private

Set if the Metric should be maximized: Default = False

Definition at line 238 of file itkPowellOptimizer.h.

unsigned int itk::PowellOptimizer::m_MaximumIteration
private

Maximum iteration limit.

Definition at line 231 of file itkPowellOptimizer.h.

unsigned int itk::PowellOptimizer::m_MaximumLineIteration
private

Definition at line 232 of file itkPowellOptimizer.h.

double itk::PowellOptimizer::m_MetricWorstPossibleValue
private

Definition at line 235 of file itkPowellOptimizer.h.

unsigned int itk::PowellOptimizer::m_SpaceDimension
private

Definition at line 222 of file itkPowellOptimizer.h.

double itk::PowellOptimizer::m_StepLength
private

The minimal size of search

Definition at line 241 of file itkPowellOptimizer.h.

double itk::PowellOptimizer::m_StepTolerance
private

Definition at line 242 of file itkPowellOptimizer.h.

bool itk::PowellOptimizer::m_Stop
private

this is user-settable flag to stop optimization. when users call StartOptimization, this value will be set false. By calling StopOptimization, this flag will be set true, and optimization will stop at the next iteration.

Definition at line 256 of file itkPowellOptimizer.h.

std::ostringstream itk::PowellOptimizer::m_StopConditionDescription
private

Definition at line 258 of file itkPowellOptimizer.h.

double itk::PowellOptimizer::m_ValueTolerance
private

Definition at line 247 of file itkPowellOptimizer.h.


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