go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkStochasticVarianceReducedGradientDescentOptimizer.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#ifndef __itkStochasticVarianceReducedGradientDescentOptimizer_h
19#define __itkStochasticVarianceReducedGradientDescentOptimizer_h
20
22#include "itkPlatformMultiThreader.h"
23
24namespace itk
25{
54{
55public:
60 typedef SmartPointer<const Self> ConstPointer;
61
63 itkNewMacro( Self );
64
67
76
80 typedef enum {
88
90 virtual void AdvanceOneStep( void );
91
93 void StartOptimization( void ) override;
94
97 virtual void ResumeOptimization( void );
98
100 virtual void MetricErrorResponse( ExceptionObject & err );
101
104 virtual void StopOptimization( void );
105
107 itkSetMacro( LearningRate, double );
108
110 itkGetConstReferenceMacro( LearningRate, double );
111
113 itkSetMacro( NumberOfIterations, unsigned long );
114
116 itkGetConstMacro( LBFGSMemory, unsigned int );
117
119 itkGetConstReferenceMacro( NumberOfIterations, unsigned long );
120
122 itkGetConstReferenceMacro( NumberOfInnerIterations, unsigned long );
123
125 itkGetConstMacro( CurrentIteration, unsigned int );
126
128 itkGetConstMacro( CurrentInnerIteration, unsigned int );
129
131 itkGetConstReferenceMacro( Value, double );
132
134 itkGetConstReferenceMacro( StopCondition, StopConditionType );
135
137 itkGetConstReferenceMacro( Gradient, DerivativeType );
138
140 itkGetConstReferenceMacro( SearchDir, DerivativeType );
141
143 itkSetMacro( PreviousPosition, ParametersType );
144
146 itkGetConstReferenceMacro( PreviousPosition, ParametersType );
147
149 itkSetMacro( PreviousGradient, DerivativeType );
150
152 itkGetConstReferenceMacro( PreviousGradient, DerivativeType );
153
155 void SetNumberOfWorkUnits( ThreadIdType numberOfThreads )
156 {
157 this->m_Threader->SetNumberOfWorkUnits( numberOfThreads );
158 }
159 //itkGetConstReferenceMacro( NumberOfThreads, ThreadIdType );
160 itkSetMacro( UseMultiThread, bool );
161
162 itkSetMacro( UseOpenMP, bool );
163 itkSetMacro( UseEigen, bool );
164
165protected:
168 void PrintSelf( std::ostream& os, Indent indent ) const override;
169
171 typedef itk::PlatformMultiThreader ThreaderType;
172 typedef ThreaderType::WorkUnitInfo ThreadInfoType;
173
174 // made protected so subclass can access
175 double m_Value;
179 //ParametersType m_PrePreviousSearchDir;
184 //DerivativeType m_PrePreviousGradient;
186 ThreaderType::Pointer m_Threader;
187
188 bool m_Stop;
189 unsigned long m_NumberOfIterations;
191 unsigned long m_CurrentIteration;
193 unsigned long m_LBFGSMemory;
194
195private:
196 StochasticVarianceReducedGradientDescentOptimizer( const Self& ); // purposely not implemented
197 void operator=( const Self& ); // purposely not implemented
198
199 // multi-threaded AdvanceOneStep:
202 {
205 };
206
209
211 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION AdvanceOneStepThreaderCallback( void * arg );
212
214 inline void ThreadedAdvanceOneStep( ThreadIdType threadId, ParametersType & newPosition );
215
216};
217
218} // end namespace itk
219
220
221#endif
virtual void MetricErrorResponse(ExceptionObject &err)
void ThreadedAdvanceOneStep(ThreadIdType threadId, ParametersType &newPosition)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION AdvanceOneStepThreaderCallback(void *arg)
void PrintSelf(std::ostream &os, Indent indent) const override


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo