DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dftfe::LBFGSNonLinearSolver Class Reference

Class implementing LBFGS optimzation method. More...

#include <LBFGSNonLinearSolver.h>

Inheritance diagram for dftfe::LBFGSNonLinearSolver:
dftfe::nonLinearSolver

Public Member Functions

 LBFGSNonLinearSolver (const bool usePreconditioner, const double maxUpdate, const unsigned int maxNumberIterations, const int maxNumPastSteps, const unsigned int debugLevel, const MPI_Comm &mpi_comm_parent, const bool isCurvatureOnlyLineSearchStoppingCondition=false)
 Constructor.
 
 ~LBFGSNonLinearSolver ()
 Destructor.
 
nonLinearSolver::ReturnValueType solve (nonlinearSolverProblem &problem, const std::string checkpointFileName="", const bool restart=false)
 Solve non-linear problem using LBFGS method.
 
void save (const std::string &checkpointFileName)
 Create checkpoint file for current state of the LBFGS solver.
 
- Public Member Functions inherited from dftfe::nonLinearSolver
virtual ~nonLinearSolver ()=0
 Destructor.
 

Private Member Functions

void initializePreconditioner (nonlinearSolverProblem &problem)
 Initialize preconditioner.
 
void scalePreconditioner (nonlinearSolverProblem &problem)
 Scale preconditioner.
 
void computeHx (std::vector< double > &Hx)
 Compute Hessian inverse times vector.
 
void computeStep ()
 Compute LBFGS step.
 
void computeUpdateStep ()
 Compute Update Vector.
 
void updateHistory ()
 Update the stored history, damped LBFGS.
 
void checkWolfe ()
 Test if the step satisfies strong Wolfe conditions.
 
void computeStepScale (nonlinearSolverProblem &problem)
 Compute scaling factor for the step.
 
bool updateSolution (const std::vector< double > &step, nonlinearSolverProblem &problem)
 Update solution x -> x + step.
 
void load (const std::string &checkpointFileName)
 Load LBFGS solver state from checkpoint file.
 

Private Attributes

std::vector< double > d_gradient
 
std::vector< double > d_value
 
std::vector< double > d_gradientNew
 
std::vector< double > d_valueNew
 
std::vector< double > d_deltaX
 
std::vector< double > d_deltaXNew
 
std::vector< double > d_updateVector
 
std::vector< double > d_preconditioner
 storage for the preconditioner.
 
unsigned int d_numberUnknowns
 
unsigned int d_iter
 storage for current bfgs iteration count.
 
std::deque< std::vector< double > > d_deltaGq
 storage for history.
 
std::deque< std::vector< double > > d_deltaXq
 
std::deque< double > d_rhoq
 
const int d_maxNumPastSteps
 storage for the maximum number of past steps to be stored.
 
int d_numPastSteps
 storage for the number of past steps currently stored.
 
double d_normDeltaXnew
 storage for inf norm of the update step.
 
double d_maxStepLength
 storage for the maximum allowed step length.
 
double d_alpha
 storage for backtracking line search parameter.
 
bool d_stepAccepted
 boolean parameter for step accepteance and Wolfe conditions.
 
bool d_wolfeCurvature
 
bool d_wolfeSufficientDec
 
bool d_wolfeSatisfied
 
const bool d_usePreconditioner
 flag for using the preconditioner
 
bool d_useSingleAtomSolutionsInitialGuess
 
bool d_noHistory
 
bool d_isCurvatureOnlyLineSearchStoppingCondition
 
MPI_Comm mpi_communicator
 
dealii::ConditionalOStream pcout
 

Additional Inherited Members

- Public Types inherited from dftfe::nonLinearSolver
enum  ReturnValueType {
  SUCCESS = 0 , FAILURE , LINESEARCH_FAILED , MAX_ITER_REACHED ,
  RESTART
}
 
- Protected Member Functions inherited from dftfe::nonLinearSolver
 nonLinearSolver (const unsigned int debugLevel, const unsigned int maxNumberIterations, const double tolerance=0)
 Constructor.
 
double getTolerance () const
 Get tolerance.
 
unsigned int getMaximumNumberIterations () const
 Get maximum number of iterations.
 
unsigned int getDebugLevel () const
 Get debug level.
 
- Protected Attributes inherited from dftfe::nonLinearSolver
const unsigned int d_debugLevel
 controls the verbosity of the printing
 
const unsigned int d_maxNumberIterations
 maximum number of nonlinear solve iterations
 
const double d_tolerance
 nonlinear solve stopping tolerance
 

Detailed Description

Class implementing LBFGS optimzation method.

Author
Nikhil Kodali

Constructor & Destructor Documentation

◆ LBFGSNonLinearSolver()

dftfe::LBFGSNonLinearSolver::LBFGSNonLinearSolver ( const bool usePreconditioner,
const double maxUpdate,
const unsigned int maxNumberIterations,
const int maxNumPastSteps,
const unsigned int debugLevel,
const MPI_Comm & mpi_comm_parent,
const bool isCurvatureOnlyLineSearchStoppingCondition = false )

Constructor.

Parameters
usePreconditionerBoolean parameter specifying whether or not to use the preconditioner.
maxUpdateMaximum allowed step length in any direction.
maxNumberIterationsMaximum number of iterations.
maxNumPastStepsNumber of previous steps stored by the LBFGS solver.
debugLevelDebug output level: 0 - no debug output 1 - limited debug output 2 - all debug output.
mpi_comm_parentThe mpi communicator used.

◆ ~LBFGSNonLinearSolver()

dftfe::LBFGSNonLinearSolver::~LBFGSNonLinearSolver ( )

Destructor.

Member Function Documentation

◆ checkWolfe()

void dftfe::LBFGSNonLinearSolver::checkWolfe ( )
private

Test if the step satisfies strong Wolfe conditions.

◆ computeHx()

void dftfe::LBFGSNonLinearSolver::computeHx ( std::vector< double > & Hx)
private

Compute Hessian inverse times vector.

◆ computeStep()

void dftfe::LBFGSNonLinearSolver::computeStep ( )
private

Compute LBFGS step.

◆ computeStepScale()

void dftfe::LBFGSNonLinearSolver::computeStepScale ( nonlinearSolverProblem & problem)
private

Compute scaling factor for the step.

◆ computeUpdateStep()

void dftfe::LBFGSNonLinearSolver::computeUpdateStep ( )
private

Compute Update Vector.

◆ initializePreconditioner()

void dftfe::LBFGSNonLinearSolver::initializePreconditioner ( nonlinearSolverProblem & problem)
private

Initialize preconditioner.

◆ load()

void dftfe::LBFGSNonLinearSolver::load ( const std::string & checkpointFileName)
private

Load LBFGS solver state from checkpoint file.

◆ save()

void dftfe::LBFGSNonLinearSolver::save ( const std::string & checkpointFileName)
virtual

Create checkpoint file for current state of the LBFGS solver.

Implements dftfe::nonLinearSolver.

◆ scalePreconditioner()

void dftfe::LBFGSNonLinearSolver::scalePreconditioner ( nonlinearSolverProblem & problem)
private

Scale preconditioner.

◆ solve()

nonLinearSolver::ReturnValueType dftfe::LBFGSNonLinearSolver::solve ( nonlinearSolverProblem & problem,
const std::string checkpointFileName = "",
const bool restart = false )
virtual

Solve non-linear problem using LBFGS method.

Parameters
problem[in]nonlinearSolverProblem object.
checkpointFileName[in]if string is non-empty, creates checkpoint file named checkpointFileName for every nonlinear iteration. If restart is set to true, checkpointFileName must match the name of the checkpoint file. Empty string will throw an error.
restart[in]boolean specifying whether this is a restart solve using the checkpoint file specified by checkpointFileName.
Returns
Return value indicating success or failure.

Implements dftfe::nonLinearSolver.

◆ updateHistory()

void dftfe::LBFGSNonLinearSolver::updateHistory ( )
private

Update the stored history, damped LBFGS.

◆ updateSolution()

bool dftfe::LBFGSNonLinearSolver::updateSolution ( const std::vector< double > & step,
nonlinearSolverProblem & problem )
private

Update solution x -> x + step.

Parameters
stepupdate step vector.
problemnonlinearSolverProblem object.
Returns
bool true if valid update and false if increment bound exceeded

Member Data Documentation

◆ d_alpha

double dftfe::LBFGSNonLinearSolver::d_alpha
private

storage for backtracking line search parameter.

◆ d_deltaGq

std::deque<std::vector<double> > dftfe::LBFGSNonLinearSolver::d_deltaGq
private

storage for history.

◆ d_deltaX

std::vector<double> dftfe::LBFGSNonLinearSolver::d_deltaX
private

storage for the step taken in last BFGS step, step computed in the corrent BFGS step and the update vector computed in the current bfgs step.

◆ d_deltaXNew

std::vector<double> dftfe::LBFGSNonLinearSolver::d_deltaXNew
private

◆ d_deltaXq

std::deque<std::vector<double> > dftfe::LBFGSNonLinearSolver::d_deltaXq
private

◆ d_gradient

std::vector<double> dftfe::LBFGSNonLinearSolver::d_gradient
private

storage for the value and gradient of the nonlinear problem in the current bfgs step

◆ d_gradientNew

std::vector<double> dftfe::LBFGSNonLinearSolver::d_gradientNew
private

storage for the value and gradient of the nonlinear problem evaluated at the end of the current bfgs step

◆ d_isCurvatureOnlyLineSearchStoppingCondition

bool dftfe::LBFGSNonLinearSolver::d_isCurvatureOnlyLineSearchStoppingCondition
private

◆ d_iter

unsigned int dftfe::LBFGSNonLinearSolver::d_iter
private

storage for current bfgs iteration count.

◆ d_maxNumPastSteps

const int dftfe::LBFGSNonLinearSolver::d_maxNumPastSteps
private

storage for the maximum number of past steps to be stored.

◆ d_maxStepLength

double dftfe::LBFGSNonLinearSolver::d_maxStepLength
private

storage for the maximum allowed step length.

◆ d_noHistory

bool dftfe::LBFGSNonLinearSolver::d_noHistory
private

◆ d_normDeltaXnew

double dftfe::LBFGSNonLinearSolver::d_normDeltaXnew
private

storage for inf norm of the update step.

◆ d_numberUnknowns

unsigned int dftfe::LBFGSNonLinearSolver::d_numberUnknowns
private

storage for number of unknowns to be solved for in the nonlinear problem.

◆ d_numPastSteps

int dftfe::LBFGSNonLinearSolver::d_numPastSteps
private

storage for the number of past steps currently stored.

◆ d_preconditioner

std::vector<double> dftfe::LBFGSNonLinearSolver::d_preconditioner
private

storage for the preconditioner.

◆ d_rhoq

std::deque<double> dftfe::LBFGSNonLinearSolver::d_rhoq
private

◆ d_stepAccepted

bool dftfe::LBFGSNonLinearSolver::d_stepAccepted
private

boolean parameter for step accepteance and Wolfe conditions.

◆ d_updateVector

std::vector<double> dftfe::LBFGSNonLinearSolver::d_updateVector
private

◆ d_usePreconditioner

const bool dftfe::LBFGSNonLinearSolver::d_usePreconditioner
private

flag for using the preconditioner

◆ d_useSingleAtomSolutionsInitialGuess

bool dftfe::LBFGSNonLinearSolver::d_useSingleAtomSolutionsInitialGuess
private

◆ d_value

std::vector<double> dftfe::LBFGSNonLinearSolver::d_value
private

◆ d_valueNew

std::vector<double> dftfe::LBFGSNonLinearSolver::d_valueNew
private

◆ d_wolfeCurvature

bool dftfe::LBFGSNonLinearSolver::d_wolfeCurvature
private

◆ d_wolfeSatisfied

bool dftfe::LBFGSNonLinearSolver::d_wolfeSatisfied
private

◆ d_wolfeSufficientDec

bool dftfe::LBFGSNonLinearSolver::d_wolfeSufficientDec
private

◆ mpi_communicator

MPI_Comm dftfe::LBFGSNonLinearSolver::mpi_communicator
private

◆ pcout

dealii::ConditionalOStream dftfe::LBFGSNonLinearSolver::pcout
private

The documentation for this class was generated from the following file: