go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elastix::CMAEvolutionStrategy< TElastix > Class Template Reference

#include <elxCMAEvolutionStrategy.h>

Detailed Description

template<class TElastix>
class elastix::CMAEvolutionStrategy< TElastix >

An optimizer based on the itk::CMAEvolutionStrategyOptimizer.

A Covariance-Matrix-Adaptation-Evolution-Strategy optimizer.

This optimizer support the NewSamplesEveryIteration option. It requests new samples for the computation of each search direction (not during the offspring generation). The theory doesn't say anything about such a situation, so, think twice before using the NewSamplesEveryIteration option.

The parameters used in this class are:

Parameters

Optimizer: Select this optimizer as follows:
(Optimizer "CMAEvolutionStrategy")

MaximumNumberOfIterations: The maximum number of iterations in each resolution.
example: (MaximumNumberOfIterations 100 100 50)
Default value: 500.

StepLength: Set the length of the initial step ( = Sigma0 = InitialSigma).
example: (StepLength 2.0 1.0 0.5)
Recommended value: 1/3 of the expected parameter range.
Default value: 1.0.

ValueTolerance: Stopping criterion. See the documentation of the itk::CMAEvolutionStrategyOptimizer for more information.
example: (ValueTolerance 0.001 0.0001 0.000001)
Default value: 0.00001. Can be specified for each resolution.

PositionToleranceMin: Stopping criterion. See the documentation of the itk::CMAEvolutionStrategyOptimizer for more information.
example: (PositionToleranceMin 0.001 0.0001 0.000001)
Default value: 1e-8. Can be specified for each resolution.

PositionToleranceMax: Stopping criterion. See the documentation of the itk::CMAEvolutionStrategyOptimizer for more information.
example: (PositionToleranceMax 0.001 0.0001 0.000001)
Default value: 1e8. Can be specified for each resolution.

PopulationSize: the number of parameter vectors evaluated in each iteration.
If you set it to 0, a default value is calculated by the optimizer, which is reported back to the elastix.log file.
example: (PopulationSize 0 20 20)
Default: 0 (so, automatically determined). Can be specified for each resolution.

NumberOfParents: the number of parameter vectors selected for recombination.
If you set it to 0, a default value is calculated by the optimizer, which is reported back to the elastix.log file.
example: (NumberOfParents 0 10 10)
Default: 0 (so, automatically determined). Can be specified for each resolution.
This value must be less than or equal to the PopulationSize.

MaximumDeviation: the step length is limited to this value. See the documentation of the itk::CMAEvolutionStrategyOptimizer for more information.
example: (MaximumDeviation 10.0 10.0 5.0)
Default: 10.0 * positionToleranceMax = practically infinity. Can be specified for each resolution.

MinimumDeviation: the step length is ensured to be greater than this value.
See the documentation of the itk::CMAEvolutionStrategyOptimizer for more information.
example: (MinimumDeviation 0.01 0.01 0.0001)
Default: 0.0. Can be specified for each resolution.

UseDecayingSigma: use a predefined decaying function to control the steplength sigma.
example: (UseDecayingSigma "false" "true" "false")
Default/recommended: "false". Can be specified for each resolution.
If you set it to true the SP_A and SP_alpha parameters apply.

SP_A: If UseDecayingSigma is set to "true", the steplength $sigma(k)$ at each iteration $k$ is defined by:
$sigma(k+1) = sigma(k) (SP\_A + k)^{SP\_alpha} / (SP\_A + k + 1)^{SP\_alpha}$.
where sigma(0) is set by the parameter "StepLength".
example: (SP_A 50.0 50.0 100.0)
The default value is 50.0. SP_A can be defined for each resolution.

SP_alpha: If UseDecayingSigma is set to "true", the steplength $sigma(k)$ at each iteration $k$ is defined by:
$sigma(k+1) = sigma(k) (SP\_A + k)^{SP\_alpha} / (SP\_A + k + 1)^{SP\_alpha}$.
where sigma(0) is set by the parameter "StepLength".
example: (SP_alpha 0.602 0.602 0.602)
The default value is 0.602. SP_alpha can be defined for each resolution.

UseCovarianceMatrixAdaptation: a boolean that determines whether to use the covariance matrix adaptation scheme.
example: (UseCovarianceMatrixAdaptation "false" "true" "true")
Default: "true". This parameter may be altered by the optimizer. The actual value used is
reported back in the elastix.log file. This parameter can be specified for each resolution.

RecombinationWeightsPreset: the name of a preset for the recombination weights.
See the documentation of the itk::CMAEvolutionStrategyOptimizer for more information.
example: (UseCovarianceMatrixAdaptation "equal" "linear" "superlinear")
Default/recommended: "superlinear". Choose one of {"equal", "linear", "superlinear"}. This parameter can be specified for each resolution.

UpdateBDPeriod: the number of iterations after which the eigendecomposition of the covariance matrix is updated. If 0, the optimizer estimates a value. The actual value used is reported back in the elastix.log file. This parameter can be specified for each resolution.
example: (UpdateBDPeriod 0 0 50)
Default: 0 (so, automatically determined).

Definition at line 115 of file elxCMAEvolutionStrategy.h.

Inheritance diagram for elastix::CMAEvolutionStrategy< TElastix >:

Public Types

using ConstPointer = itk::SmartPointer<const Self>
 
using ITKBaseType = typename Superclass2::ITKBaseType
 
using Pointer = itk::SmartPointer<Self>
 
using Self = CMAEvolutionStrategy
 
enum  StopConditionType
 
using Superclass1 = CMAEvolutionStrategyOptimizer
 
using Superclass2 = OptimizerBase<TElastix>
 
- Public Types inherited from itk::CMAEvolutionStrategyOptimizer
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using ScaledCostFunctionType
 
using ScalesType
 
using Self = CMAEvolutionStrategyOptimizer
 
enum  StopConditionType {
  MetricError , MaximumNumberOfIterations , PositionToleranceMin , PositionToleranceMax ,
  ValueTolerance , ZeroStepLength , Unknown
}
 
using Superclass = ScaledSingleValuedNonLinearOptimizer
 
- Public Types inherited from itk::ScaledSingleValuedNonLinearOptimizer
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using ScaledCostFunctionPointer = ScaledCostFunctionType::Pointer
 
using ScaledCostFunctionType = ScaledSingleValuedCostFunction
 
using ScalesType = NonLinearOptimizer::ScalesType
 
using Self = ScaledSingleValuedNonLinearOptimizer
 
using Superclass = SingleValuedNonLinearOptimizer
 
- Public Types inherited from elastix::OptimizerBase< TElastix >
using ElastixType
 
using ITKBaseType = itk::Optimizer
 
using ParametersType = typename ITKBaseType::ParametersType
 
using RegistrationType
 
using Self = OptimizerBase
 
using Superclass = BaseComponentSE<TElastix>
 
- Public Types inherited from elastix::BaseComponentSE< TElastix >
using ElastixType = TElastix
 
using RegistrationType = typename ElastixType::RegistrationBaseType
 
using Self = BaseComponentSE
 
using Superclass = BaseComponent
 

Public Member Functions

void AfterEachIteration () override
 
void AfterEachResolution () override
 
void AfterRegistration () override
 
void BeforeEachResolution () override
 
void BeforeRegistration () override
 
 elxClassNameMacro ("CMAEvolutionStrategy")
 
virtual const char * GetClassName () const
 
 ITK_DISALLOW_COPY_AND_MOVE (CMAEvolutionStrategy)
 
void StartOptimization () override
 
- Public Member Functions inherited from itk::CMAEvolutionStrategyOptimizer
virtual unsigned long GetCurrentIteration () const
 
virtual double GetCurrentMaximumD () const
 
virtual double GetCurrentMinimumD () const
 
virtual const ParametersType & GetCurrentScaledStep ()
 
virtual double GetCurrentSigma () const
 
virtual double GetCurrentStepLength () const
 
virtual MeasureType GetCurrentValue () const
 
virtual double GetInitialSigma () const
 
virtual double GetMaximumDeviation () const
 
virtual unsigned long GetMaximumNumberOfIterations () const
 
virtual double GetMinimumDeviation () const
 
virtual unsigned int GetNumberOfParents () const
 
virtual unsigned int GetPopulationSize () const
 
virtual double GetPositionToleranceMax () const
 
virtual double GetPositionToleranceMin () const
 
virtual const char * GetRecombinationWeightsPreset () const
 
virtual double GetSigmaDecayA () const
 
virtual double GetSigmaDecayAlpha () const
 
virtual const StopConditionTypeGetStopCondition ()
 
virtual unsigned int GetUpdateBDPeriod () const
 
virtual bool GetUseCovarianceMatrixAdaptation () const
 
virtual bool GetUseDecayingSigma () const
 
virtual double GetValueTolerance () const
 
 ITK_DISALLOW_COPY_AND_MOVE (CMAEvolutionStrategyOptimizer)
 
virtual void ResumeOptimization ()
 
virtual void SetInitialSigma (double _arg)
 
virtual void SetMaximumDeviation (double _arg)
 
virtual void SetMaximumNumberOfIterations (unsigned long _arg)
 
virtual void SetMinimumDeviation (double _arg)
 
virtual void SetNumberOfParents (unsigned int _arg)
 
virtual void SetPopulationSize (unsigned int _arg)
 
virtual void SetPositionToleranceMax (double _arg)
 
virtual void SetPositionToleranceMin (double _arg)
 
virtual void SetRecombinationWeightsPreset (const char *_arg)
 
virtual void SetSigmaDecayA (double _arg)
 
virtual void SetSigmaDecayAlpha (double _arg)
 
virtual void SetUpdateBDPeriod (unsigned int _arg)
 
virtual void SetUseCovarianceMatrixAdaptation (bool _arg)
 
virtual void SetUseDecayingSigma (bool _arg)
 
virtual void SetValueTolerance (double _arg)
 
void StartOptimization () override
 
virtual void StopOptimization ()
 
- Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
const ParametersType & GetCurrentPosition () const override
 
virtual bool GetMaximize () const
 
virtual const ScaledCostFunctionTypeGetScaledCostFunction ()
 
virtual const ParametersType & GetScaledCurrentPosition ()
 
bool GetUseScales () const
 
virtual void InitializeScales ()
 
 ITK_DISALLOW_COPY_AND_MOVE (ScaledSingleValuedNonLinearOptimizer)
 
virtual void MaximizeOff ()
 
virtual void MaximizeOn ()
 
void SetCostFunction (CostFunctionType *costFunction) override
 
virtual void SetMaximize (bool _arg)
 
virtual void SetUseScales (bool arg)
 
- Public Member Functions inherited from elastix::OptimizerBase< TElastix >
void AfterRegistrationBase () override
 
void BeforeEachResolutionBase () override
 
ITKBaseTypeGetAsITKBaseType ()
 
const ITKBaseTypeGetAsITKBaseType () const
 
 ITK_DISALLOW_COPY_AND_MOVE (OptimizerBase)
 
virtual void SetCurrentPositionPublic (const ParametersType &param)
 
virtual void SetSinusScales (double amplitude, double frequency, unsigned long numberOfParameters)
 
- Public Member Functions inherited from elastix::BaseComponentSE< TElastix >
void AddTargetCellToIterationInfo (const char *const name)
 
const ConfigurationGetConfiguration () const
 
ElastixTypeGetElastix () const
 
auto & GetIterationInfoAt (const char *const name)
 
RegistrationTypeGetRegistration () const
 
 ITK_DISALLOW_COPY_AND_MOVE (BaseComponentSE)
 
void RemoveTargetCellFromIterationInfo (const char *const name)
 
void SetConfiguration (const Configuration *_arg)
 
void SetElastix (ElastixType *_arg)
 
- Public Member Functions inherited from elastix::BaseComponent
virtual void AfterEachIterationBase ()
 
virtual void AfterEachResolutionBase ()
 
virtual int BeforeAll ()
 
virtual int BeforeAllBase ()
 
virtual void BeforeRegistrationBase ()
 
virtual const char * elxGetClassName () const
 
const char * GetComponentLabel () const
 
 ITK_DISALLOW_COPY_AND_MOVE (BaseComponent)
 
 itkTypeMacroNoParent (BaseComponent)
 
void SetComponentLabel (const char *label, unsigned int idx)
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::CMAEvolutionStrategyOptimizer
static Pointer New ()
 
- Static Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
static Pointer New ()
 
- Static Public Member Functions inherited from elastix::BaseComponent
template<typename TBaseComponent >
static auto AsITKBaseType (TBaseComponent *const baseComponent) -> decltype(baseComponent->GetAsITKBaseType())
 
static void InitializeElastixExecutable ()
 
static bool IsElastixLibrary ()
 

Protected Member Functions

 CMAEvolutionStrategy ()=default
 
void InitializeProgressVariables () override
 
 ~CMAEvolutionStrategy () override=default
 
- Protected Member Functions inherited from itk::CMAEvolutionStrategyOptimizer
virtual void AdvanceOneStep ()
 
 CMAEvolutionStrategyOptimizer ()
 
virtual void FixNumericalErrors ()
 
virtual void GenerateOffspring ()
 
virtual void InitializeBCD ()
 
virtual void InitializeConstants ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void SortCostFunctionValues ()
 
virtual bool TestConvergence (bool firstCheck)
 
virtual void UpdateBD ()
 
virtual void UpdateC ()
 
virtual void UpdateConjugateEvolutionPath ()
 
virtual void UpdateEvolutionPath ()
 
virtual void UpdateHeaviside ()
 
virtual void UpdateSigma ()
 
 ~CMAEvolutionStrategyOptimizer () override=default
 
- Protected Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
virtual void GetScaledDerivative (const ParametersType &parameters, DerivativeType &derivative) const
 
virtual MeasureType GetScaledValue (const ParametersType &parameters) const
 
virtual void GetScaledValueAndDerivative (const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ScaledSingleValuedNonLinearOptimizer ()
 
void SetCurrentPosition (const ParametersType &param) override
 
virtual void SetScaledCurrentPosition (const ParametersType &parameters)
 
 ~ScaledSingleValuedNonLinearOptimizer () override=default
 
- Protected Member Functions inherited from elastix::OptimizerBase< TElastix >
virtual bool GetNewSamplesEveryIteration () const
 
 OptimizerBase ()=default
 
virtual void SelectNewSamples ()
 
 ~OptimizerBase () override=default
 
- Protected Member Functions inherited from elastix::BaseComponentSE< TElastix >
 BaseComponentSE ()=default
 
 ~BaseComponentSE () override=default
 
- Protected Member Functions inherited from elastix::BaseComponent
 BaseComponent ()=default
 
virtual ~BaseComponent ()=default
 

Private Attributes

 elxOverrideGetSelfMacro
 

Additional Inherited Members

- Protected Types inherited from itk::CMAEvolutionStrategyOptimizer
using CovarianceMatrixType = vnl_matrix<double>
 
using EigenValueMatrixType = vnl_diag_matrix<double>
 
using MeasureContainerType = std::vector<MeasureIndexPairType>
 
using MeasureHistoryType = std::deque<MeasureType>
 
using MeasureIndexPairType = std::pair<MeasureType, unsigned int>
 
using ParameterContainerType = std::vector<ParametersType>
 
using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator
 
using RecombinationWeightsType = Array<double>
 
- Protected Types inherited from elastix::OptimizerBase< TElastix >
using SettingsVectorType = typename std::vector<SettingsType>
 
- Static Protected Member Functions inherited from elastix::OptimizerBase< TElastix >
static void PrintSettingsVector (const SettingsVectorType &settings)
 
- Protected Attributes inherited from itk::CMAEvolutionStrategyOptimizer
CovarianceMatrixType m_B {}
 
CovarianceMatrixType m_C {}
 
ParametersType m_ConjugateEvolutionPath {}
 
double m_ConjugateEvolutionPathConstant { 0.0 }
 
MeasureContainerType m_CostFunctionValues {}
 
double m_CovarianceMatrixAdaptationConstant { 0.0 }
 
double m_CovarianceMatrixAdaptationWeight { 0.0 }
 
unsigned long m_CurrentIteration { 0 }
 
double m_CurrentMaximumD { 1.0 }
 
double m_CurrentMinimumD { 1.0 }
 
ParametersType m_CurrentNormalizedStep {}
 
ParametersType m_CurrentScaledStep {}
 
double m_CurrentSigma { 0.0 }
 
MeasureType m_CurrentValue { 0.0 }
 
EigenValueMatrixType m_D {}
 
double m_EffectiveMu { 0.0 }
 
ParametersType m_EvolutionPath {}
 
double m_EvolutionPathConstant { 0.0 }
 
double m_ExpectationNormNormalDistribution { 0.0 }
 
bool m_Heaviside { false }
 
unsigned long m_HistoryLength { 0 }
 
MeasureHistoryType m_MeasureHistory {}
 
ParameterContainerType m_NormalizedSearchDirs {}
 
unsigned int m_NumberOfParents { 0 }
 
unsigned int m_PopulationSize { 0 }
 
RandomGeneratorType::Pointer m_RandomGenerator { RandomGeneratorType::GetInstance() }
 
RecombinationWeightsType m_RecombinationWeights {}
 
ParameterContainerType m_SearchDirs {}
 
double m_SigmaDampingConstant { 0.0 }
 
bool m_Stop { false }
 
StopConditionType m_StopCondition { Unknown }
 
unsigned int m_UpdateBDPeriod { 1 }
 
bool m_UseCovarianceMatrixAdaptation { true }
 
- Protected Attributes inherited from itk::ScaledSingleValuedNonLinearOptimizer
ScaledCostFunctionPointer m_ScaledCostFunction {}
 
ParametersType m_ScaledCurrentPosition {}
 
- Protected Attributes inherited from elastix::BaseComponentSE< TElastix >
Configuration::ConstPointer m_Configuration {}
 
itk::WeakPointer< TElastix > m_Elastix {}
 
RegistrationTypem_Registration {}
 

Member Typedef Documentation

◆ ConstPointer

template<class TElastix >
using elastix::CMAEvolutionStrategy< TElastix >::ConstPointer = itk::SmartPointer<const Self>

Definition at line 127 of file elxCMAEvolutionStrategy.h.

◆ ITKBaseType

template<class TElastix >
using elastix::CMAEvolutionStrategy< TElastix >::ITKBaseType = typename Superclass2::ITKBaseType

Definition at line 152 of file elxCMAEvolutionStrategy.h.

◆ Pointer

template<class TElastix >
using elastix::CMAEvolutionStrategy< TElastix >::Pointer = itk::SmartPointer<Self>

Definition at line 126 of file elxCMAEvolutionStrategy.h.

◆ Self

template<class TElastix >
using elastix::CMAEvolutionStrategy< TElastix >::Self = CMAEvolutionStrategy

Standard ITK.

Definition at line 123 of file elxCMAEvolutionStrategy.h.

◆ Superclass1

template<class TElastix >
using elastix::CMAEvolutionStrategy< TElastix >::Superclass1 = CMAEvolutionStrategyOptimizer

Definition at line 124 of file elxCMAEvolutionStrategy.h.

◆ Superclass2

template<class TElastix >
using elastix::CMAEvolutionStrategy< TElastix >::Superclass2 = OptimizerBase<TElastix>

Definition at line 125 of file elxCMAEvolutionStrategy.h.

Member Enumeration Documentation

◆ StopConditionType

Definition at line 69 of file itkCMAEvolutionStrategyOptimizer.h.

Constructor & Destructor Documentation

◆ CMAEvolutionStrategy()

template<class TElastix >
elastix::CMAEvolutionStrategy< TElastix >::CMAEvolutionStrategy ( )
protecteddefault

◆ ~CMAEvolutionStrategy()

template<class TElastix >
elastix::CMAEvolutionStrategy< TElastix >::~CMAEvolutionStrategy ( )
overrideprotecteddefault

Member Function Documentation

◆ AfterEachIteration()

template<class TElastix >
void elastix::CMAEvolutionStrategy< TElastix >::AfterEachIteration ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ AfterEachResolution()

template<class TElastix >
void elastix::CMAEvolutionStrategy< TElastix >::AfterEachResolution ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ AfterRegistration()

template<class TElastix >
void elastix::CMAEvolutionStrategy< TElastix >::AfterRegistration ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ BeforeEachResolution()

template<class TElastix >
void elastix::CMAEvolutionStrategy< TElastix >::BeforeEachResolution ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ BeforeRegistration()

template<class TElastix >
void elastix::CMAEvolutionStrategy< TElastix >::BeforeRegistration ( )
overridevirtual

Methods to set parameters and print output at different stages in the registration process.

Reimplemented from elastix::BaseComponent.

◆ elxClassNameMacro()

template<class TElastix >
elastix::CMAEvolutionStrategy< TElastix >::elxClassNameMacro ( "CMAEvolutionStrategy< TElastix >" )

Name of this class. Use this name in the parameter file to select this specific optimizer.
example: (Optimizer "CMAEvolutionStrategy")

◆ GetClassName()

template<class TElastix >
virtual const char * elastix::CMAEvolutionStrategy< TElastix >::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::CMAEvolutionStrategyOptimizer.

◆ InitializeProgressVariables()

template<class TElastix >
void elastix::CMAEvolutionStrategy< TElastix >::InitializeProgressVariables ( )
overrideprotectedvirtual

Call the superclass' implementation and print the value of some variables

Reimplemented from itk::CMAEvolutionStrategyOptimizer.

◆ ITK_DISALLOW_COPY_AND_MOVE()

template<class TElastix >
elastix::CMAEvolutionStrategy< TElastix >::ITK_DISALLOW_COPY_AND_MOVE ( CMAEvolutionStrategy< TElastix > )

◆ New()

template<class TElastix >
static Pointer elastix::CMAEvolutionStrategy< TElastix >::New ( )
static

Method for creation through the object factory.

◆ StartOptimization()

template<class TElastix >
void elastix::CMAEvolutionStrategy< TElastix >::StartOptimization ( )
override

Check if any scales are set, and set the UseScales flag on or off; after that call the superclass' implementation

Field Documentation

◆ elxOverrideGetSelfMacro

template<class TElastix >
elastix::CMAEvolutionStrategy< TElastix >::elxOverrideGetSelfMacro
private

Definition at line 185 of file elxCMAEvolutionStrategy.h.



Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo