ITK  4.6.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Attributes | List of all members
itk::AmoebaOptimizerv4 Class Reference

#include <itkAmoebaOptimizerv4.h>

+ Inheritance diagram for itk::AmoebaOptimizerv4:
+ Collaboration diagram for itk::AmoebaOptimizerv4:

Detailed Description

Wrap of the vnl_amoeba algorithm.

AmoebaOptimizerv4 is a wrapper around the vnl_amoeba algorithm which is an implementation of the Nelder-Meade downhill simplex problem. For most problems, it is a few times slower than a Levenberg-Marquardt algorithm but does not require derivatives of its cost function. It works by creating a simplex (n+1 points in ND space). The cost function is evaluated at each corner of the simplex. The simplex is then modified (by reflecting a corner about the opposite edge, by shrinking the entire simplex, by contracting one edge of the simplex, or by expanding the simplex) in searching for the minimum of the cost function.

The methods AutomaticInitialSimplex() and SetInitialSimplexDelta() control whether the optimizer defines the initial simplex automatically (by constructing a very small simplex around the initial position) or uses a user supplied simplex size.

The method SetOptimizeWithRestarts() indicates that the amoeabe algorithm should be rerun after if converges. This heuristic increases the chances of escaping from a local optimum. Each time the simplex is initialized with the best solution obtained by the previous runs. The edge length is half of that from the previous iteration. The heuristic is terminated if the total number of iterations is greater-equal than the maximal number of iterations (SetNumberOfIterations) or the difference between the current function value and the best function value is less than a threshold (SetFunctionConvergenceTolerance) and max(|best_parameters_i - current_parameters_i|) is less than a threshold (SetParametersConvergenceTolerance).

Definition at line 59 of file itkAmoebaOptimizerv4.h.

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef vnl_vector< double > InternalParametersType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef AmoebaOptimizerv4 Self
 
typedef
SingleValuedNonLinearVnlOptimizerv4 
Superclass
 
- Public Types inherited from itk::SingleValuedNonLinearVnlOptimizerv4
typedef ReceptorMemberCommand
< Self
CommandType
 
typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::MetricType MetricType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef Superclass::ScalesType ScalesType
 
typedef
SingleValuedNonLinearVnlOptimizerv4 
Self
 
typedef
Superclass::StopConditionDescriptionType 
StopConditionDescriptionType
 
typedef
Superclass::StopConditionReturnStringType 
StopConditionReturnStringType
 
typedef ObjectToObjectOptimizerBase Superclass
 
- Public Types inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
typedef SmartPointer< const SelfConstPointer
 
typedef MetricType::DerivativeType DerivativeType
 
typedef MetricType::MeasureType MeasureType
 
typedef
ObjectToObjectMetricBaseTemplate
< double > 
MetricType
 
typedef MetricType::Pointer MetricTypePointer
 
typedef
MetricType::NumberOfParametersType 
NumberOfParametersType
 
typedef OptimizerParameters
< double > 
ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef
OptimizerParameterScalesEstimatorTemplate
< double > 
ScalesEstimatorType
 
typedef OptimizerParameters
< double > 
ScalesType
 
typedef
ObjectToObjectOptimizerBaseTemplate 
Self
 
typedef std::ostringstream StopConditionDescriptionType
 
typedef std::string StopConditionReturnStringType
 
typedef Object Superclass
 
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef Object Self
 
typedef LightObject Superclass
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
virtual const char * GetNameOfClass () const
 
vnl_amoeba * GetOptimizer (void) const
 
virtual const std::string GetStopConditionDescription () const ITK_OVERRIDE
 
virtual void SetMetric (MetricType *metric) ITK_OVERRIDE
 
virtual void StartOptimization (bool doOnlyInitialization=false) ITK_OVERRIDE
 
virtual void SetAutomaticInitialSimplex (bool _arg)
 
virtual void AutomaticInitialSimplexOn ()
 
virtual void AutomaticInitialSimplexOff ()
 
virtual bool GetAutomaticInitialSimplex () const
 
virtual void SetOptimizeWithRestarts (bool _arg)
 
virtual void OptimizeWithRestartsOn ()
 
virtual void OptimizeWithRestartsOff ()
 
virtual bool GetOptimizeWithRestarts () const
 
void SetInitialSimplexDelta (ParametersType initialSimplexDelta, bool automaticInitialSimplex=false)
 
virtual ParametersType GetInitialSimplexDelta () const
 
virtual void SetParametersConvergenceTolerance (double _arg)
 
virtual double GetParametersConvergenceTolerance () const
 
virtual void SetFunctionConvergenceTolerance (double _arg)
 
virtual double GetFunctionConvergenceTolerance () const
 
- Public Member Functions inherited from itk::SingleValuedNonLinearVnlOptimizerv4
virtual const DerivativeTypeGetCachedDerivative () const
 
virtual const ParametersTypeGetCachedCurrentPosition () const
 
- Public Member Functions inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
virtual SizeValueType GetCurrentIteration () const
 
virtual const MeasureTypeGetCurrentMetricValue () const
 
virtual const ParametersTypeGetCurrentPosition () const
 
virtual SizeValueType GetNumberOfIterations () const
 
virtual const ThreadIdTypeGetNumberOfThreads () const
 
virtual const ScalesTypeGetScales () const
 
virtual const bool & GetScalesAreIdentity () const
 
bool GetScalesInitialized (void) const
 
virtual const MeasureTypeGetValue () const
 
virtual const ScalesTypeGetWeights () const
 
virtual const bool & GetWeightsAreIdentity () const
 
virtual void SetNumberOfIterations (SizeValueType _arg)
 
virtual void SetNumberOfThreads (ThreadIdType number)
 
virtual void SetScalesEstimator (ScalesEstimatorType *_arg)
 
virtual void SetWeights (ScalesType _arg)
 
virtual void SetMetric (MetricType *_arg)
 
virtual MetricTypeGetModifiableMetric ()
 
virtual const MetricTypeGetMetric () const
 
virtual void SetScales (const ScalesType &scales)
 
virtual void SetDoEstimateScales (bool _arg)
 
virtual const bool & GetDoEstimateScales () const
 
virtual void DoEstimateScalesOn ()
 
virtual void DoEstimateScalesOff ()
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary (void)
 
const MetaDataDictionaryGetMetaDataDictionary (void) const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
virtual void Register () const ITK_OVERRIDE
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
virtual void SetReferenceCount (int) ITK_OVERRIDE
 
virtual void UnRegister () const ITK_OVERRIDE
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Types

typedef
Superclass::CostFunctionAdaptorType 
CostFunctionAdaptorType
 
- Protected Types inherited from itk::SingleValuedNonLinearVnlOptimizerv4
typedef
SingleValuedVnlCostFunctionAdaptorv4 
CostFunctionAdaptorType
 
- Protected Types inherited from itk::LightObject
typedef int InternalReferenceCountType
 

Protected Member Functions

 AmoebaOptimizerv4 ()
 
virtual void PrintSelf (std::ostream &os, Indent indent) const ITK_OVERRIDE
 
virtual ~AmoebaOptimizerv4 ()
 
- Protected Member Functions inherited from itk::SingleValuedNonLinearVnlOptimizerv4
const CostFunctionAdaptorTypeGetCostFunctionAdaptor (void) const
 
CostFunctionAdaptorTypeGetCostFunctionAdaptor (void)
 
CostFunctionAdaptorTypeGetNonConstCostFunctionAdaptor (void) const
 
void SetCostFunctionAdaptor (CostFunctionAdaptorType *adaptor)
 
 SingleValuedNonLinearVnlOptimizerv4 ()
 
virtual ~SingleValuedNonLinearVnlOptimizerv4 ()
 
- Protected Member Functions inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
 ObjectToObjectOptimizerBaseTemplate ()
 
virtual ~ObjectToObjectOptimizerBaseTemplate ()
 
- 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 Member Functions

void ValidateSettings ()
 
 AmoebaOptimizerv4 (const Self &)
 
void operator= (const Self &)
 

Private Attributes

bool m_AutomaticInitialSimplex
 
MeasureType m_FunctionConvergenceTolerance
 
ParametersType m_InitialSimplexDelta
 
bool m_OptimizeWithRestarts
 
ParametersType::ValueType m_ParametersConvergenceTolerance
 
std::ostringstream m_StopConditionDescription
 
vnl_amoeba * m_VnlOptimizer
 

Additional Inherited Members

- Protected Attributes inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
SizeValueType m_CurrentIteration
 
MeasureType m_CurrentMetricValue
 
bool m_DoEstimateScales
 
MetricTypePointer m_Metric
 
SizeValueType m_NumberOfIterations
 
ThreadIdType m_NumberOfThreads
 
ScalesType m_Scales
 
bool m_ScalesAreIdentity
 
ScalesEstimatorType::Pointer m_ScalesEstimator
 
ScalesType m_Weights
 
bool m_WeightsAreIdentity
 
- Protected Attributes inherited from itk::LightObject
InternalReferenceCountType m_ReferenceCount
 
SimpleFastMutexLock m_ReferenceCountLock
 

Member Typedef Documentation

Definition at line 67 of file itkAmoebaOptimizerv4.h.

typedef Superclass::CostFunctionAdaptorType itk::AmoebaOptimizerv4::CostFunctionAdaptorType
protected

Definition at line 146 of file itkAmoebaOptimizerv4.h.

typedef vnl_vector< double > itk::AmoebaOptimizerv4::InternalParametersType

InternalParameters typedef.

Definition at line 80 of file itkAmoebaOptimizerv4.h.

typedef Superclass::ParametersType itk::AmoebaOptimizerv4::ParametersType

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

Definition at line 73 of file itkAmoebaOptimizerv4.h.

Definition at line 66 of file itkAmoebaOptimizerv4.h.

Standard "Self" typedef.

Definition at line 64 of file itkAmoebaOptimizerv4.h.

Definition at line 65 of file itkAmoebaOptimizerv4.h.

Constructor & Destructor Documentation

itk::AmoebaOptimizerv4::AmoebaOptimizerv4 ( )
protected
virtual itk::AmoebaOptimizerv4::~AmoebaOptimizerv4 ( )
protectedvirtual
itk::AmoebaOptimizerv4::AmoebaOptimizerv4 ( const Self )
private

Check that the settings are valid. If not throw an exception.

Member Function Documentation

virtual void itk::AmoebaOptimizerv4::AutomaticInitialSimplexOff ( )
virtual

Set/Get the mode which determines how the amoeba algorithm defines the initial simplex. Default is AutomaticInitialSimplexOn. If AutomaticInitialSimplex is on, the initial simplex is created with a default size. If AutomaticInitialSimplex is off, then InitialSimplexDelta will be used to define the initial simplex, setting the ith corner of the simplex as [x0[0], x0[1], ..., x0[i]+InitialSimplexDelta[i], ..., x0[d-1]].

virtual void itk::AmoebaOptimizerv4::AutomaticInitialSimplexOn ( )
virtual

Set/Get the mode which determines how the amoeba algorithm defines the initial simplex. Default is AutomaticInitialSimplexOn. If AutomaticInitialSimplex is on, the initial simplex is created with a default size. If AutomaticInitialSimplex is off, then InitialSimplexDelta will be used to define the initial simplex, setting the ith corner of the simplex as [x0[0], x0[1], ..., x0[i]+InitialSimplexDelta[i], ..., x0[d-1]].

virtual::itk::LightObject::Pointer itk::AmoebaOptimizerv4::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::Object.

virtual bool itk::AmoebaOptimizerv4::GetAutomaticInitialSimplex ( ) const
virtual

Set/Get the mode which determines how the amoeba algorithm defines the initial simplex. Default is AutomaticInitialSimplexOn. If AutomaticInitialSimplex is on, the initial simplex is created with a default size. If AutomaticInitialSimplex is off, then InitialSimplexDelta will be used to define the initial simplex, setting the ith corner of the simplex as [x0[0], x0[1], ..., x0[i]+InitialSimplexDelta[i], ..., x0[d-1]].

virtual double itk::AmoebaOptimizerv4::GetFunctionConvergenceTolerance ( ) const
virtual

The optimization algorithm will terminate when the simplex diameter and the difference in cost function values at the corners of the simplex falls below user specified thresholds. The cost function convergence threshold is set via SetFunctionConvergenceTolerance().

virtual ParametersType itk::AmoebaOptimizerv4::GetInitialSimplexDelta ( ) const
virtual

Set/Get the deltas that are used to define the initial simplex when AutomaticInitialSimplex is off.

virtual const char* itk::AmoebaOptimizerv4::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::SingleValuedNonLinearVnlOptimizerv4.

vnl_amoeba* itk::AmoebaOptimizerv4::GetOptimizer ( void  ) const

Method for getting access to the internal optimizer.

virtual bool itk::AmoebaOptimizerv4::GetOptimizeWithRestarts ( ) const
virtual

Set/Get the mode that determines if we want to use multiple runs of the Amoeba optimizer. If true, then the optimizer is rerun after it converges. The additional runs are performed using a simplex initialized with the best solution obtained by the previous runs. The edge length is half of that from the previous iteration.

virtual double itk::AmoebaOptimizerv4::GetParametersConvergenceTolerance ( ) const
virtual

The optimization algorithm will terminate when the simplex diameter and the difference in cost function values at the corners of the simplex falls below user specified thresholds. The simplex diameter threshold is set via SetParametersConvergenceTolerance().

virtual const std::string itk::AmoebaOptimizerv4::GetStopConditionDescription ( ) const
virtual

Report the reason for stopping.

Implements itk::SingleValuedNonLinearVnlOptimizerv4.

static Pointer itk::AmoebaOptimizerv4::New ( )
static

Method for creation through the object factory.

void itk::AmoebaOptimizerv4::operator= ( const Self )
private

Check that the settings are valid. If not throw an exception.

virtual void itk::AmoebaOptimizerv4::OptimizeWithRestartsOff ( )
virtual

Set/Get the mode that determines if we want to use multiple runs of the Amoeba optimizer. If true, then the optimizer is rerun after it converges. The additional runs are performed using a simplex initialized with the best solution obtained by the previous runs. The edge length is half of that from the previous iteration.

virtual void itk::AmoebaOptimizerv4::OptimizeWithRestartsOn ( )
virtual

Set/Get the mode that determines if we want to use multiple runs of the Amoeba optimizer. If true, then the optimizer is rerun after it converges. The additional runs are performed using a simplex initialized with the best solution obtained by the previous runs. The edge length is half of that from the previous iteration.

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

Print out internal state

Reimplemented from itk::SingleValuedNonLinearVnlOptimizerv4.

virtual void itk::AmoebaOptimizerv4::SetAutomaticInitialSimplex ( bool  _arg)
virtual

Set/Get the mode which determines how the amoeba algorithm defines the initial simplex. Default is AutomaticInitialSimplexOn. If AutomaticInitialSimplex is on, the initial simplex is created with a default size. If AutomaticInitialSimplex is off, then InitialSimplexDelta will be used to define the initial simplex, setting the ith corner of the simplex as [x0[0], x0[1], ..., x0[i]+InitialSimplexDelta[i], ..., x0[d-1]].

virtual void itk::AmoebaOptimizerv4::SetFunctionConvergenceTolerance ( double  _arg)
virtual

The optimization algorithm will terminate when the simplex diameter and the difference in cost function values at the corners of the simplex falls below user specified thresholds. The cost function convergence threshold is set via SetFunctionConvergenceTolerance().

void itk::AmoebaOptimizerv4::SetInitialSimplexDelta ( ParametersType  initialSimplexDelta,
bool  automaticInitialSimplex = false 
)

Set/Get the deltas that are used to define the initial simplex when AutomaticInitialSimplex is off.

virtual void itk::AmoebaOptimizerv4::SetMetric ( MetricType metric)
virtual

Plug in a Cost Function into the optimizer

Implements itk::SingleValuedNonLinearVnlOptimizerv4.

virtual void itk::AmoebaOptimizerv4::SetOptimizeWithRestarts ( bool  _arg)
virtual

Set/Get the mode that determines if we want to use multiple runs of the Amoeba optimizer. If true, then the optimizer is rerun after it converges. The additional runs are performed using a simplex initialized with the best solution obtained by the previous runs. The edge length is half of that from the previous iteration.

virtual void itk::AmoebaOptimizerv4::SetParametersConvergenceTolerance ( double  _arg)
virtual

The optimization algorithm will terminate when the simplex diameter and the difference in cost function values at the corners of the simplex falls below user specified thresholds. The simplex diameter threshold is set via SetParametersConvergenceTolerance().

virtual void itk::AmoebaOptimizerv4::StartOptimization ( bool  doOnlyInitialization = false)
virtual

Start optimization with an initial value.

Reimplemented from itk::SingleValuedNonLinearVnlOptimizerv4.

void itk::AmoebaOptimizerv4::ValidateSettings ( )
private

Check that the settings are valid. If not throw an exception.

Member Data Documentation

bool itk::AmoebaOptimizerv4::m_AutomaticInitialSimplex
private

Definition at line 159 of file itkAmoebaOptimizerv4.h.

MeasureType itk::AmoebaOptimizerv4::m_FunctionConvergenceTolerance
private

Definition at line 158 of file itkAmoebaOptimizerv4.h.

ParametersType itk::AmoebaOptimizerv4::m_InitialSimplexDelta
private

Definition at line 160 of file itkAmoebaOptimizerv4.h.

bool itk::AmoebaOptimizerv4::m_OptimizeWithRestarts
private

Definition at line 161 of file itkAmoebaOptimizerv4.h.

ParametersType::ValueType itk::AmoebaOptimizerv4::m_ParametersConvergenceTolerance
private

Definition at line 157 of file itkAmoebaOptimizerv4.h.

std::ostringstream itk::AmoebaOptimizerv4::m_StopConditionDescription
private

Definition at line 164 of file itkAmoebaOptimizerv4.h.

vnl_amoeba* itk::AmoebaOptimizerv4::m_VnlOptimizer
private

Definition at line 162 of file itkAmoebaOptimizerv4.h.


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