ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkAmoebaOptimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
62 class ITKOptimizers_EXPORT AmoebaOptimizer:
64 {
65 public:
66  ITK_DISALLOW_COPY_AND_ASSIGN(AmoebaOptimizer);
67 
73  using NumberOfIterationsType = unsigned int;
74 
76  itkNewMacro(Self);
77 
80 
83  using ParametersType = Superclass::ParametersType;
84 
86  using InternalParametersType = vnl_vector< double >;
87 
89  void StartOptimization() override;
90 
92  void SetCostFunction(SingleValuedCostFunction *costFunction) override;
93 
97  itkSetMacro( MaximumNumberOfIterations, NumberOfIterationsType );
98  itkGetConstMacro( MaximumNumberOfIterations, NumberOfIterationsType );
100 
109  itkSetMacro(AutomaticInitialSimplex, bool);
110  itkBooleanMacro(AutomaticInitialSimplex);
111  itkGetConstMacro(AutomaticInitialSimplex, bool);
113 
120  itkSetMacro(OptimizeWithRestarts, bool);
121  itkBooleanMacro(OptimizeWithRestarts);
122  itkGetConstMacro(OptimizeWithRestarts, bool);
124 
127  void SetInitialSimplexDelta(ParametersType initialSimplexDelta,
128  bool automaticInitialSimplex = false);
129  itkGetConstMacro(InitialSimplexDelta, ParametersType);
131 
136  itkSetMacro(ParametersConvergenceTolerance, double);
137  itkGetConstMacro(ParametersConvergenceTolerance, double);
139 
144  itkSetMacro(FunctionConvergenceTolerance, double);
145  itkGetConstMacro(FunctionConvergenceTolerance, double);
147 
149  const std::string GetStopConditionDescription() const override;
150 
152  MeasureType GetValue() const;
153 
155  vnl_amoeba * GetOptimizer() const;
156 
157 protected:
158  AmoebaOptimizer();
159  ~AmoebaOptimizer() override;
160  void PrintSelf(std::ostream & os, Indent indent) const override;
161 
162  using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
163 
164 private:
166  void ValidateSettings();
167 
169  ParametersType::ValueType m_ParametersConvergenceTolerance;
170  CostFunctionType::MeasureType m_FunctionConvergenceTolerance;
174  vnl_amoeba * m_VnlOptimizer;
175 
176  std::ostringstream m_StopConditionDescription;
177 };
178 } // end namespace itk
179 
180 #endif
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
CostFunctionType::MeasureType m_FunctionConvergenceTolerance
NumberOfIterationsType m_MaximumNumberOfIterations
This class is a base for the Optimization methods that optimize a single valued function.
vnl_vector< double > InternalParametersType
Wrap of the vnl_amoeba algorithm.
unsigned int NumberOfIterationsType
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
Superclass::ParametersType ParametersType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ParametersType::ValueType m_ParametersConvergenceTolerance
std::ostringstream m_StopConditionDescription
ParametersType m_InitialSimplexDelta