ITK  5.2.0
Insight Toolkit
itkOnePlusOneEvolutionaryOptimizerv4.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 itkOnePlusOneEvolutionaryOptimizerv4_h
19 #define itkOnePlusOneEvolutionaryOptimizerv4_h
20 
23 #include <string>
24 
25 namespace itk
26 {
69 template <typename TInternalComputationValueType>
70 class ITK_TEMPLATE_EXPORT OnePlusOneEvolutionaryOptimizerv4
71  : public ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType>
72 {
73 public:
79 
81  itkNewMacro(Self);
82 
85 
89 
92 
95 
97  using ParametersType = typename Superclass::ParametersType;
98 
100  using ScalesType = typename Superclass::ScalesType;
101 
103  itkSetMacro(MaximumIteration, unsigned int);
104  itkGetConstReferenceMacro(MaximumIteration, unsigned int);
106 
108  itkSetMacro(GrowthFactor, double);
109  itkGetConstReferenceMacro(GrowthFactor, double);
111 
113  itkSetMacro(ShrinkFactor, double);
114  itkGetConstReferenceMacro(ShrinkFactor, double);
116 
118  itkSetMacro(InitialRadius, double);
119  itkGetConstReferenceMacro(InitialRadius, double);
121 
124  itkSetMacro(Epsilon, double);
125  itkGetConstReferenceMacro(Epsilon, double);
127 
129  itkGetConstReferenceMacro(FrobeniusNorm, double);
130 
131  void
132  SetNormalVariateGenerator(NormalVariateGeneratorType * generator);
133 
140  void
141  Initialize(double initialRadius, double grow = -1, double shrink = -1);
142 
144  itkGetConstReferenceMacro(CurrentCost, MeasureType);
145  const MeasureType &
146  GetValue() const override;
148 
150  itkGetConstReferenceMacro(Initialized, bool);
151 
155  void
156  StartOptimization(bool doOnlyInitialization = false) override;
157 
161  void
163  {
164  m_Stop = true;
165  }
166 
167  itkGetConstReferenceMacro(CatchGetValueException, bool);
168  itkSetMacro(CatchGetValueException, bool);
169 
170  itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
171  itkSetMacro(MetricWorstPossibleValue, double);
172 
173  const std::string
174  GetStopConditionDescription() const override;
175 
176 protected:
179  ~OnePlusOneEvolutionaryOptimizerv4() override = default;
180  void
181  PrintSelf(std::ostream & os, Indent indent) const override;
182 
183 private:
186 
188  unsigned int m_MaximumIteration;
189 
192 
195  double m_Epsilon;
196 
199 
202 
205 
208 
211 
216  bool m_Stop;
217 
219  std::ostringstream m_StopConditionDescription;
220 
224 }; // end of class
225 } // end of namespace itk
226 
227 #ifndef ITK_MANUAL_INSTANTIATION
228 # include "itkOnePlusOneEvolutionaryOptimizerv4.hxx"
229 #endif
230 
231 #endif
itk::OnePlusOneEvolutionaryOptimizerv4::m_FrobeniusNorm
double m_FrobeniusNorm
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:223
itk::OptimizerParameters< TInternalComputationValueType >
itk::OnePlusOneEvolutionaryOptimizerv4::m_MaximumIteration
unsigned int m_MaximumIteration
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:188
itk::OnePlusOneEvolutionaryOptimizerv4::m_Stop
bool m_Stop
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:216
itk::OnePlusOneEvolutionaryOptimizerv4::m_ShrinkFactor
double m_ShrinkFactor
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:204
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::OnePlusOneEvolutionaryOptimizerv4::m_CurrentCost
MeasureType m_CurrentCost
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:210
itk::Statistics::RandomVariateGeneratorBase
Defines common interfaces for random variate generators.
Definition: itkRandomVariateGeneratorBase.h:33
itk::OnePlusOneEvolutionaryOptimizerv4::m_MetricWorstPossibleValue
double m_MetricWorstPossibleValue
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:191
itk::OnePlusOneEvolutionaryOptimizerv4::m_InitialRadius
double m_InitialRadius
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:198
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkRandomVariateGeneratorBase.h
itk::OnePlusOneEvolutionaryOptimizerv4::m_Epsilon
double m_Epsilon
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:195
itk::OnePlusOneEvolutionaryOptimizerv4::m_CatchGetValueException
bool m_CatchGetValueException
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:190
itk::SingleValuedCostFunctionv4Template
This class is a base for a CostFunction that returns a single value.
Definition: itkSingleValuedCostFunctionv4.h:50
itk::SingleValuedCostFunctionv4
SingleValuedCostFunctionv4Template< double > SingleValuedCostFunctionv4
Definition: itkSingleValuedCostFunctionv4.h:93
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkObjectToObjectOptimizerBase.h
itk::OnePlusOneEvolutionaryOptimizerv4::m_RandomGenerator
NormalVariateGeneratorType::Pointer m_RandomGenerator
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:185
itk::OnePlusOneEvolutionaryOptimizerv4::m_StopConditionDescription
std::ostringstream m_StopConditionDescription
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:219
itk::ObjectToObjectOptimizerBaseTemplate
Abstract base for object-to-object optimizers.
Definition: itkObjectToObjectOptimizerBase.h:113
itk::OnePlusOneEvolutionaryOptimizerv4::m_GrowthFactor
double m_GrowthFactor
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:201
itk::OnePlusOneEvolutionaryOptimizerv4::StopOptimization
void StopOptimization()
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:162
itk::OnePlusOneEvolutionaryOptimizerv4::m_Initialized
bool m_Initialized
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:207
itk::ObjectToObjectOptimizerBaseTemplate::MeasureType
typename MetricType::MeasureType MeasureType
Definition: itkObjectToObjectOptimizerBase.h:145
itk::OnePlusOneEvolutionaryOptimizerv4
1+1 evolutionary strategy optimizer
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:70