20 #ifndef __itkIterativeSolverBase_hxx 21 #define __itkIterativeSolverBase_hxx 31 template <
class TPrecision>
35 m_EPSOfVaribles = 1e-4;
36 m_MaxNumberOfIterations = 1000;
37 m_NumberOfIterations = 0;
38 m_MinRelativeChangeOfCostFunction = 1e-2;
39 m_MinRelativeChangeOfPrimalResidual = 1e-2;
40 m_MinRelativeChangeOfDualResidual = 1e-2;
41 m_UpdateInformation =
NONE;
42 m_NumberOfChangeLessThanThreshold=0;
46 template <
class TPrecision >
55 template <
class TPrecision >
60 Superclass::Initialize(xInitial);
61 this->m_CostFunction.clear();
62 this->m_DifferenceNormOfPrimalResidual.clear();
63 this->m_DifferenceNormOfDualResidual.clear();
65 this->m_EPSOfPrimalResidual.clear();
66 this->m_EPSOfDualResidual.clear();
67 m_NumberOfIterations = 0;
68 m_NumberOfChangeLessThanThreshold=0;
71 template <
class TPrecision >
77 this->m_CostFunction.clear();
78 this->m_DifferenceNormOfPrimalResidual.clear();
79 this->m_DifferenceNormOfDualResidual.clear();
81 this->m_EPSOfPrimalResidual.clear();
82 this->m_EPSOfDualResidual.clear();
83 m_NumberOfIterations = 0;
84 m_UpdateInformation =
NONE;
87 template <
class TPrecision >
88 typename LightObject::Pointer
92 typename LightObject::Pointer loPtr = Superclass::InternalClone();
96 itkExceptionMacro(<<
"downcast to type " << this->GetNameOfClass()<<
" failed.");
98 rval->m_CostFunction = m_CostFunction;
99 rval->m_DifferenceNormOfPrimalResidual = m_DifferenceNormOfPrimalResidual;
100 rval->m_DifferenceNormOfDualResidual = m_DifferenceNormOfDualResidual;
101 rval->m_EPSOfPrimalResidual = m_EPSOfPrimalResidual;
102 rval->m_EPSOfDualResidual = m_EPSOfDualResidual;
103 rval->m_MaxNumberOfIterations = m_MaxNumberOfIterations;
104 rval->m_NumberOfIterations = m_NumberOfIterations;
105 rval->m_MinRelativeChangeOfCostFunction = m_MinRelativeChangeOfCostFunction;
106 rval->m_MinRelativeChangeOfPrimalResidual = m_MinRelativeChangeOfPrimalResidual;
107 rval->m_MinRelativeChangeOfDualResidual = m_MinRelativeChangeOfDualResidual;
108 rval->m_EPSOfVaribles = m_EPSOfVaribles;
109 rval->m_UpdateInformation = m_UpdateInformation;
110 rval->m_NumberOfChangeLessThanThreshold = m_NumberOfChangeLessThanThreshold;
114 template <
class TPrecision>
119 Superclass::PrintSelf(os, indent);
120 PrintVar4(
true, m_MaxNumberOfIterations, m_NumberOfIterations, m_EPSOfVaribles, m_UpdateInformation, os<<indent);
123 PrintVar4(
true, m_MinRelativeChangeOfCostFunction, m_MinRelativeChangeOfPrimalResidual,
124 m_MinRelativeChangeOfDualResidual, m_NumberOfChangeLessThanThreshold, os<<indent);
126 utl::PrintVector(m_DifferenceNormOfPrimalResidual,
"m_DifferenceNormOfPrimalResidual",
" ", os<<indent);
127 utl::PrintVector(m_DifferenceNormOfDualResidual,
"m_DifferenceNormOfDualResidual",
" ", os<<indent);
128 utl::PrintVector(m_EPSOfPrimalResidual,
"m_EPSOfPrimalResidual",
" ", os<<indent);
129 utl::PrintVector(m_EPSOfDualResidual,
"m_EPSOfDualResidual",
" ", os<<indent);
Base class for some optimization solvers using primal-dual updates.
virtual void Clear() ITK_OVERRIDE
virtual void Solve(const VectorType &xInitial=VectorType()) ITK_OVERRIDE
helper functions specifically used in dmritool
virtual LightObject::Pointer InternalClone() const ITK_OVERRIDE
void PrintVector(const std::vector< T > &vec, const std::string &str="", const char *separate=" ", std::ostream &os=std::cout, bool showStats=true)
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
#define PrintVar4(cond, var1, var2, var3, var4, os)
Base class for some optimization solvers using primal-dual updates.
void Initialize(const VectorType &xInitial=VectorType()) ITK_OVERRIDE
SmartPointer< Self > Pointer