ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkOnePlusOneEvolutionaryOptimizerv4.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 itkOnePlusOneEvolutionaryOptimizerv4_h
19 #define itkOnePlusOneEvolutionaryOptimizerv4_h
20 
23 #include <string>
24 
25 namespace itk
26 {
68 template<typename TInternalComputationValueType>
69 class ITK_TEMPLATE_EXPORT OnePlusOneEvolutionaryOptimizerv4:
70  public ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType>
71 {
72 public:
78 
80  itkNewMacro(Self);
81 
84 
88 
91 
94 
96  using ParametersType = typename Superclass::ParametersType;
97 
99  using ScalesType = typename Superclass::ScalesType;
100 
102  itkSetMacro(MaximumIteration, unsigned int);
103  itkGetConstReferenceMacro(MaximumIteration, unsigned int);
105 
107  itkSetMacro(GrowthFactor, double);
108  itkGetConstReferenceMacro(GrowthFactor, double);
110 
112  itkSetMacro(ShrinkFactor, double);
113  itkGetConstReferenceMacro(ShrinkFactor, double);
115 
117  itkSetMacro(InitialRadius, double);
118  itkGetConstReferenceMacro(InitialRadius, double);
120 
123  itkSetMacro(Epsilon, double);
124  itkGetConstReferenceMacro(Epsilon, double);
126 
128  itkGetConstReferenceMacro(FrobeniusNorm, double);
129 
130  void SetNormalVariateGenerator(NormalVariateGeneratorType *generator);
131 
138  void Initialize(double initialRadius, double grow = -1, double shrink = -1);
139 
141  itkGetConstReferenceMacro(CurrentCost, MeasureType);
142  const MeasureType & GetValue() const override;
144 
146  itkGetConstReferenceMacro(Initialized, bool);
147 
151  void StartOptimization(bool doOnlyInitialization = false) override;
152 
157  { m_Stop = true; }
158 
159  itkGetConstReferenceMacro(CatchGetValueException, bool);
160  itkSetMacro(CatchGetValueException, bool);
161 
162  itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
163  itkSetMacro(MetricWorstPossibleValue, double);
164 
165  const std::string GetStopConditionDescription() const override;
166 
167 protected:
170  ~OnePlusOneEvolutionaryOptimizerv4() override = default;
171  void PrintSelf(std::ostream & os, Indent indent) const override;
172 
173 private:
174 
177 
179  unsigned int m_MaximumIteration;
180 
183 
186  double m_Epsilon;
187 
190 
193 
196 
199 
202 
207  bool m_Stop;
208 
210  std::ostringstream m_StopConditionDescription;
211 
215 }; // end of class
216 } // end of namespace itk
217 
218 #ifndef ITK_MANUAL_INSTANTIATION
219 #include "itkOnePlusOneEvolutionaryOptimizerv4.hxx"
220 #endif
221 
222 #endif
Light weight base class for most itk classes.
SingleValuedCostFunctionv4Template< double > SingleValuedCostFunctionv4
Defines common interfaces for random variate generators.
This class is a base for a CostFunction that returns a single value.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Abstract base for object-to-object optimizers.