go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkCMAEvolutionStrategyOptimizer.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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
19#ifndef itkCMAEvolutionStrategyOptimizer_h
20#define itkCMAEvolutionStrategyOptimizer_h
21
23#include <vector>
24#include <utility>
25#include <deque>
26
27#include "itkArray.h"
28#include "itkArray2D.h"
29#include "itkMersenneTwisterRandomVariateGenerator.h"
30#include <vnl/vnl_diag_matrix.h>
31
32namespace itk
33{
50{
51public:
53
56 using Pointer = SmartPointer<Self>;
57 using ConstPointer = SmartPointer<const Self>;
58
59 itkNewMacro(Self);
61
62 using Superclass::ParametersType;
63 using Superclass::DerivativeType;
64 using Superclass::CostFunctionType;
66 using Superclass::MeasureType;
68
70 {
78 };
79
80 void
82
83 virtual void
85
86 virtual void
88
90 itkGetConstMacro(CurrentIteration, unsigned long);
91
93 itkGetConstMacro(CurrentValue, MeasureType);
94
96 itkGetConstReferenceMacro(StopCondition, StopConditionType);
97
99 itkGetConstMacro(CurrentSigma, double);
100
102 itkGetConstMacro(CurrentMinimumD, double);
103
105 itkGetConstMacro(CurrentMaximumD, double);
106
109 virtual double
111 {
112 return this->GetCurrentSigma() * this->GetCurrentMaximumD();
113 }
114
120 itkGetConstReferenceMacro(CurrentScaledStep, ParametersType);
121
123 itkGetConstMacro(MaximumNumberOfIterations, unsigned long);
124 itkSetClampMacro(MaximumNumberOfIterations, unsigned long, 1, NumericTraits<unsigned long>::max());
125
130 itkSetMacro(PopulationSize, unsigned int);
131 itkGetConstMacro(PopulationSize, unsigned int);
132
137 itkSetMacro(NumberOfParents, unsigned int);
138 itkGetConstMacro(NumberOfParents, unsigned int);
139
143 itkSetClampMacro(InitialSigma, double, NumericTraits<double>::min(), NumericTraits<double>::max());
144 itkGetConstMacro(InitialSigma, double);
145
149 itkSetClampMacro(MaximumDeviation, double, 0.0, NumericTraits<double>::max());
150 itkGetConstMacro(MaximumDeviation, double);
151
155 itkSetClampMacro(MinimumDeviation, double, 0.0, NumericTraits<double>::max());
156 itkGetConstMacro(MinimumDeviation, double);
157
167 itkSetMacro(UseDecayingSigma, bool);
168 itkGetConstMacro(UseDecayingSigma, bool);
169
172 itkSetClampMacro(SigmaDecayA, double, 0.0, NumericTraits<double>::max());
173 itkGetConstMacro(SigmaDecayA, double);
174
177 itkSetClampMacro(SigmaDecayAlpha, double, 0.0, 1.0);
178 itkGetConstMacro(SigmaDecayAlpha, double);
179
185 itkSetMacro(UseCovarianceMatrixAdaptation, bool);
186 itkGetConstMacro(UseCovarianceMatrixAdaptation, bool);
187
194 itkSetStringMacro(RecombinationWeightsPreset);
195 itkGetStringMacro(RecombinationWeightsPreset);
196
200 itkSetMacro(UpdateBDPeriod, unsigned int);
201 itkGetConstMacro(UpdateBDPeriod, unsigned int);
202
208 itkSetMacro(PositionToleranceMin, double);
209 itkGetConstMacro(PositionToleranceMin, double);
210
215 itkSetMacro(PositionToleranceMax, double);
216 itkGetConstMacro(PositionToleranceMax, double);
217
224 itkSetMacro(ValueTolerance, double);
225 itkGetConstMacro(ValueTolerance, double);
226
227protected:
228 using RecombinationWeightsType = Array<double>;
229 using EigenValueMatrixType = vnl_diag_matrix<double>;
230 using CovarianceMatrixType = Array2D<double>;
231 using ParameterContainerType = std::vector<ParametersType>;
232 using MeasureHistoryType = std::deque<MeasureType>;
233
234 using MeasureIndexPairType = std::pair<MeasureType, unsigned int>;
235 using MeasureContainerType = std::vector<MeasureIndexPairType>;
236
237 using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator;
238
240 RandomGeneratorType::Pointer m_RandomGenerator{ RandomGeneratorType::GetInstance() };
241
243 MeasureType m_CurrentValue{ 0.0 };
244
246 unsigned long m_CurrentIteration{ 0 };
247
250
252 bool m_Stop{ false };
253
256 unsigned int m_PopulationSize{ 0 };
257 unsigned int m_NumberOfParents{ 0 };
258 unsigned int m_UpdateBDPeriod{ 1 };
259
264 double m_EffectiveMu{ 0.0 };
280 unsigned long m_HistoryLength{ 0 };
281
283 double m_CurrentSigma{ 0.0 };
284
286 double m_CurrentMinimumD{ 1.0 };
288 double m_CurrentMaximumD{ 1.0 };
289
291 bool m_Heaviside{ false };
292
300 ParametersType m_CurrentScaledStep;
304 ParametersType m_EvolutionPath;
307
310
317
320
322 ~CMAEvolutionStrategyOptimizer() override = default;
323
325 void
326 PrintSelf(std::ostream & os, Indent indent) const override;
327
342 virtual void
344
357 virtual void
359
361 virtual void
363
366 virtual void
368
370 virtual void
372
374 virtual void
376
378 virtual void
380
382 virtual void
384
386 virtual void
388
390 virtual void
392
394 virtual void
396
398 virtual void
400
410 virtual void
412
423 virtual bool
424 TestConvergence(bool firstCheck);
425
426private:
428 unsigned long m_MaximumNumberOfIterations{ 100 };
429 bool m_UseDecayingSigma{ false };
430 double m_InitialSigma{ 1.0 };
431 double m_SigmaDecayA{ 50 };
432 double m_SigmaDecayAlpha{ 0.602 };
433 std::string m_RecombinationWeightsPreset{ "superlinear" };
434 double m_MaximumDeviation{ std::numeric_limits<double>::max() };
435 double m_MinimumDeviation{ 0.0 };
437 double m_PositionToleranceMin{ 1e-12 };
438 double m_ValueTolerance{ 1e-12 };
439};
440
441} // end namespace itk
442
443#endif //#ifndef itkCMAEvolutionStrategyOptimizer_h
A Covariance Matrix Adaptation Evolution Strategy Optimizer.
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
~CMAEvolutionStrategyOptimizer() override=default
ITK_DISALLOW_COPY_AND_MOVE(CMAEvolutionStrategyOptimizer)
std::pair< MeasureType, unsigned int > MeasureIndexPairType
virtual double GetCurrentMaximumD() const
std::vector< ParametersType > ParameterContainerType
virtual void InitializeProgressVariables()
virtual double GetCurrentSigma() const
std::vector< MeasureIndexPairType > MeasureContainerType
virtual bool TestConvergence(bool firstCheck)
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void UpdateConjugateEvolutionPath()
A cost function that applies a scaling to another cost function.


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo