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 
32 namespace itk
33 {
51 {
52 public:
53 
57  typedef SmartPointer< const Self > ConstPointer;
58 
59  itkNewMacro( Self );
60  itkTypeMacro( CMAEvolutionStrategyOptimizer,
62 
69 
70  typedef enum {
79 
80  virtual void StartOptimization( void );
81 
82  virtual void ResumeOptimization( void );
83 
84  virtual void StopOptimization( void );
85 
87  itkGetConstMacro( CurrentIteration, unsigned long );
88 
90  itkGetConstMacro( CurrentValue, MeasureType );
91 
93  itkGetConstReferenceMacro( StopCondition, StopConditionType );
94 
96  itkGetConstMacro( CurrentSigma, double );
97 
99  itkGetConstMacro( CurrentMinimumD, double );
100 
102  itkGetConstMacro( CurrentMaximumD, double );
103 
106  virtual double GetCurrentStepLength( void ) const
107  { return this->GetCurrentSigma() * this->GetCurrentMaximumD(); }
108 
114  itkGetConstReferenceMacro( CurrentScaledStep, ParametersType );
115 
117  itkGetConstMacro( MaximumNumberOfIterations, unsigned long );
118  itkSetClampMacro( MaximumNumberOfIterations, unsigned long,
120 
125  itkSetMacro( PopulationSize, unsigned int );
126  itkGetConstMacro( PopulationSize, unsigned int );
127 
132  itkSetMacro( NumberOfParents, unsigned int );
133  itkGetConstMacro( NumberOfParents, unsigned int );
134 
138  itkSetClampMacro( InitialSigma, double, NumericTraits< double >::min(), NumericTraits< double >::max() );
139  itkGetConstMacro( InitialSigma, double );
140 
144  itkSetClampMacro( MaximumDeviation, double, 0.0, NumericTraits< double >::max() );
145  itkGetConstMacro( MaximumDeviation, double );
146 
150  itkSetClampMacro( MinimumDeviation, double, 0.0, NumericTraits< double >::max() );
151  itkGetConstMacro( MinimumDeviation, double );
152 
162  itkSetMacro( UseDecayingSigma, bool );
163  itkGetConstMacro( UseDecayingSigma, bool );
164 
167  itkSetClampMacro( SigmaDecayA, double, 0.0, NumericTraits< double >::max() );
168  itkGetConstMacro( SigmaDecayA, double );
169 
172  itkSetClampMacro( SigmaDecayAlpha, double, 0.0, 1.0 );
173  itkGetConstMacro( SigmaDecayAlpha, double );
174 
180  itkSetMacro( UseCovarianceMatrixAdaptation, bool );
181  itkGetConstMacro( UseCovarianceMatrixAdaptation, bool );
182 
189  itkSetStringMacro( RecombinationWeightsPreset );
190  itkGetStringMacro( RecombinationWeightsPreset );
191 
195  itkSetMacro( UpdateBDPeriod, unsigned int );
196  itkGetConstMacro( UpdateBDPeriod, unsigned int );
197 
203  itkSetMacro( PositionToleranceMin, double );
204  itkGetConstMacro( PositionToleranceMin, double );
205 
210  itkSetMacro( PositionToleranceMax, double );
211  itkGetConstMacro( PositionToleranceMax, double );
212 
219  itkSetMacro( ValueTolerance, double );
220  itkGetConstMacro( ValueTolerance, double );
221 
222 protected:
223 
224  typedef Array< double > RecombinationWeightsType;
225  typedef vnl_diag_matrix< double > EigenValueMatrixType;
226  typedef Array2D< double > CovarianceMatrixType;
227  typedef std::vector< ParametersType > ParameterContainerType;
228  typedef std::deque< MeasureType > MeasureHistoryType;
229 
230  typedef
231  std::pair< MeasureType, unsigned int > MeasureIndexPairType;
232  typedef std::vector< MeasureIndexPairType > MeasureContainerType;
233 
234  typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
235 
237  RandomGeneratorType::Pointer m_RandomGenerator;
238 
240  MeasureType m_CurrentValue;
241 
243  unsigned long m_CurrentIteration;
244 
247 
249  bool m_Stop;
250 
253  unsigned int m_PopulationSize;
254  unsigned int m_NumberOfParents;
255  unsigned int m_UpdateBDPeriod;
256 
275  RecombinationWeightsType m_RecombinationWeights;
277  unsigned long m_HistoryLength;
278 
281 
286 
289 
291  ParameterContainerType m_SearchDirs;
293  ParameterContainerType m_NormalizedSearchDirs;
295  MeasureContainerType m_CostFunctionValues;
297  ParametersType m_CurrentScaledStep;
299  ParametersType m_CurrentNormalizedStep;
301  ParametersType m_EvolutionPath;
303  ParametersType m_ConjugateEvolutionPath;
304 
306  MeasureHistoryType m_MeasureHistory;
307 
309  CovarianceMatrixType m_C;
311  CovarianceMatrixType m_B;
313  EigenValueMatrixType m_D;
314 
317 
320 
322  void PrintSelf( std::ostream & os, Indent indent ) const;
323 
338  virtual void InitializeConstants( void );
339 
352  virtual void InitializeProgressVariables( void );
353 
355  virtual void InitializeBCD( void );
356 
359  virtual void GenerateOffspring( void );
360 
362  virtual void SortCostFunctionValues( void );
363 
365  virtual void AdvanceOneStep( void );
366 
368  virtual void UpdateConjugateEvolutionPath( void );
369 
371  virtual void UpdateHeaviside( void );
372 
374  virtual void UpdateEvolutionPath( void );
375 
377  virtual void UpdateC( void );
378 
380  virtual void UpdateSigma( void );
381 
383  virtual void UpdateBD( void );
384 
394  virtual void FixNumericalErrors( void );
395 
406  virtual bool TestConvergence( bool firstCheck );
407 
408 private:
409 
410  CMAEvolutionStrategyOptimizer( const Self & ); // purposely not implemented
411  void operator=( const Self & ); // purposely not implemented
412 
425 
426 };
427 
428 } // end namespace itk
429 
430 #endif //#ifndef __itkCMAEvolutionStrategyOptimizer_h
virtual void StopOptimization(void)
virtual double GetCurrentSigma() const
virtual bool TestConvergence(bool firstCheck)
virtual void StartOptimization(void)
virtual void GenerateOffspring(void)
void PrintSelf(std::ostream &os, Indent indent) const
virtual void UpdateEvolutionPath(void)
virtual void InitializeProgressVariables(void)
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
virtual void InitializeConstants(void)
virtual double GetCurrentMaximumD() const
virtual void FixNumericalErrors(void)
int max(int a, int b)
virtual void UpdateConjugateEvolutionPath(void)
std::vector< ParametersType > ParameterContainerType
std::pair< MeasureType, unsigned int > MeasureIndexPairType
virtual void ResumeOptimization(void)
A Covariance Matrix Adaptation Evolution Strategy Optimizer.
virtual void SortCostFunctionValues(void)
int min(int a, int b)
std::vector< MeasureIndexPairType > MeasureContainerType
ScaledSingleValuedNonLinearOptimizer Superclass
Superclass::ScaledCostFunctionType ScaledCostFunctionType
virtual void UpdateHeaviside(void)


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo