#include <NOX_Direction_NonlinearCG.H>
Public Member Functions | |
NonlinearCG (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList ¶ms) | |
Constructor. | |
virtual | ~NonlinearCG () |
Destructor. | |
virtual bool | reset (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList &p) |
derived | |
virtual bool | compute (Abstract::Vector &dir, Abstract::Group &grp, const Solver::Generic &solver) |
derived | |
virtual bool | compute (NOX::Abstract::Vector &dir, NOX::Abstract::Group &grp, const NOX::Solver::LineSearchBased &solver) |
Same as compute(NOX::Abstract::Vector&, NOX::Abstract::Group&, const NOX::Solver::Generic&). | |
Private Attributes | |
Teuchos::RCP< NOX::GlobalData > | globalDataPtr |
Global data pointer. Keep this so the parameter list remains valid. | |
Teuchos::RCP< NOX::Utils > | utils |
Printing Utils. | |
const Abstract::Group * | oldSolnPtr |
Previous solution pointer. | |
Teuchos::RCP< Abstract::Vector > | tmpVecPtr |
Temporary vector used in applying preconditioner. | |
Teuchos::RCP< Abstract::Vector > | oldDirPtr |
Previous search direction pointer. | |
Teuchos::RCP< Abstract::Vector > | oldDescentDirPtr |
Pointer to previous descent direction. | |
Teuchos::RCP< Abstract::Vector > | diffVecPtr |
Temporary vector used in computing the numerator of Polak-Ribiere ![]() | |
Teuchos::ParameterList * | paramsPtr |
Input parameters. | |
double | beta |
Orthogonalization parameter ![]() | |
int | niter |
Number of nonlinear iterations. | |
int | restartFrequency |
Restart frequency. | |
bool | doPrecondition |
Boolean flag indicating whether or not to use preconditioning. | |
bool | usePRbeta |
Boolean flag indicating if beta is computed using Polak-Ribiere. |
Calculates the direction
where is a preconditioner and
is an orthogonalization parameter which can be computed in various ways (see below), and
is the search direction from the previous nonlinear iteration.
This method provides a generalization of Linear CG to nonlinear problems. It does this by computing a search direction using an expression analogous to that of Linear CG. The negative of the current residual vector, is taken, allowed to be preconditioned, and then orthogonalized against the previous search direction. This direction can sometimes be used successfully with the various choices provided in NOX::Linesearch but is intended to be used with NOX::Linesearch::NonlinearCG. In fact, the expected convergence behavior of linear problems can only be achieved in this way.
To use this direction, specify that the "Method" is "NonlinearCG" in the "Direction" sublist of the parameters that are passed to the solver (see NOX::Direction::Manager for more information on choosing the search direction).
The following options may be specified in the "Nonlinear CG" sublist of the "Direction" sublist of the solver parameters.
where
These comprise the two most popular choices for orthogonalization. Both reduce to the linear result for linear problems. "Polak-Ribiere" provides an implied restart capability by setting anytime the computed value is less than zero.
References
Nocedal & Wright, "Numerical Optimization", Springer-Verlag, New York, 1999. Though presented within the context of nonlinear optimization, the connection to nonlinear systems of equations is made by the correspondence (cf Algorithm 5.4).
Another useful useful reference is:
Jonathan Richard Shewchuk, "An Introduction to the Conjugate Gradient Method Without the Agonizing Pain," 1994. Chapter 14 provides a summary of issues in generalizing linear CG to the nonlinear case. Correspondence to NOX notation is made by the equivalence (cd Section 14.1).
Definition at line 154 of file NOX_Direction_NonlinearCG.H.
NonlinearCG::NonlinearCG | ( | const Teuchos::RCP< NOX::GlobalData > & | gd, | |
Teuchos::ParameterList & | params | |||
) |
NonlinearCG::~NonlinearCG | ( | ) | [virtual] |
bool NonlinearCG::reset | ( | const Teuchos::RCP< NOX::GlobalData > & | gd, | |
Teuchos::ParameterList & | p | |||
) | [virtual] |
derived
Implements NOX::Direction::Generic.
Definition at line 63 of file NOX_Direction_NonlinearCG.C.
References doPrecondition, globalDataPtr, paramsPtr, restartFrequency, usePRbeta, and utils.
Referenced by NonlinearCG().
bool NonlinearCG::compute | ( | Abstract::Vector & | dir, | |
Abstract::Group & | grp, | |||
const Solver::Generic & | solver | |||
) | [virtual] |
derived
Implements NOX::Direction::Generic.
Definition at line 86 of file NOX_Direction_NonlinearCG.C.
References NOX::Abstract::Group::applyRightPreconditioning(), beta, NOX::Abstract::Vector::clone(), NOX::Abstract::Group::computeF(), NOX::Abstract::Group::computeJacobian(), diffVecPtr, doPrecondition, NOX::Abstract::Group::getF(), NOX::Solver::Generic::getNumIterations(), NOX::Solver::Generic::getPreviousSolutionGroup(), NOX::Abstract::Group::getX(), NOX::Abstract::Vector::innerProduct(), NOX::Abstract::Group::isJacobian(), niter, NOX::Abstract::Group::Ok, oldDescentDirPtr, oldDirPtr, oldSolnPtr, NOX::Utils::OuterIteration, paramsPtr, restartFrequency, NOX::Abstract::Vector::scale(), NOX::ShapeCopy, tmpVecPtr, NOX::Abstract::Vector::update(), usePRbeta, utils, and NOX::Utils::Warning.
Referenced by compute().
bool NonlinearCG::compute | ( | NOX::Abstract::Vector & | dir, | |
NOX::Abstract::Group & | grp, | |||
const NOX::Solver::LineSearchBased & | solver | |||
) | [virtual] |
Same as compute(NOX::Abstract::Vector&, NOX::Abstract::Group&, const NOX::Solver::Generic&).
Enables direct support for line search based solvers for the purpose of efficiency since the LineSearchBased object has a getStep() function that some directions require.
If it is not redefined in the derived class, it will just call the compute with the NOX::Solver::Generic argument.
Reimplemented from NOX::Direction::Generic.
Definition at line 198 of file NOX_Direction_NonlinearCG.C.
References compute().
Teuchos::RCP<NOX::GlobalData> NOX::Direction::NonlinearCG::globalDataPtr [private] |
Global data pointer. Keep this so the parameter list remains valid.
Definition at line 180 of file NOX_Direction_NonlinearCG.H.
Referenced by reset().
Teuchos::RCP<NOX::Utils> NOX::Direction::NonlinearCG::utils [private] |
const Abstract::Group* NOX::Direction::NonlinearCG::oldSolnPtr [private] |
Previous solution pointer.
Definition at line 186 of file NOX_Direction_NonlinearCG.H.
Referenced by compute().
Teuchos::RCP<Abstract::Vector> NOX::Direction::NonlinearCG::tmpVecPtr [private] |
Temporary vector used in applying preconditioner.
Definition at line 189 of file NOX_Direction_NonlinearCG.H.
Referenced by compute().
Teuchos::RCP<Abstract::Vector> NOX::Direction::NonlinearCG::oldDirPtr [private] |
Previous search direction pointer.
The current search direction is found by orthogonalizing against the previous search direction. This vector provides storage for the old search direction.
Definition at line 195 of file NOX_Direction_NonlinearCG.H.
Referenced by compute().
Teuchos::RCP<Abstract::Vector> NOX::Direction::NonlinearCG::oldDescentDirPtr [private] |
Pointer to previous descent direction.
This vector stores the old descent direction which was orthogonalized to determine the old search direction. It is needed in the numerator of the expression for Polak-Ribiere .
Definition at line 201 of file NOX_Direction_NonlinearCG.H.
Referenced by compute().
Teuchos::RCP<Abstract::Vector> NOX::Direction::NonlinearCG::diffVecPtr [private] |
Temporary vector used in computing the numerator of Polak-Ribiere .
Definition at line 204 of file NOX_Direction_NonlinearCG.H.
Referenced by compute().
Teuchos::ParameterList* NOX::Direction::NonlinearCG::paramsPtr [private] |
double NOX::Direction::NonlinearCG::beta [private] |
Orthogonalization parameter .
Definition at line 210 of file NOX_Direction_NonlinearCG.H.
Referenced by compute().
int NOX::Direction::NonlinearCG::niter [private] |
Number of nonlinear iterations.
Definition at line 213 of file NOX_Direction_NonlinearCG.H.
Referenced by compute().
int NOX::Direction::NonlinearCG::restartFrequency [private] |
bool NOX::Direction::NonlinearCG::doPrecondition [private] |
Boolean flag indicating whether or not to use preconditioning.
Definition at line 219 of file NOX_Direction_NonlinearCG.H.
bool NOX::Direction::NonlinearCG::usePRbeta [private] |
Boolean flag indicating if beta is computed using Polak-Ribiere.
Definition at line 222 of file NOX_Direction_NonlinearCG.H.