ITK  6.0.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 * https://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#include <memory> // For unique_ptr.
25
26namespace itk
27{
67class ITKOptimizers_EXPORT AmoebaOptimizer : public SingleValuedNonLinearVnlOptimizer
68{
69public:
70 ITK_DISALLOW_COPY_AND_MOVE(AmoebaOptimizer);
71
77 using NumberOfIterationsType = unsigned int;
78
80 itkNewMacro(Self);
81
83 itkOverrideGetNameOfClassMacro(AmoebaOptimizer);
84
87 using ParametersType = Superclass::ParametersType;
88
90 using InternalParametersType = vnl_vector<double>;
91
93 void
95
97 void
98 SetCostFunction(SingleValuedCostFunction * costFunction) override;
99
103 itkSetMacro(MaximumNumberOfIterations, NumberOfIterationsType);
104 itkGetConstMacro(MaximumNumberOfIterations, NumberOfIterationsType);
115 itkSetMacro(AutomaticInitialSimplex, bool);
116 itkBooleanMacro(AutomaticInitialSimplex);
117 itkGetConstMacro(AutomaticInitialSimplex, bool);
126 itkSetMacro(OptimizeWithRestarts, bool);
127 itkBooleanMacro(OptimizeWithRestarts);
128 itkGetConstMacro(OptimizeWithRestarts, bool);
133 void
134 SetInitialSimplexDelta(ParametersType initialSimplexDelta, bool automaticInitialSimplex = false);
135 itkGetConstMacro(InitialSimplexDelta, ParametersType);
142 itkSetMacro(ParametersConvergenceTolerance, double);
143 itkGetConstMacro(ParametersConvergenceTolerance, double);
150 itkSetMacro(FunctionConvergenceTolerance, double);
151 itkGetConstMacro(FunctionConvergenceTolerance, double);
155 std::string
157
160 GetValue() const;
161
163 vnl_amoeba *
165
166protected:
169 void
170 PrintSelf(std::ostream & os, Indent indent) const override;
171
172 using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
173
174private:
176 void
178
179 NumberOfIterationsType m_MaximumNumberOfIterations{};
180 ParametersType::ValueType m_ParametersConvergenceTolerance{};
181 CostFunctionType::MeasureType m_FunctionConvergenceTolerance{};
182 bool m_AutomaticInitialSimplex{};
183 ParametersType m_InitialSimplexDelta{};
184 bool m_OptimizeWithRestarts{};
185 std::unique_ptr<vnl_amoeba> m_VnlOptimizer;
186
187 std::ostringstream m_StopConditionDescription{};
188};
189} // end namespace itk
190
191#endif
Wrap of the vnl_amoeba algorithm.
MeasureType GetValue() const
std::string GetStopConditionDescription() const override
std::unique_ptr< vnl_amoeba > m_VnlOptimizer
void SetInitialSimplexDelta(ParametersType initialSimplexDelta, bool automaticInitialSimplex=false)
void SetCostFunction(SingleValuedCostFunction *costFunction) override
void PrintSelf(std::ostream &os, Indent indent) const override
unsigned int NumberOfIterationsType
void StartOptimization() override
vnl_amoeba * GetOptimizer() const
vnl_vector< double > InternalParametersType
Superclass::ParametersType ParametersType
~AmoebaOptimizer() override
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
This class is a base for the CostFunctions returning a single value.
This class is a base for the Optimization methods that optimize a single valued function.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....