ITK  5.4.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  * 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 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 
84  itkOverrideGetNameOfClassMacro(OnePlusOneEvolutionaryOptimizerv4);
85 
89 
92 
94  using typename Superclass::MeasureType;
95 
97  using typename Superclass::ParametersType;
98 
100  using typename Superclass::ScalesType;
101 
103  itkSetMacro(MaximumIteration, unsigned int);
104  itkGetConstReferenceMacro(MaximumIteration, unsigned int);
108  itkSetMacro(GrowthFactor, double);
109  itkGetConstReferenceMacro(GrowthFactor, double);
113  itkSetMacro(ShrinkFactor, double);
114  itkGetConstReferenceMacro(ShrinkFactor, double);
118  itkSetMacro(InitialRadius, double);
119  itkGetConstReferenceMacro(InitialRadius, double);
124  itkSetMacro(Epsilon, double);
125  itkGetConstReferenceMacro(Epsilon, double);
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;
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  itkBooleanMacro(CatchGetValueException);
170 
171  itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
172  itkSetMacro(MetricWorstPossibleValue, double);
173 
174  const std::string
175  GetStopConditionDescription() const override;
176 
177 protected:
180  ~OnePlusOneEvolutionaryOptimizerv4() override = default;
181  void
182  PrintSelf(std::ostream & os, Indent indent) const override;
183 
184 private:
187 
189  unsigned int m_MaximumIteration{};
190 
191  bool m_CatchGetValueException{};
192  double m_MetricWorstPossibleValue{};
193 
196  double m_Epsilon{};
197 
199  double m_InitialRadius{};
200 
202  double m_GrowthFactor{};
203 
205  double m_ShrinkFactor{};
206 
208  bool m_Initialized{};
209 
211  MeasureType m_CurrentCost{};
212 
217  bool m_Stop{};
218 
220  std::ostringstream m_StopConditionDescription{};
221 
224  double m_FrobeniusNorm{};
225 }; // end of class
226 } // end of namespace itk
227 
228 #ifndef ITK_MANUAL_INSTANTIATION
229 # include "itkOnePlusOneEvolutionaryOptimizerv4.hxx"
230 #endif
231 
232 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
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::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkRandomVariateGeneratorBase.h
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:94
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkObjectToObjectOptimizerBase.h
itk::ObjectToObjectOptimizerBaseTemplate
Abstract base for object-to-object optimizers.
Definition: itkObjectToObjectOptimizerBase.h:113
itk::OnePlusOneEvolutionaryOptimizerv4::StopOptimization
void StopOptimization()
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:162
itk::ObjectToObjectOptimizerBaseTemplate::MeasureType
typename MetricType::MeasureType MeasureType
Definition: itkObjectToObjectOptimizerBase.h:145
itk::OnePlusOneEvolutionaryOptimizerv4
1+1 evolutionary strategy optimizer
Definition: itkOnePlusOneEvolutionaryOptimizerv4.h:70