ITK  5.2.0
Insight Toolkit
itkAmoebaOptimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkAmoebaOptimizer_h
19 #define itkAmoebaOptimizer_h
20 
22 #include "vnl/algo/vnl_amoeba.h"
23 #include "ITKOptimizersExport.h"
24 
25 namespace itk
26 {
66 class ITKOptimizers_EXPORT AmoebaOptimizer : public SingleValuedNonLinearVnlOptimizer
67 {
68 public:
69  ITK_DISALLOW_COPY_AND_MOVE(AmoebaOptimizer);
70 
76  using NumberOfIterationsType = unsigned int;
77 
79  itkNewMacro(Self);
80 
83 
86  using ParametersType = Superclass::ParametersType;
87 
89  using InternalParametersType = vnl_vector<double>;
90 
92  void
93  StartOptimization() override;
94 
96  void
97  SetCostFunction(SingleValuedCostFunction * costFunction) override;
98 
102  itkSetMacro(MaximumNumberOfIterations, NumberOfIterationsType);
103  itkGetConstMacro(MaximumNumberOfIterations, NumberOfIterationsType);
105 
114  itkSetMacro(AutomaticInitialSimplex, bool);
115  itkBooleanMacro(AutomaticInitialSimplex);
116  itkGetConstMacro(AutomaticInitialSimplex, bool);
118 
125  itkSetMacro(OptimizeWithRestarts, bool);
126  itkBooleanMacro(OptimizeWithRestarts);
127  itkGetConstMacro(OptimizeWithRestarts, bool);
129 
132  void
133  SetInitialSimplexDelta(ParametersType initialSimplexDelta, bool automaticInitialSimplex = false);
134  itkGetConstMacro(InitialSimplexDelta, ParametersType);
136 
141  itkSetMacro(ParametersConvergenceTolerance, double);
142  itkGetConstMacro(ParametersConvergenceTolerance, double);
144 
149  itkSetMacro(FunctionConvergenceTolerance, double);
150  itkGetConstMacro(FunctionConvergenceTolerance, double);
152 
154  const std::string
155  GetStopConditionDescription() const override;
156 
159  GetValue() const;
160 
162  vnl_amoeba *
163  GetOptimizer() const;
164 
165 protected:
166  AmoebaOptimizer();
167  ~AmoebaOptimizer() override;
168  void
169  PrintSelf(std::ostream & os, Indent indent) const override;
170 
171  using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
172 
173 private:
175  void
176  ValidateSettings();
177 
179  ParametersType::ValueType m_ParametersConvergenceTolerance;
180  CostFunctionType::MeasureType m_FunctionConvergenceTolerance;
184  vnl_amoeba * m_VnlOptimizer;
185 
186  std::ostringstream m_StopConditionDescription;
187 };
188 } // end namespace itk
189 
190 #endif
itk::AmoebaOptimizer::CostFunctionAdaptorType
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
Definition: itkAmoebaOptimizer.h:171
itk::AmoebaOptimizer::m_OptimizeWithRestarts
bool m_OptimizeWithRestarts
Definition: itkAmoebaOptimizer.h:183
itk::AmoebaOptimizer::ParametersType
Superclass::ParametersType ParametersType
Definition: itkAmoebaOptimizer.h:86
itk::AmoebaOptimizer::m_AutomaticInitialSimplex
bool m_AutomaticInitialSimplex
Definition: itkAmoebaOptimizer.h:181
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::AmoebaOptimizer::m_ParametersConvergenceTolerance
ParametersType::ValueType m_ParametersConvergenceTolerance
Definition: itkAmoebaOptimizer.h:179
itk::AmoebaOptimizer::m_VnlOptimizer
vnl_amoeba * m_VnlOptimizer
Definition: itkAmoebaOptimizer.h:184
itk::AmoebaOptimizer::m_InitialSimplexDelta
ParametersType m_InitialSimplexDelta
Definition: itkAmoebaOptimizer.h:182
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::AmoebaOptimizer::NumberOfIterationsType
unsigned int NumberOfIterationsType
Definition: itkAmoebaOptimizer.h:76
itk::AmoebaOptimizer::m_FunctionConvergenceTolerance
CostFunctionType::MeasureType m_FunctionConvergenceTolerance
Definition: itkAmoebaOptimizer.h:180
itk::SingleValuedCostFunction
This class is a base for the CostFunctions returning a single value.
Definition: itkSingleValuedCostFunction.h:34
itk::AmoebaOptimizer::InternalParametersType
vnl_vector< double > InternalParametersType
Definition: itkAmoebaOptimizer.h:89
itk::AmoebaOptimizer::m_StopConditionDescription
std::ostringstream m_StopConditionDescription
Definition: itkAmoebaOptimizer.h:186
itkSingleValuedNonLinearVnlOptimizer.h
itk::AmoebaOptimizer
Wrap of the vnl_amoeba algorithm.
Definition: itkAmoebaOptimizer.h:66
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::SingleValuedNonLinearOptimizer::MeasureType
CostFunctionType::MeasureType MeasureType
Definition: itkSingleValuedNonLinearOptimizer.h:62
itk::SingleValuedNonLinearVnlOptimizer
This class is a base for the Optimization methods that optimize a single valued function.
Definition: itkSingleValuedNonLinearVnlOptimizer.h:37
itk::AmoebaOptimizer::m_MaximumNumberOfIterations
NumberOfIterationsType m_MaximumNumberOfIterations
Definition: itkAmoebaOptimizer.h:178