#include <NOX_MeritFunction_SumOfSquares.H>
Public Member Functions | |
SumOfSquares (const Teuchos::RCP< NOX::Utils > &u) | |
Constructor. | |
virtual | ~SumOfSquares () |
Destructor. | |
virtual double | computef (const NOX::Abstract::Group &grp) const |
Computes the merit function, ![]() | |
virtual void | computeGradient (const NOX::Abstract::Group &group, NOX::Abstract::Vector &result) const |
Computes the gradient, ![]() | |
virtual double | computeSlope (const NOX::Abstract::Vector &dir, const NOX::Abstract::Group &grp) const |
Computes the slope, ![]() | |
virtual double | computeQuadraticModel (const NOX::Abstract::Vector &dir, const NOX::Abstract::Group &grp) const |
Computes the quadratic model, ![]() | |
virtual void | computeQuadraticMinimizer (const NOX::Abstract::Group &grp, NOX::Abstract::Vector &result) const |
Computes the vector in the steepest descent direction that minimizes, the quadratic model. | |
virtual const string & | name () const |
Returns the name of the merit function. | |
Private Member Functions | |
SumOfSquares () | |
Disallow default ctor. | |
virtual double | computeSlopeWithoutJacobian (const NOX::Abstract::Vector &dir, const NOX::Abstract::Group &grp) const |
This is a variant of the computeSlope() method above optimized to work with out having to compute an explicit Jacobian. | |
Private Attributes | |
Teuchos::RCP< Utils > | utils |
Printing utilities. | |
Teuchos::RCP < NOX::Abstract::Vector > | tmpVecPtr |
Temporary vector for computations. | |
Teuchos::RCP < NOX::Abstract::Group > | tmpGrpPtr |
Temporary vector for computations. | |
string | meritFunctionName |
Name of this function. |
A basic merit function used in many nonlinear equation solvers:
Where the norm is the 2-Norm using the NOX::Abstract::Vector's inner product.
This is the default merit function used in nox.
This merit function is taken from: J. E. Dennis Jr. and Robert B. Schnabel, "Numerical Methods for Unconstrained Optimization and Nonlinear Equations," Prentice Hall, 1983
Definition at line 72 of file NOX_MeritFunction_SumOfSquares.H.
NOX::MeritFunction::SumOfSquares::SumOfSquares | ( | const Teuchos::RCP< NOX::Utils > & | u | ) |
NOX::MeritFunction::SumOfSquares::~SumOfSquares | ( | ) | [virtual] |
NOX::MeritFunction::SumOfSquares::SumOfSquares | ( | ) | [inline, private] |
double NOX::MeritFunction::SumOfSquares::computef | ( | const NOX::Abstract::Group & | grp | ) | const [virtual] |
Computes the merit function, .
Implements NOX::MeritFunction::Generic.
Definition at line 59 of file NOX_MeritFunction_SumOfSquares.C.
References NOX::Abstract::Group::getNormF(), NOX::Abstract::Group::isF(), and utils.
Referenced by computeQuadraticModel().
void NOX::MeritFunction::SumOfSquares::computeGradient | ( | const NOX::Abstract::Group & | group, | |
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
Computes the gradient, .
Implements NOX::MeritFunction::Generic.
Definition at line 74 of file NOX_MeritFunction_SumOfSquares.C.
References NOX::Abstract::Group::applyJacobianTranspose(), NOX::Abstract::Group::getF(), NOX::Abstract::Group::isF(), NOX::Abstract::Group::isJacobian(), NOX::Abstract::Group::Ok, and utils.
Referenced by computeQuadraticMinimizer(), and computeSlope().
double NOX::MeritFunction::SumOfSquares::computeSlope | ( | const NOX::Abstract::Vector & | dir, | |
const NOX::Abstract::Group & | grp | |||
) | const [virtual] |
Computes the slope, .
If the Jacobian is not computed in the grp
object, then the slope can be approximated using directional derivatives. More information can be found in the method computeSlopeWithoutJac.
Implements NOX::MeritFunction::Generic.
Definition at line 108 of file NOX_MeritFunction_SumOfSquares.C.
References NOX::Abstract::Vector::clone(), computeGradient(), computeSlopeWithoutJacobian(), NOX::Abstract::Group::getF(), NOX::Abstract::Vector::innerProduct(), NOX::Abstract::Group::isJacobian(), and tmpVecPtr.
Referenced by computeQuadraticModel().
double NOX::MeritFunction::SumOfSquares::computeQuadraticModel | ( | const NOX::Abstract::Vector & | dir, | |
const NOX::Abstract::Group & | grp | |||
) | const [virtual] |
Computes the quadratic model, .
We approximate :
Implements NOX::MeritFunction::Generic.
Definition at line 125 of file NOX_MeritFunction_SumOfSquares.C.
References NOX::Abstract::Group::applyJacobian(), NOX::Abstract::Vector::clone(), computef(), computeSlope(), NOX::Abstract::Group::getF(), and tmpVecPtr.
void NOX::MeritFunction::SumOfSquares::computeQuadraticMinimizer | ( | const NOX::Abstract::Group & | grp, | |
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
Computes the vector in the steepest descent direction that minimizes, the quadratic model.
Computes the vector result:
Implements NOX::MeritFunction::Generic.
Definition at line 183 of file NOX_MeritFunction_SumOfSquares.C.
References NOX::Abstract::Group::applyJacobian(), NOX::Abstract::Vector::clone(), computeGradient(), NOX::Abstract::Group::getF(), NOX::Abstract::Vector::innerProduct(), NOX::Abstract::Group::isF(), NOX::Abstract::Group::isJacobian(), NOX::Abstract::Group::Ok, NOX::Abstract::Vector::scale(), NOX::ShapeCopy, tmpVecPtr, and utils.
const string & NOX::MeritFunction::SumOfSquares::name | ( | ) | const [virtual] |
Returns the name of the merit function.
Implements NOX::MeritFunction::Generic.
Definition at line 230 of file NOX_MeritFunction_SumOfSquares.C.
References meritFunctionName.
double NOX::MeritFunction::SumOfSquares::computeSlopeWithoutJacobian | ( | const NOX::Abstract::Vector & | dir, | |
const NOX::Abstract::Group & | grp | |||
) | const [private, virtual] |
This is a variant of the computeSlope() method above optimized to work with out having to compute an explicit Jacobian.
Calculates and returns
Here represents the input parameter
dir
is the gradient associated with the given group (for nonlinear solves this equates to
where
is the Jacobian and
is the original nonlinear function).
We can rewrite this equation as:
which allows us to use directional derivatives to estimate :
This may allow for faster computations of the slope if the Jacobian is expensive to evaluate.
where is a scalar perturbation calculated by:
is a constant fixed at 1.0e-6.
Definition at line 145 of file NOX_MeritFunction_SumOfSquares.C.
References NOX::Abstract::Group::clone(), NOX::Abstract::Vector::clone(), NOX::Abstract::Group::getF(), NOX::Abstract::Group::getX(), NOX::Abstract::Vector::norm(), NOX::ShapeCopy, tmpGrpPtr, and tmpVecPtr.
Referenced by computeSlope().
Teuchos::RCP<Utils> NOX::MeritFunction::SumOfSquares::utils [private] |
Printing utilities.
Definition at line 162 of file NOX_MeritFunction_SumOfSquares.H.
Referenced by computef(), computeGradient(), computeQuadraticMinimizer(), and SumOfSquares().
Teuchos::RCP<NOX::Abstract::Vector> NOX::MeritFunction::SumOfSquares::tmpVecPtr [mutable, private] |
Temporary vector for computations.
Definition at line 165 of file NOX_MeritFunction_SumOfSquares.H.
Referenced by computeQuadraticMinimizer(), computeQuadraticModel(), computeSlope(), and computeSlopeWithoutJacobian().
Teuchos::RCP<NOX::Abstract::Group> NOX::MeritFunction::SumOfSquares::tmpGrpPtr [mutable, private] |
Temporary vector for computations.
Only allocated if the method computeJacobianWithOutJac is called.
Definition at line 169 of file NOX_MeritFunction_SumOfSquares.H.
Referenced by computeSlopeWithoutJacobian().
string NOX::MeritFunction::SumOfSquares::meritFunctionName [private] |
Name of this function.
Definition at line 172 of file NOX_MeritFunction_SumOfSquares.H.
Referenced by name().