![]() |
ITK
4.13.0
Insight Segmentation and Registration Toolkit
|
#include <itkPowellOptimizerv4.h>
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 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 59 of file itkPowellOptimizerv4.h.
Public Member Functions | |
virtual ::itk::LightObject::Pointer | CreateAnother () const |
virtual const bool & | GetCatchGetValueException () const |
virtual const unsigned int & | GetCurrentLineIteration () const |
virtual const double & | GetMetricWorstPossibleValue () const |
virtual const char * | GetNameOfClass () const |
virtual const std::string | GetStopConditionDescription () const override |
virtual void | SetCatchGetValueException (bool _arg) |
virtual void | SetMetricWorstPossibleValue (double _arg) |
virtual void | StartOptimization (bool doOnlyInitialization=false) override |
void | StopOptimization () |
virtual void | SetMaximumIteration (unsigned int _arg) |
virtual const unsigned int & | GetMaximumIteration () const |
virtual void | SetMaximumLineIteration (unsigned int _arg) |
virtual unsigned int | GetMaximumLineIteration () const |
virtual void | SetStepLength (double _arg) |
virtual const double & | GetStepLength () const |
virtual void | SetStepTolerance (double _arg) |
virtual const double & | GetStepTolerance () const |
virtual void | SetValueTolerance (double _arg) |
virtual const double & | GetValueTolerance () const |
virtual const MeasureType & | GetCurrentCost () const |
virtual const MeasureType & | GetValue () const override |
![]() | |
virtual SizeValueType | GetCurrentIteration () const |
virtual const MeasureType & | GetCurrentMetricValue () const |
virtual const ParametersType & | GetCurrentPosition () const |
virtual SizeValueType | GetNumberOfIterations () const |
virtual const ThreadIdType & | GetNumberOfThreads () const |
virtual const ScalesType & | GetScales () const |
virtual const bool & | GetScalesAreIdentity () const |
bool | GetScalesInitialized () const |
virtual const ScalesType & | GetWeights () 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 MetricType * | GetModifiableMetric () |
virtual const MetricType * | GetMetric () const |
virtual void | SetScales (const ScalesType &scales) |
virtual void | SetDoEstimateScales (bool _arg) |
virtual const bool & | GetDoEstimateScales () const |
virtual void | DoEstimateScalesOn () |
virtual void | DoEstimateScalesOff () |
![]() | |
unsigned long | AddObserver (const EventObject &event, Command *) |
unsigned long | AddObserver (const EventObject &event, Command *) const |
virtual void | DebugOff () const |
virtual void | DebugOn () const |
Command * | GetCommand (unsigned long tag) |
bool | GetDebug () const |
MetaDataDictionary & | GetMetaDataDictionary () |
const MetaDataDictionary & | GetMetaDataDictionary () const |
virtual ModifiedTimeType | GetMTime () const |
virtual const TimeStamp & | GetTimeStamp () const |
bool | HasObserver (const EventObject &event) const |
void | InvokeEvent (const EventObject &) |
void | InvokeEvent (const EventObject &) const |
virtual void | Modified () const |
virtual void | Register () const override |
void | RemoveAllObservers () |
void | RemoveObserver (unsigned long tag) |
void | SetDebug (bool debugFlag) const |
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
virtual void | SetReferenceCount (int) override |
virtual void | UnRegister () const noexceptoverride |
virtual void | SetObjectName (std::string _arg) |
virtual const std::string & | GetObjectName () const |
![]() | |
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 bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOff () |
static void | GlobalWarningDisplayOn () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool flag) |
![]() | |
static void | BreakOnError () |
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) |
PowellOptimizerv4 () | |
PowellOptimizerv4 (const PowellOptimizerv4 &) | |
virtual void | PrintSelf (std::ostream &os, Indent indent) const override |
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 | ~PowellOptimizerv4 () override |
![]() | |
ObjectToObjectOptimizerBaseTemplate () | |
virtual | ~ObjectToObjectOptimizerBaseTemplate () override |
![]() | |
Object () | |
bool | PrintObservers (std::ostream &os, Indent indent) const |
virtual void | SetTimeStamp (const TimeStamp &time) |
virtual | ~Object () override |
![]() | |
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_CurrentLineIteration |
ParametersType | m_CurrentPosition |
vnl_vector< double > | m_LineDirection |
ParametersType | m_LineOrigin |
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 | |
![]() | |
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 |
![]() | |
AtomicInt< int > | m_ReferenceCount |
typedef SmartPointer< const Self > itk::PowellOptimizerv4< TInternalComputationValueType >::ConstPointer |
Definition at line 67 of file itkPowellOptimizerv4.h.
typedef Superclass::MeasureType itk::PowellOptimizerv4< TInternalComputationValueType >::MeasureType |
Definition at line 76 of file itkPowellOptimizerv4.h.
typedef Superclass::ParametersType itk::PowellOptimizerv4< TInternalComputationValueType >::ParametersType |
Definition at line 73 of file itkPowellOptimizerv4.h.
typedef SmartPointer< Self > itk::PowellOptimizerv4< TInternalComputationValueType >::Pointer |
Definition at line 66 of file itkPowellOptimizerv4.h.
typedef Superclass::ScalesType itk::PowellOptimizerv4< TInternalComputationValueType >::ScalesType |
Definition at line 77 of file itkPowellOptimizerv4.h.
typedef PowellOptimizerv4 itk::PowellOptimizerv4< TInternalComputationValueType >::Self |
Standard "Self" typedef.
Definition at line 64 of file itkPowellOptimizerv4.h.
typedef ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType> itk::PowellOptimizerv4< TInternalComputationValueType >::Superclass |
Definition at line 65 of file itkPowellOptimizerv4.h.
|
protected |
|
protected |
|
overrideprotectedvirtual |
|
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.
|
protectedvirtual |
|
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 |
|
virtual |
Return Current Value
|
virtual |
Get the current line search iteration
|
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
|
protected |
|
virtual |
Set/Get maximum iteration limit.
|
virtual |
Set/Get the maximum number of line search iterations
|
virtual |
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >.
|
protectedvirtual |
|
virtual |
Set/Get StepLength for the (scaled) spacing of the sampling of parameter space while bracketing the extremum
|
virtual |
Set/Get StepTolerance. Once the local extreme is known to be within this distance of the current parameter values, optimization terminates
|
protectedvirtual |
|
overridevirtual |
Stop condition return string type
Implements itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >.
|
inlineoverridevirtual |
Return Current Value
Reimplemented from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >.
Definition at line 110 of file itkPowellOptimizerv4.h.
|
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
|
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.
|
protectedvirtual |
|
static |
Method for creation through the object factory.
|
overrideprotectedvirtual |
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::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >.
|
virtual |
|
protectedvirtual |
|
protectedvirtual |
|
protected |
Set the given scalar step distance (x) and function value (fx) as the "best-so-far" optimizer values.
|
protected |
Used to specify the line direction through the n-dimensional parameter space the is currently being bracketed and optimized.
|
virtual |
Set/Get maximum iteration limit.
|
virtual |
Set/Get the maximum number of line search iterations
|
virtual |
|
inlineprotected |
Definition at line 196 of file itkPowellOptimizerv4.h.
|
virtual |
Set/Get StepLength for the (scaled) spacing of the sampling of parameter space while bracketing the extremum
|
virtual |
Set/Get StepTolerance. Once the local extreme is known to be within this distance of the current parameter values, optimization terminates
|
protectedvirtual |
|
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
|
protected |
Used in bracketing the extreme along the current line. Adapted from NRC
|
overridevirtual |
Start optimization.
Reimplemented from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >.
|
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 122 of file itkPowellOptimizerv4.h.
|
protected |
Used in bracketing the extreme along the current line. Adapted from NRC
|
private |
Definition at line 220 of file itkPowellOptimizerv4.h.
|
private |
Internal storage for the value type / used as a cache
Definition at line 233 of file itkPowellOptimizerv4.h.
|
private |
Current iteration
Definition at line 214 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 241 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 228 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 227 of file itkPowellOptimizerv4.h.
|
private |
Maximum iteration limit.
Definition at line 217 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 218 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 221 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 208 of file itkPowellOptimizerv4.h.
|
private |
The minimal size of search
Definition at line 224 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 225 of file itkPowellOptimizerv4.h.
|
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 239 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 243 of file itkPowellOptimizerv4.h.
|
private |
Definition at line 230 of file itkPowellOptimizerv4.h.