ITK  4.9.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(void)
105  { SetMaximize(false); }
106  void MinimizeOff(void)
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  virtual void StartOptimization() ITK_OVERRIDE;
163 
167  void StopOptimization()
168  { m_Stop = true; }
169 
170  itkGetConstReferenceMacro(CatchGetValueException, bool);
171  itkSetMacro(CatchGetValueException, bool);
172 
173  itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
174  itkSetMacro(MetricWorstPossibleValue, double);
175 
176  virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE;
177 
178 protected:
180  OnePlusOneEvolutionaryOptimizer(const OnePlusOneEvolutionaryOptimizer &);
181  virtual ~OnePlusOneEvolutionaryOptimizer();
182  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
183 
184 private:
185 
188 
190  unsigned int m_MaximumIteration;
191 
193  unsigned int m_CurrentIteration;
194 
195  bool m_CatchGetValueException;
196  double m_MetricWorstPossibleValue;
197 
199  bool m_Maximize;
200 
203  double m_Epsilon;
204 
206  double m_InitialRadius;
207 
209  double m_GrowthFactor;
210 
212  double m_ShrinkFactor;
213 
215  bool m_Initialized;
216 
218  MeasureType m_CurrentCost;
219 
224  bool m_Stop;
225 
227  std::ostringstream m_StopConditionDescription;
228 
231  double m_FrobeniusNorm;
232 }; // end of class
233 } // end of namespace itk
234 
235 #endif
Statistics::RandomVariateGeneratorBase NormalVariateGeneratorType
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.
Control indentation during Print() invocation.
Definition: itkIndent.h:49