#include <NOX_LineSearch_NonlinearCG.H>
Public Member Functions | |
NonlinearCG (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList ¶ms) | |
Constructor. | |
~NonlinearCG () | |
Destructor. | |
bool | reset (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList ¶ms) |
bool | compute (NOX::Abstract::Group &newgrp, double &step, const NOX::Abstract::Vector &dir, const NOX::Solver::Generic &s) |
Perform a line search. | |
Private Member Functions | |
NOX::Abstract::Vector & | computeDirectionalDerivative (const Abstract::Vector &dir, const Abstract::Group &grp) |
Method for computing directional derivatives numerically. | |
Private Attributes | |
Teuchos::RCP< NOX::Utils > | utils |
Printing utilities. | |
Teuchos::RCP < NOX::Abstract::Vector > | vecPtr |
Temporary Vector pointer used to compute directional derivatives. | |
Teuchos::RCP < NOX::Abstract::Group > | grpPtr |
Temporary Group pointer used to compute directional derivatives. | |
Teuchos::RCP < NOX::StatusTest::FiniteValue > | finiteValueTester |
Utililty object to test for NaN or Inf values for computed steps. |
This is a simple linesearch intended to be used with NOX::Direction::NonlinearCG, which provides search direction , in computing an update to the current solution vector
. It is designed to compute a step length
consistent with the exact linesearch of Linear CG for linear problems, and it avoids use of matrices by employing a directional derivative (details below). The step length,
is computed from a single evaluation of,
where is the n x n Jacobian matrix. Explicit construction of
is avoided by performing the product
using a directional derivative (cf NOX::Epetra::MatrixFree):
where .
Derivation / Theory:
This linesearch is derived by attempting to achieve in a single step, the following minimization:
where is a merit function chosen (but never explicitly given) so that an equivalence to Linear CG holds, ie
. The minimization above can now be cast as an equation:
An approximate solution to this equation can be obtained from a second-order expansion of
,
from which it immediately follows
Input Parameters
The NonlinearCG linesearch is selected using:
"Line Search"
"Method" = "%NonlinearCG" [required]
Currently, no adjustable parameters exist for this linesarch.
References
Jonathan Richard Shewchuk, "An Introduction to the Conjugate Gradient Method Without the Agonizing Pain," 1994. Though presented within the context of nonlinear optimization, the connection to solving nonlinear equation systems is made via the equivalence .
Definition at line 145 of file NOX_LineSearch_NonlinearCG.H.
NOX::LineSearch::NonlinearCG::NonlinearCG | ( | const Teuchos::RCP< NOX::GlobalData > & | gd, | |
Teuchos::ParameterList & | params | |||
) |
NOX::LineSearch::NonlinearCG::~NonlinearCG | ( | ) |
bool NOX::LineSearch::NonlinearCG::compute | ( | NOX::Abstract::Group & | grp, | |
double & | step, | |||
const NOX::Abstract::Vector & | dir, | |||
const NOX::Solver::Generic & | s | |||
) | [virtual] |
Perform a line search.
On input:
grp | The initial solution vector, ![]() | |
dir | A vector of directions to be used in the line search, ![]() | |
s | The nonlinear solver. |
step | The distance the direction was scaled, ![]() | |
grp | The grp is updated with a new solution, ![]() |
Ideally, (e.g the final direction is a descent direction).
Note that the dir
object is a std::vector. For typical line searches as described in the above equation, this vector is of size one. We have used a std::vector to allow for special cases of multi-directional line searches such as the Bader/Schnabel curvillinear line search.
Return value is true for a successful line search computation.
Implements NOX::LineSearch::Generic.
Definition at line 72 of file NOX_LineSearch_NonlinearCG.C.
References computeDirectionalDerivative(), NOX::Abstract::Group::computeF(), NOX::Abstract::Group::computeX(), NOX::Utils::fill(), finiteValueTester, NOX::Abstract::Group::getF(), NOX::Solver::Generic::getPreviousSolutionGroup(), NOX::Utils::InnerIteration, NOX::Abstract::Vector::innerProduct(), and utils.
NOX::Abstract::Vector & NOX::LineSearch::NonlinearCG::computeDirectionalDerivative | ( | const Abstract::Vector & | dir, | |
const Abstract::Group & | grp | |||
) | [private] |
Method for computing directional derivatives numerically.
Definition at line 118 of file NOX_LineSearch_NonlinearCG.C.
References NOX::Abstract::Group::clone(), NOX::Abstract::Vector::clone(), NOX::Abstract::Group::getF(), NOX::Abstract::Group::getX(), grpPtr, NOX::Abstract::Group::isF(), NOX::Abstract::Vector::norm(), NOX::ShapeCopy, utils, and vecPtr.
Referenced by compute().
Teuchos::RCP<NOX::Utils> NOX::LineSearch::NonlinearCG::utils [private] |
Printing utilities.
Definition at line 173 of file NOX_LineSearch_NonlinearCG.H.
Referenced by compute(), and computeDirectionalDerivative().
Teuchos::RCP<NOX::Abstract::Vector> NOX::LineSearch::NonlinearCG::vecPtr [private] |
Temporary Vector pointer used to compute directional derivatives.
Definition at line 176 of file NOX_LineSearch_NonlinearCG.H.
Referenced by computeDirectionalDerivative().
Teuchos::RCP<NOX::Abstract::Group> NOX::LineSearch::NonlinearCG::grpPtr [private] |
Temporary Group pointer used to compute directional derivatives.
Definition at line 179 of file NOX_LineSearch_NonlinearCG.H.
Referenced by computeDirectionalDerivative().
Teuchos::RCP<NOX::StatusTest::FiniteValue> NOX::LineSearch::NonlinearCG::finiteValueTester [private] |
Utililty object to test for NaN or Inf values for computed steps.
Definition at line 182 of file NOX_LineSearch_NonlinearCG.H.
Referenced by compute().