go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
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 "elxDefaultConstruct.h"
31#include <vnl/vnl_diag_matrix.h>
32
33namespace itk
34{
49
51{
52public:
54
57 using Pointer = SmartPointer<Self>;
58 using ConstPointer = SmartPointer<const Self>;
59
60 itkNewMacro(Self);
62
63 using Superclass::ParametersType;
64 using Superclass::DerivativeType;
65 using Superclass::CostFunctionType;
67 using Superclass::MeasureType;
69
80
81 void
83
84 virtual void
86
87 virtual void
89
91 itkGetConstMacro(CurrentIteration, unsigned long);
92
94 itkGetConstMacro(CurrentValue, MeasureType);
95
97 itkGetConstReferenceMacro(StopCondition, StopConditionType);
98
100 itkGetConstMacro(CurrentSigma, double);
101
103 itkGetConstMacro(CurrentMinimumD, double);
104
106 itkGetConstMacro(CurrentMaximumD, double);
107
110 virtual double
112 {
113 return this->GetCurrentSigma() * this->GetCurrentMaximumD();
114 }
115
121 itkGetConstReferenceMacro(CurrentScaledStep, ParametersType);
122
124 itkGetConstMacro(MaximumNumberOfIterations, unsigned long);
125 itkSetClampMacro(MaximumNumberOfIterations, unsigned long, 1, NumericTraits<unsigned long>::max());
126
131 itkSetMacro(PopulationSize, unsigned int);
132 itkGetConstMacro(PopulationSize, unsigned int);
133
138 itkSetMacro(NumberOfParents, unsigned int);
139 itkGetConstMacro(NumberOfParents, unsigned int);
140
144 itkSetClampMacro(InitialSigma, double, NumericTraits<double>::min(), NumericTraits<double>::max());
145 itkGetConstMacro(InitialSigma, double);
146
150 itkSetClampMacro(MaximumDeviation, double, 0.0, NumericTraits<double>::max());
151 itkGetConstMacro(MaximumDeviation, double);
152
156 itkSetClampMacro(MinimumDeviation, double, 0.0, NumericTraits<double>::max());
157 itkGetConstMacro(MinimumDeviation, double);
158
168 itkSetMacro(UseDecayingSigma, bool);
169 itkGetConstMacro(UseDecayingSigma, bool);
170
173 itkSetClampMacro(SigmaDecayA, double, 0.0, NumericTraits<double>::max());
174 itkGetConstMacro(SigmaDecayA, double);
175
178 itkSetClampMacro(SigmaDecayAlpha, double, 0.0, 1.0);
179 itkGetConstMacro(SigmaDecayAlpha, double);
180
186 itkSetMacro(UseCovarianceMatrixAdaptation, bool);
187 itkGetConstMacro(UseCovarianceMatrixAdaptation, bool);
188
195 itkSetStringMacro(RecombinationWeightsPreset);
196 itkGetStringMacro(RecombinationWeightsPreset);
197
201 itkSetMacro(UpdateBDPeriod, unsigned int);
202 itkGetConstMacro(UpdateBDPeriod, unsigned int);
203
209 itkSetMacro(PositionToleranceMin, double);
210 itkGetConstMacro(PositionToleranceMin, double);
211
216 itkSetMacro(PositionToleranceMax, double);
217 itkGetConstMacro(PositionToleranceMax, double);
218
225 itkSetMacro(ValueTolerance, double);
226 itkGetConstMacro(ValueTolerance, double);
227
228 void
229 SetRandomVariateGenerator(Statistics::MersenneTwisterRandomVariateGenerator & randomVariateGenerator)
230 {
231 m_RandomVariateGenerator = &randomVariateGenerator;
232 }
233
234protected:
235 using RecombinationWeightsType = Array<double>;
236 using EigenValueMatrixType = vnl_diag_matrix<double>;
237 using CovarianceMatrixType = vnl_matrix<double>;
238 using ParameterContainerType = std::vector<ParametersType>;
239 using MeasureHistoryType = std::deque<MeasureType>;
240
241 using MeasureIndexPairType = std::pair<MeasureType, unsigned int>;
242 using MeasureContainerType = std::vector<MeasureIndexPairType>;
243
244 using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator;
245
247 MeasureType m_CurrentValue{ 0.0 };
248
250 unsigned long m_CurrentIteration{ 0 };
251
254
256 bool m_Stop{ false };
257
260 unsigned int m_PopulationSize{ 0 };
261 unsigned int m_NumberOfParents{ 0 };
262 unsigned int m_UpdateBDPeriod{ 1 };
263
266
268 double m_EffectiveMu{ 0.0 };
284 unsigned long m_HistoryLength{ 0 };
285
287 double m_CurrentSigma{ 0.0 };
288
290 double m_CurrentMinimumD{ 1.0 };
292 double m_CurrentMaximumD{ 1.0 };
293
295 bool m_Heaviside{ false };
296
304 ParametersType m_CurrentScaledStep{};
306 ParametersType m_CurrentNormalizedStep{};
308 ParametersType m_EvolutionPath{};
310 ParametersType m_ConjugateEvolutionPath{};
311
314
321
324
326 ~CMAEvolutionStrategyOptimizer() override = default;
327
329 void
330 PrintSelf(std::ostream & os, Indent indent) const override;
331
346 virtual void
348
361 virtual void
363
365 virtual void
367
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
402 virtual void
404
414 virtual void
416
427 virtual bool
428 TestConvergence(bool firstCheck);
429
430private:
432 unsigned long m_MaximumNumberOfIterations{ 100 };
433 bool m_UseDecayingSigma{ false };
434 double m_InitialSigma{ 1.0 };
435 double m_SigmaDecayA{ 50 };
436 double m_SigmaDecayAlpha{ 0.602 };
437 std::string m_RecombinationWeightsPreset{ "superlinear" };
438 double m_MaximumDeviation{ std::numeric_limits<double>::max() };
439 double m_MinimumDeviation{ 0.0 };
441 double m_PositionToleranceMin{ 1e-12 };
442 double m_ValueTolerance{ 1e-12 };
443
445 Statistics::MersenneTwisterRandomVariateGenerator * m_RandomVariateGenerator{ &m_DefaultRandomVariateGenerator };
446};
447
448} // end namespace itk
449
450#endif // #ifndef itkCMAEvolutionStrategyOptimizer_h
ScaledSingleValuedNonLinearOptimizer Superclass
Statistics::MersenneTwisterRandomVariateGenerator * m_RandomVariateGenerator
elx::DefaultConstruct< Statistics::MersenneTwisterRandomVariateGenerator > m_DefaultRandomVariateGenerator
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
~CMAEvolutionStrategyOptimizer() override=default
ITK_DISALLOW_COPY_AND_MOVE(CMAEvolutionStrategyOptimizer)
std::pair< MeasureType, unsigned int > MeasureIndexPairType
itkOverrideGetNameOfClassMacro(CMAEvolutionStrategyOptimizer)
virtual double GetCurrentMaximumD() const
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()
void SetRandomVariateGenerator(Statistics::MersenneTwisterRandomVariateGenerator &randomVariateGenerator)


Generated on 1774142652 for elastix by doxygen 1.15.0 elastix logo