9 #include "imstkNonLinearSystem.h" 10 #include "imstkMath.h" 11 #include "imstkSolverBase.h" 23 template<
typename SystemMatrix>
27 using JacobianType = std::function<const SystemMatrix& (const Vectord&)>;
28 using UpdateIterateType = std::function<void (const Vectord&, Vectord&)>;
29 using FunctionType = NonLinearSystem<SparseMatrixd>::VectorFunctionType;
38 virtual void solve()
override = 0;
46 double armijo(
const Vectord& dx, Vectord& x,
const double previousFnorm);
59 std::array<double, 3>& lambda);
66 void setSigma(
const std::array<double, 2>& newSigma);
67 const std::array<double, 2>& getSigma()
const;
74 void setAlpha(
const double newAlpha);
75 double getAlpha()
const;
83 size_t getArmijoMax()
const;
91 std::shared_ptr<NonLinearSystem<SystemMatrix>> getSystem()
const;
UpdateIterateType m_updateIterate
Update iteration function.
bool m_isSemiImplicit
Semi-Implicit solver.
virtual void solveGivenState(Vectord &x)=0
Main solve routine.
size_t m_armijoMax
Maximum number of step length reductions.
void setAlpha(const double newAlpha)
Set/Get Alpha. Parameter to measure sufficient decrease in the line search.
virtual void setToSemiImplicit()
Set the Newton solver to be fully implicit.
virtual void setToFullyImplicit()
Set the Newton solver to be fully implicit.
void parabolicModel(const std::array< double, 3 > &fnorm, std::array< double, 3 > &lambda)
Three-point safeguarded parabolic model for a line search. Upon return lambda[0] will contain the new...
double m_alpha
Parameter to measure decrease.
Base class for a multi-variable nonlinear system.
void setSigma(const std::array< double, 2 > &newSigma)
Set/Get Sigma. Safeguard parameter for the the line search method.
void setUpdateIterate(const UpdateIterateType &newUpdateIterate)
Set a customized iterate update function.
double armijo(const Vectord &dx, Vectord &x, const double previousFnorm)
Backtracking line search method based on the Armijo-Goldstein condition.
void setSystem(std::shared_ptr< NonLinearSystem< SystemMatrix >> newSystem)
Sets the system. System of nonlinear equations.
std::array< double, 2 > m_sigma
Safeguarding bounds for the line search.
Base class for non-linear solvers.
void setArmijoMax(const size_t newArmijoMax)
Set/Get ArmijoMax. Maximum number of step length reductions.
std::shared_ptr< NonLinearSystem< SystemMatrix > > m_nonLinearSystem
System of non-linear equations.