ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkOnePlusOneEvolutionaryOptimizer.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 itkOnePlusOneEvolutionaryOptimizer_h
19 #define itkOnePlusOneEvolutionaryOptimizer_h
20 
23 #include "ITKOptimizersExport.h"
24 #include <string>
25 
26 namespace itk
27 {
71 class ITKOptimizers_EXPORT OnePlusOneEvolutionaryOptimizer:
73 {
74 public:
80 
82  itkNewMacro(Self);
83 
86 
90 
93 
95  itkSetMacro(Maximize, bool);
96  itkBooleanMacro(Maximize);
97  itkGetConstReferenceMacro(Maximize, bool);
99 
100  bool GetMinimize() const
101  { return !m_Maximize; }
102  void SetMinimize(bool v)
103  { this->SetMaximize(!v); }
104  void MinimizeOn()
105  { SetMaximize(false); }
106  void MinimizeOff()
107  { SetMaximize(true); }
108 
110  itkSetMacro(MaximumIteration, unsigned int);
111  itkGetConstReferenceMacro(MaximumIteration, unsigned int);
113 
115  itkSetMacro(GrowthFactor, double);
116  itkGetConstReferenceMacro(GrowthFactor, double);
118 
120  itkSetMacro(ShrinkFactor, double);
121  itkGetConstReferenceMacro(ShrinkFactor, double);
123 
125  itkSetMacro(InitialRadius, double);
126  itkGetConstReferenceMacro(InitialRadius, double);
128 
131  itkSetMacro(Epsilon, double);
132  itkGetConstReferenceMacro(Epsilon, double);
134 
136  itkGetConstReferenceMacro(FrobeniusNorm, double);
137 
138  void SetNormalVariateGenerator(NormalVariateGeneratorType *generator);
139 
146  void Initialize(double initialRadius, double grow = -1, double shrink = -1);
147 
149  itkGetConstReferenceMacro(CurrentCost, MeasureType);
150  MeasureType GetValue() const { return this->GetCurrentCost(); }
152 
154  itkGetConstReferenceMacro(CurrentIteration, unsigned int);
155 
157  itkGetConstReferenceMacro(Initialized, bool);
158 
162  void StartOptimization() override;
163 
168  { m_Stop = true; }
169 
170  itkGetConstReferenceMacro(CatchGetValueException, bool);
171  itkSetMacro(CatchGetValueException, bool);
172 
173  itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
174  itkSetMacro(MetricWorstPossibleValue, double);
175 
176  const std::string GetStopConditionDescription() const override;
177 
178 protected:
181  ~OnePlusOneEvolutionaryOptimizer() override = default;
182  void PrintSelf(std::ostream & os, Indent indent) const override;
183 
184 private:
185 
188 
190  unsigned int m_MaximumIteration;
191 
193  unsigned int m_CurrentIteration;
194 
197 
200 
203  double m_Epsilon;
204 
207 
210 
213 
216 
218  MeasureType m_CurrentCost;
219 
224  bool m_Stop;
225 
227  std::ostringstream m_StopConditionDescription;
228 
232 }; // end of class
233 } // end of namespace itk
234 
235 #endif
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
This class is a base for the Optimization methods that optimize a single valued function.
Defines common interfaces for random variate generators.
NormalVariateGeneratorType::Pointer m_RandomGenerator
Control indentation during Print() invocation.
Definition: itkIndent.h:49