go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
itk::ScaledSingleValuedNonLinearOptimizer Class Reference

#include <itkScaledSingleValuedNonLinearOptimizer.h>

Detailed Description

Optimizers that inherit from this class optimize a scaled cost function $F(y)$ instead of the original function $f(x)$:

\[ y    = x \cdot s  \]

\[ F(y) = f(y/s) \]

where $y$ are the scaled parameters, $x$ the original parameters and $s$ the scales.

During optimization the inheriting classes should update the ScaledCurrentPosition ( $y$) instead of the CurrentPosition ( $y/s$).

When an optimizer needs the value at a (scaled) position $y$, it should use the function this->GetScaledValue( $y$) instead of the GetValue method. Similar for the derivative.

Typically, in StartOptimization() the following line should be present:
this->SetCurrentPosition(this->GetInitialPosition);
This makes sure that the initial position $y_0 = x_0 \cdot s$, where $x_0$ is the initial (unscaled) position entered by the user.

Note that:

Definition at line 62 of file itkScaledSingleValuedNonLinearOptimizer.h.

+ Inheritance diagram for itk::ScaledSingleValuedNonLinearOptimizer:

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::CostFunctionType CostFunctionType
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::MeasureType MeasureType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef ScaledCostFunctionType::Pointer ScaledCostFunctionPointer
 
typedef ScaledSingleValuedCostFunction ScaledCostFunctionType
 
typedef NonLinearOptimizer::ScalesType ScalesType
 
typedef ScaledSingleValuedNonLinearOptimizer Self
 
typedef SingleValuedNonLinearOptimizer Superclass
 

Public Member Functions

virtual const char * GetClassName () const
 
const ParametersTypeGetCurrentPosition (void) const override
 
virtual bool GetMaximize () const
 
virtual const ScaledCostFunctionTypeGetScaledCostFunction ()
 
virtual const ParametersTypeGetScaledCurrentPosition ()
 
bool GetUseScales (void) const
 
virtual void InitializeScales (void)
 
virtual void MaximizeOff ()
 
virtual void MaximizeOn ()
 
void SetCostFunction (CostFunctionType *costFunction) override
 
virtual void SetMaximize (bool _arg)
 
virtual void SetUseScales (bool arg)
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

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
 

Protected Attributes

ScaledCostFunctionPointer m_ScaledCostFunction
 
ParametersType m_ScaledCurrentPosition
 

Private Member Functions

void operator= (const Self &)
 
 ScaledSingleValuedNonLinearOptimizer (const Self &)
 

Private Attributes

bool m_Maximize
 
ParametersType m_UnscaledCurrentPosition
 

Member Typedef Documentation

◆ ConstPointer

Definition at line 71 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ CostFunctionType

Definition at line 84 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ DerivativeType

Definition at line 83 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ MeasureType

Typedefs inherited from the superclass.

Definition at line 81 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ParametersType

Definition at line 82 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ Pointer

Definition at line 70 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ScaledCostFunctionPointer

Definition at line 88 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ScaledCostFunctionType

Definition at line 87 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ScalesType

typedef NonLinearOptimizer::ScalesType itk::ScaledSingleValuedNonLinearOptimizer::ScalesType

Definition at line 86 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ Self

Standard ITK-stuff.

Definition at line 68 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ Superclass

Definition at line 69 of file itkScaledSingleValuedNonLinearOptimizer.h.

Constructor & Destructor Documentation

◆ ScaledSingleValuedNonLinearOptimizer() [1/2]

itk::ScaledSingleValuedNonLinearOptimizer::ScaledSingleValuedNonLinearOptimizer ( )
protected

The constructor.

◆ ~ScaledSingleValuedNonLinearOptimizer()

itk::ScaledSingleValuedNonLinearOptimizer::~ScaledSingleValuedNonLinearOptimizer ( )
inlineoverrideprotected

The destructor.

Definition at line 134 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ScaledSingleValuedNonLinearOptimizer() [2/2]

itk::ScaledSingleValuedNonLinearOptimizer::ScaledSingleValuedNonLinearOptimizer ( const Self )
private

The private constructor.

Member Function Documentation

◆ GetClassName()

virtual const char * itk::ScaledSingleValuedNonLinearOptimizer::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented in itk::ComputeDisplacementDistribution< TFixedImage, TTransform >, itk::ComputePreconditionerUsingDisplacementDistribution< TFixedImage, TTransform >, elastix::AdaGrad< TElastix >, itk::AdaptiveStepsizeOptimizer, elastix::AdaptiveStochasticGradientDescent< TElastix >, itk::AdaptiveStochasticGradientDescentOptimizer, elastix::AdaptiveStochasticLBFGS< TElastix >, itk::AdaptiveStochasticLBFGSOptimizer, elastix::AdaptiveStochasticVarianceReducedGradient< TElastix >, itk::AdaptiveStochasticVarianceReducedGradientOptimizer, itk::StandardStochasticVarianceReducedGradientOptimizer, itk::StochasticVarianceReducedGradientDescentOptimizer, elastix::CMAEvolutionStrategy< TElastix >, itk::CMAEvolutionStrategyOptimizer, elastix::ConjugateGradient< TElastix >, itk::GenericConjugateGradientOptimizer, elastix::FiniteDifferenceGradientDescent< TElastix >, itk::FiniteDifferenceGradientDescentOptimizer, elastix::PreconditionedGradientDescent< TElastix >, itk::AdaptiveStochasticPreconditionedGradientDescentOptimizer, itk::PreconditionedGradientDescentOptimizer, itk::StochasticPreconditionedGradientDescentOptimizer, elastix::PreconditionedStochasticGradientDescent< TElastix >, itk::PreconditionedASGDOptimizer, elastix::QuasiNewtonLBFGS< TElastix >, itk::QuasiNewtonLBFGSOptimizer, elastix::StandardGradientDescent< TElastix >, itk::GradientDescentOptimizer2, itk::StandardGradientDescentOptimizer, itk::StandardStochasticGradientOptimizer, and itk::StochasticGradientDescentOptimizer.

◆ GetCurrentPosition()

const ParametersType & itk::ScaledSingleValuedNonLinearOptimizer::GetCurrentPosition ( void  ) const
override

Get the current unscaled position: get the ScaledCurrentPosition and divide each element through its scale.

◆ GetMaximize()

virtual bool itk::ScaledSingleValuedNonLinearOptimizer::GetMaximize ( ) const
virtual

◆ GetScaledCostFunction()

virtual const ScaledCostFunctionType * itk::ScaledSingleValuedNonLinearOptimizer::GetScaledCostFunction ( )
virtual

Get a pointer to the scaled cost function.

◆ GetScaledCurrentPosition()

virtual const ParametersType & itk::ScaledSingleValuedNonLinearOptimizer::GetScaledCurrentPosition ( )
virtual

Get the current scaled position.

◆ GetScaledDerivative()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::GetScaledDerivative ( const ParametersType parameters,
DerivativeType derivative 
) const
protectedvirtual

Divide the (scaled) parameters by the scales, call the GetDerivative routine of the unscaled cost function and divide the resulting derivative by the scales.

◆ GetScaledValue()

virtual MeasureType itk::ScaledSingleValuedNonLinearOptimizer::GetScaledValue ( const ParametersType parameters) const
protectedvirtual

Divide the (scaled) parameters by the scales and call the GetValue routine of the unscaled cost function.

◆ GetScaledValueAndDerivative()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::GetScaledValueAndDerivative ( const ParametersType parameters,
MeasureType value,
DerivativeType derivative 
) const
protectedvirtual

Same procedure as in GetValue and GetDerivative.

◆ GetUseScales()

bool itk::ScaledSingleValuedNonLinearOptimizer::GetUseScales ( void  ) const

◆ InitializeScales()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::InitializeScales ( void  )
virtual

Configure the scaled cost function. This function sets the current scales in the ScaledCostFunction. NB: it assumes that the scales entered by the user are the squared scales (following the ITK convention). Call this method in StartOptimization() and after entering new scales.

◆ MaximizeOff()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::MaximizeOff ( )
virtual

◆ MaximizeOn()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::MaximizeOn ( )
virtual

Setting: set to 'true' if you want to maximize the cost function. It forces the scaledCostFunction to negate the cost function value and its derivative.

◆ New()

static Pointer itk::ScaledSingleValuedNonLinearOptimizer::New ( )
static

Method for creation through the object factory.

◆ operator=()

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

The private copy constructor.

◆ PrintSelf()

void itk::ScaledSingleValuedNonLinearOptimizer::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
overrideprotected

PrintSelf.

◆ SetCostFunction()

void itk::ScaledSingleValuedNonLinearOptimizer::SetCostFunction ( CostFunctionType costFunction)
override

Setting: SetCostFunction.

◆ SetCurrentPosition()

void itk::ScaledSingleValuedNonLinearOptimizer::SetCurrentPosition ( const ParametersType param)
overrideprotected

Set the scaled current position by entering the non-scaled parameters. The method multiplies param by the scales and calls SetScaledCurrentPosition.

Note: It is not possible (and needed) anymore to set m_CurrentPosition. Optimizers that inherit from this class should optimize the scaled parameters!

This method will probably only be used to convert the InitialPosition entered by the user.

◆ SetMaximize()

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

◆ SetScaledCurrentPosition()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetScaledCurrentPosition ( const ParametersType parameters)
protectedvirtual

Set m_ScaledCurrentPosition.

◆ SetUseScales()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetUseScales ( bool  arg)
virtual

Setting: Turn on/off the use of scales. Set this flag to false when no scaling is desired.

Field Documentation

◆ m_Maximize

bool itk::ScaledSingleValuedNonLinearOptimizer::m_Maximize
private

Definition at line 191 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ m_ScaledCostFunction

ScaledCostFunctionPointer itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCostFunction
protected

Definition at line 141 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ m_ScaledCurrentPosition

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCurrentPosition
protected

Member variables.

Definition at line 140 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ m_UnscaledCurrentPosition

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_UnscaledCurrentPosition
mutableprivate

Variable to store the CurrentPosition, when the function GetCurrentPosition is called. This method needs a member variable, because the GetCurrentPosition return something by reference.

Definition at line 190 of file itkScaledSingleValuedNonLinearOptimizer.h.



Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo