ITK  6.0.0
Insight Toolkit
itkOnePlusOneEvolutionaryOptimizer.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 itkOnePlusOneEvolutionaryOptimizer_h
19 #define itkOnePlusOneEvolutionaryOptimizer_h
20 
23 #include "ITKOptimizersExport.h"
24 #include <string>
25 
26 namespace itk
27 {
72 {
73 public:
79 
81  itkNewMacro(Self);
82 
84  itkOverrideGetNameOfClassMacro(OnePlusOneEvolutionaryOptimizer);
85 
89 
92 
94  itkSetMacro(Maximize, bool);
95  itkBooleanMacro(Maximize);
96  itkGetConstReferenceMacro(Maximize, bool);
99  bool
100  GetMinimize() const
101  {
102  return !m_Maximize;
103  }
104  void
105  SetMinimize(bool v)
106  {
107  this->SetMaximize(!v);
108  }
109  void
111  {
112  SetMaximize(false);
113  }
114  void
116  {
117  SetMaximize(true);
118  }
119 
121  itkSetMacro(MaximumIteration, unsigned int);
122  itkGetConstReferenceMacro(MaximumIteration, unsigned int);
126  itkSetMacro(GrowthFactor, double);
127  itkGetConstReferenceMacro(GrowthFactor, double);
131  itkSetMacro(ShrinkFactor, double);
132  itkGetConstReferenceMacro(ShrinkFactor, double);
136  itkSetMacro(InitialRadius, double);
137  itkGetConstReferenceMacro(InitialRadius, double);
142  itkSetMacro(Epsilon, double);
143  itkGetConstReferenceMacro(Epsilon, double);
147  itkGetConstReferenceMacro(FrobeniusNorm, double);
148 
149  void
150  SetNormalVariateGenerator(NormalVariateGeneratorType * generator);
151 
158  void
159  Initialize(double initialRadius, double grow = -1, double shrink = -1);
160 
162  itkGetConstReferenceMacro(CurrentCost, MeasureType);
163  MeasureType
164  GetValue() const
165  {
166  return this->GetCurrentCost();
167  }
171  itkGetConstReferenceMacro(CurrentIteration, unsigned int);
172 
174  itkGetConstReferenceMacro(Initialized, bool);
175 
179  void
180  StartOptimization() override;
181 
185  void
187  {
188  m_Stop = true;
189  }
190 
191  itkGetConstReferenceMacro(CatchGetValueException, bool);
192  itkSetMacro(CatchGetValueException, bool);
193 
194  itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
195  itkSetMacro(MetricWorstPossibleValue, double);
196 
197  std::string
198  GetStopConditionDescription() const override;
199 
200 protected:
203  ~OnePlusOneEvolutionaryOptimizer() override = default;
204  void
205  PrintSelf(std::ostream & os, Indent indent) const override;
206 
207 private:
210 
212  unsigned int m_MaximumIteration{};
213 
215  unsigned int m_CurrentIteration{};
216 
217  bool m_CatchGetValueException{};
218  double m_MetricWorstPossibleValue{};
219 
221  bool m_Maximize{};
222 
225  double m_Epsilon{};
226 
228  double m_InitialRadius{};
229 
231  double m_GrowthFactor{};
232 
234  double m_ShrinkFactor{};
235 
237  bool m_Initialized{};
238 
240  MeasureType m_CurrentCost{};
241 
246  bool m_Stop{};
247 
249  std::ostringstream m_StopConditionDescription{};
250 
253  double m_FrobeniusNorm{};
254 }; // end of class
255 } // end of namespace itk
256 
257 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::SingleValuedNonLinearOptimizer
This class is a base for the Optimization methods that optimize a single valued function.
Definition: itkSingleValuedNonLinearOptimizer.h:35
itk::OnePlusOneEvolutionaryOptimizer::MinimizeOn
void MinimizeOn()
Definition: itkOnePlusOneEvolutionaryOptimizer.h:110
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Statistics::RandomVariateGeneratorBase
Defines common interfaces for random variate generators.
Definition: itkRandomVariateGeneratorBase.h:33
itk::OnePlusOneEvolutionaryOptimizer::SetMinimize
void SetMinimize(bool v)
Definition: itkOnePlusOneEvolutionaryOptimizer.h:105
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::OnePlusOneEvolutionaryOptimizer::MinimizeOff
void MinimizeOff()
Definition: itkOnePlusOneEvolutionaryOptimizer.h:115
itk::SingleValuedCostFunction
This class is a base for the CostFunctions returning a single value.
Definition: itkSingleValuedCostFunction.h:34
itkRandomVariateGeneratorBase.h
itk::OnePlusOneEvolutionaryOptimizer::StopOptimization
void StopOptimization()
Definition: itkOnePlusOneEvolutionaryOptimizer.h:186
itk::OnePlusOneEvolutionaryOptimizer::GetMinimize
bool GetMinimize() const
Definition: itkOnePlusOneEvolutionaryOptimizer.h:100
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::OnePlusOneEvolutionaryOptimizer
1+1 evolutionary strategy optimizer
Definition: itkOnePlusOneEvolutionaryOptimizer.h:71
itk::OnePlusOneEvolutionaryOptimizer::GetValue
MeasureType GetValue() const
Definition: itkOnePlusOneEvolutionaryOptimizer.h:164
itkSingleValuedNonLinearOptimizer.h