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 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 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:
Inheritance graph

Public Types

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 Member Functions

virtual const char * GetClassName () const
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)

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=default

Protected Attributes

ScaledCostFunctionPointer m_ScaledCostFunction
ParametersType m_ScaledCurrentPosition

Private Attributes

bool m_Maximize
ParametersType m_UnscaledCurrentPosition

Member Typedef Documentation

◆ ConstPointer

Definition at line 71 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ Pointer

Definition at line 70 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ScaledCostFunctionPointer

Definition at line 87 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ScaledCostFunctionType

Definition at line 86 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ ScalesType

using itk::ScaledSingleValuedNonLinearOptimizer::ScalesType = NonLinearOptimizer::ScalesType

Definition at line 85 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()

itk::ScaledSingleValuedNonLinearOptimizer::ScaledSingleValuedNonLinearOptimizer ( )

The constructor.

◆ ~ScaledSingleValuedNonLinearOptimizer()

itk::ScaledSingleValuedNonLinearOptimizer::~ScaledSingleValuedNonLinearOptimizer ( )

The destructor.

Member Function Documentation

◆ GetClassName()

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

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 ( ) const

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

◆ GetMaximize()

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

◆ GetScaledCostFunction()

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

Get a pointer to the scaled cost function.

◆ GetScaledCurrentPosition()

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

Get the current scaled position.

◆ GetScaledDerivative()

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

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

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

Same procedure as in GetValue and GetDerivative.

◆ GetUseScales()

bool itk::ScaledSingleValuedNonLinearOptimizer::GetUseScales ( ) const

◆ InitializeScales()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::InitializeScales ( )

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.


itk::ScaledSingleValuedNonLinearOptimizer::ITK_DISALLOW_COPY_AND_MOVE ( ScaledSingleValuedNonLinearOptimizer  )

◆ MaximizeOff()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::MaximizeOff ( )

◆ MaximizeOn()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::MaximizeOn ( )

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 ( )

Method for creation through the object factory.

◆ PrintSelf()

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


◆ SetCostFunction()

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

Setting: SetCostFunction.

◆ SetCurrentPosition()

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

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)

◆ SetScaledCurrentPosition()

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

Set m_ScaledCurrentPosition.

◆ SetUseScales()

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

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

Definition at line 191 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ m_ScaledCostFunction

ScaledCostFunctionPointer itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCostFunction

Definition at line 146 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ m_ScaledCurrentPosition

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCurrentPosition

Member variables.

Definition at line 145 of file itkScaledSingleValuedNonLinearOptimizer.h.

◆ m_UnscaledCurrentPosition

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_UnscaledCurrentPosition

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 Wed 12 Apr 2023 for elastix by doxygen 1.9.6 elastix logo