ITK  5.2.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  * 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 {
72 {
73 public:
79 
81  itkNewMacro(Self);
82 
85 
89 
92 
94  itkSetMacro(Maximize, bool);
95  itkBooleanMacro(Maximize);
96  itkGetConstReferenceMacro(Maximize, bool);
98 
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);
124 
126  itkSetMacro(GrowthFactor, double);
127  itkGetConstReferenceMacro(GrowthFactor, double);
129 
131  itkSetMacro(ShrinkFactor, double);
132  itkGetConstReferenceMacro(ShrinkFactor, double);
134 
136  itkSetMacro(InitialRadius, double);
137  itkGetConstReferenceMacro(InitialRadius, double);
139 
142  itkSetMacro(Epsilon, double);
143  itkGetConstReferenceMacro(Epsilon, double);
145 
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  }
169 
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  const 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 
219 
222 
225  double m_Epsilon;
226 
229 
232 
235 
238 
240  MeasureType m_CurrentCost;
241 
246  bool m_Stop;
247 
249  std::ostringstream m_StopConditionDescription;
250 
254 }; // end of class
255 } // end of namespace itk
256 
257 #endif
itk::OnePlusOneEvolutionaryOptimizer::m_FrobeniusNorm
double m_FrobeniusNorm
Definition: itkOnePlusOneEvolutionaryOptimizer.h:253
itk::OnePlusOneEvolutionaryOptimizer::m_Initialized
bool m_Initialized
Definition: itkOnePlusOneEvolutionaryOptimizer.h:237
itk::SingleValuedNonLinearOptimizer
This class is a base for the Optimization methods that optimize a single valued function.
Definition: itkSingleValuedNonLinearOptimizer.h:35
itk::OnePlusOneEvolutionaryOptimizer::m_ShrinkFactor
double m_ShrinkFactor
Definition: itkOnePlusOneEvolutionaryOptimizer.h:234
itk::OnePlusOneEvolutionaryOptimizer::m_Maximize
bool m_Maximize
Definition: itkOnePlusOneEvolutionaryOptimizer.h:221
itk::OnePlusOneEvolutionaryOptimizer::m_CurrentCost
MeasureType m_CurrentCost
Definition: itkOnePlusOneEvolutionaryOptimizer.h:240
itk::OnePlusOneEvolutionaryOptimizer::MinimizeOn
void MinimizeOn()
Definition: itkOnePlusOneEvolutionaryOptimizer.h:110
itk::OnePlusOneEvolutionaryOptimizer::m_GrowthFactor
double m_GrowthFactor
Definition: itkOnePlusOneEvolutionaryOptimizer.h:231
itk::OnePlusOneEvolutionaryOptimizer::m_MaximumIteration
unsigned int m_MaximumIteration
Definition: itkOnePlusOneEvolutionaryOptimizer.h:212
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::m_Epsilon
double m_Epsilon
Definition: itkOnePlusOneEvolutionaryOptimizer.h:225
itk::OnePlusOneEvolutionaryOptimizer::SetMinimize
void SetMinimize(bool v)
Definition: itkOnePlusOneEvolutionaryOptimizer.h:105
itk::OnePlusOneEvolutionaryOptimizer::m_RandomGenerator
NormalVariateGeneratorType::Pointer m_RandomGenerator
Definition: itkOnePlusOneEvolutionaryOptimizer.h:209
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
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::m_InitialRadius
double m_InitialRadius
Definition: itkOnePlusOneEvolutionaryOptimizer.h:228
itk::OnePlusOneEvolutionaryOptimizer::GetMinimize
bool GetMinimize() const
Definition: itkOnePlusOneEvolutionaryOptimizer.h:100
itk::OnePlusOneEvolutionaryOptimizer::m_MetricWorstPossibleValue
double m_MetricWorstPossibleValue
Definition: itkOnePlusOneEvolutionaryOptimizer.h:218
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::OnePlusOneEvolutionaryOptimizer::m_Stop
bool m_Stop
Definition: itkOnePlusOneEvolutionaryOptimizer.h:246
itk::OnePlusOneEvolutionaryOptimizer::m_CurrentIteration
unsigned int m_CurrentIteration
Definition: itkOnePlusOneEvolutionaryOptimizer.h:215
itk::OnePlusOneEvolutionaryOptimizer::m_CatchGetValueException
bool m_CatchGetValueException
Definition: itkOnePlusOneEvolutionaryOptimizer.h:217
itk::OnePlusOneEvolutionaryOptimizer
1+1 evolutionary strategy optimizer
Definition: itkOnePlusOneEvolutionaryOptimizer.h:71
itk::OnePlusOneEvolutionaryOptimizer::GetValue
MeasureType GetValue() const
Definition: itkOnePlusOneEvolutionaryOptimizer.h:164
itkSingleValuedNonLinearOptimizer.h
itk::OnePlusOneEvolutionaryOptimizer::m_StopConditionDescription
std::ostringstream m_StopConditionDescription
Definition: itkOnePlusOneEvolutionaryOptimizer.h:249