#include <NOX_Direction_Broyden.H>
Classes | |
class | BroydenMemory |
Utility class for NOX::Direction::Broyden method to manage the information stored in "limited" memory. More... | |
class | BroydenMemoryUnit |
Utility class for NOX::Direction::Broyden::BroydenMemory. More... | |
Public Member Functions | |
Broyden (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList ¶ms) | |
Constructor. | |
virtual | ~Broyden () |
Destructor. | |
virtual bool | reset (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList ¶ms) |
Reset direction based on possibly new parameters. | |
virtual bool | compute (NOX::Abstract::Vector &dir, NOX::Abstract::Group &grp, const NOX::Solver::Generic &solver) |
Not supported for this direction - only works for line search based solver. | |
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 Member Functions | |
void | throwError (const string &functionName, const string &errorMsg) |
Print an error message and throw an error. | |
bool | doRestart (NOX::Abstract::Group &soln, const NOX::Solver::LineSearchBased &solver) |
Determine if it's time to restart. | |
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. | |
Teuchos::ParameterList * | lsParamsPtr |
"Linear Solver" sublist from "Direction"/"Broyden" | |
Teuchos::RCP < NOX::Abstract::Group > | oldJacobianGrpPtr |
Group to hold the "old" Jacobian. | |
int | cnt |
Counter of how many times the Jacobian associated with oldJacobianGrpPtr has been used since its last update. | |
int | cntMax |
Maximum number of times the Jacboian should be used between updates. | |
double | convRate |
Last computed convergence rate. | |
double | maxConvRate |
Greatest allowable convergence rate before the Jacobian is recomputed. | |
int | memorySizeMax |
Maximum memory size. | |
BroydenMemory | memory |
Storage of update vectors and related attributes. | |
NOX::Direction::Utils::InexactNewton | inexactNewtonUtils |
Inexact Newton solve utilities. |
We will calculate a limited-memory Broyden direction of the form
Here is a limited-memory Broyden approximation to the Jacobian of
at
, and
. It is based on apply Broyden updates to the Jacobian from some previous step.
Parameters
To use this direction, specify that the "Method" is "Broyden" 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).
In "Direction"/"Broyden":
Definition at line 123 of file NOX_Direction_Broyden.H.
NOX::Direction::Broyden::Broyden | ( | const Teuchos::RCP< NOX::GlobalData > & | gd, | |
Teuchos::ParameterList & | params | |||
) |
NOX::Direction::Broyden::~Broyden | ( | ) | [virtual] |
bool NOX::Direction::Broyden::reset | ( | const Teuchos::RCP< NOX::GlobalData > & | gd, | |
Teuchos::ParameterList & | params | |||
) | [virtual] |
Reset direction based on possibly new parameters.
Implements NOX::Direction::Generic.
Definition at line 196 of file NOX_Direction_Broyden.C.
References cntMax, globalDataPtr, inexactNewtonUtils, lsParamsPtr, maxConvRate, memory, memorySizeMax, NOX::Direction::Broyden::BroydenMemory::reset(), NOX::Direction::Utils::InexactNewton::reset(), and utils.
Referenced by Broyden().
bool NOX::Direction::Broyden::compute | ( | NOX::Abstract::Vector & | dir, | |
NOX::Abstract::Group & | grp, | |||
const NOX::Solver::Generic & | solver | |||
) | [virtual] |
Not supported for this direction - only works for line search based solver.
Implements NOX::Direction::Generic.
Definition at line 229 of file NOX_Direction_Broyden.C.
References throwError().
bool NOX::Direction::Broyden::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.
Add this direction to the memory
Reimplemented from NOX::Direction::Generic.
Definition at line 237 of file NOX_Direction_Broyden.C.
References NOX::Abstract::Group::clone(), cnt, NOX::Abstract::Group::computeF(), NOX::Direction::Utils::InexactNewton::computeForcingTerm(), NOX::DeepCopy, NOX::Utils::Details, doRestart(), NOX::Direction::Broyden::BroydenMemory::empty(), NOX::Abstract::Group::getF(), NOX::Solver::LineSearchBased::getNumIterations(), NOX::Solver::LineSearchBased::getPreviousSolutionGroup(), NOX::Solver::LineSearchBased::getStepSize(), inexactNewtonUtils, NOX::Abstract::Vector::innerProduct(), lsParamsPtr, memory, NOX::Abstract::Group::Ok, oldJacobianGrpPtr, NOX::Direction::Broyden::BroydenMemory::push(), NOX::Direction::Broyden::BroydenMemory::reset(), NOX::Abstract::Vector::scale(), NOX::Direction::Broyden::BroydenMemory::size(), throwError(), NOX::Abstract::Vector::update(), and utils.
void NOX::Direction::Broyden::throwError | ( | const string & | functionName, | |
const string & | errorMsg | |||
) | [private] |
Print an error message and throw an error.
If error printing is enabled for this process (see NOX::Utils), prints the following where <functionName> and <errorMsg> are replaced by the strings that are passed in.
NOX::Direction::Broyden::<functionName> - <errorMsg>
Then throws the string "NOX Error".
Definition at line 374 of file NOX_Direction_Broyden.C.
References NOX::Utils::Error, and utils.
Referenced by compute().
bool NOX::Direction::Broyden::doRestart | ( | NOX::Abstract::Group & | soln, | |
const NOX::Solver::LineSearchBased & | solver | |||
) | [private] |
Determine if it's time to restart.
A restart should be performed if any of the following conditions hold:
Definition at line 350 of file NOX_Direction_Broyden.C.
References cnt, cntMax, convRate, NOX::Abstract::Group::getNormF(), NOX::Solver::LineSearchBased::getNumIterations(), NOX::Solver::LineSearchBased::getPreviousSolutionGroup(), NOX::Solver::LineSearchBased::getStepSize(), and maxConvRate.
Referenced by compute().
Teuchos::RCP<NOX::GlobalData> NOX::Direction::Broyden::globalDataPtr [private] |
Global data pointer. Keep this so the parameter list remains valid.
Definition at line 374 of file NOX_Direction_Broyden.H.
Referenced by reset().
Teuchos::RCP<NOX::Utils> NOX::Direction::Broyden::utils [private] |
Printing Utils.
Definition at line 377 of file NOX_Direction_Broyden.H.
Referenced by compute(), reset(), and throwError().
Teuchos::ParameterList* NOX::Direction::Broyden::lsParamsPtr [private] |
"Linear Solver" sublist from "Direction"/"Broyden"
Definition at line 384 of file NOX_Direction_Broyden.H.
Teuchos::RCP<NOX::Abstract::Group> NOX::Direction::Broyden::oldJacobianGrpPtr [private] |
Group to hold the "old" Jacobian.
Definition at line 387 of file NOX_Direction_Broyden.H.
Referenced by compute().
int NOX::Direction::Broyden::cnt [private] |
Counter of how many times the Jacobian associated with oldJacobianGrpPtr has been used since its last update.
Definition at line 393 of file NOX_Direction_Broyden.H.
Referenced by compute(), and doRestart().
int NOX::Direction::Broyden::cntMax [private] |
Maximum number of times the Jacboian should be used between updates.
Definition at line 399 of file NOX_Direction_Broyden.H.
Referenced by doRestart(), and reset().
double NOX::Direction::Broyden::convRate [private] |
Last computed convergence rate.
Definition at line 402 of file NOX_Direction_Broyden.H.
Referenced by doRestart().
double NOX::Direction::Broyden::maxConvRate [private] |
Greatest allowable convergence rate before the Jacobian is recomputed.
Definition at line 405 of file NOX_Direction_Broyden.H.
Referenced by doRestart(), and reset().
int NOX::Direction::Broyden::memorySizeMax [private] |
Maximum memory size.
Definition at line 409 of file NOX_Direction_Broyden.H.
Referenced by reset().
BroydenMemory NOX::Direction::Broyden::memory [private] |
Storage of update vectors and related attributes.
Definition at line 412 of file NOX_Direction_Broyden.H.