/usr/include/trilinos/NOX_LineSearch_NonlinearCG.H is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | //@HEADER
// ************************************************************************
//
// NOX: An Object-Oriented Nonlinear Solver Package
// Copyright (2002) Sandia Corporation
//
// LOCA: Library of Continuation Algorithms Package
// Copyright (2005) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// Questions? Contact Roger Pawlowski (rppawlo@sandia.gov) or
// Eric Phipps (etphipp@sandia.gov), Sandia National Laboratories.
// ************************************************************************
// CVS Information
// $Source$
// $Author$
// $Date$
// $Revision$
// ************************************************************************
//@HEADER
#ifndef NOX_LINESEARCH_NONLINEARCG_H
#define NOX_LINESEARCH_NONLINEARCG_H
#include "NOX_LineSearch_Generic.H" // base class
#include "Teuchos_RCP.hpp"
// Forward declarations
namespace NOX {
class Utils;
namespace StatusTest {
class FiniteValue;
}
}
namespace NOX {
namespace LineSearch {
//! Use NonlinearCG linesearch
/*!
This is a simple linesearch intended to be used with
NOX::Direction::NonlinearCG, which provides search direction \f$
d \f$, in computing an update to the current solution vector \f$
x_{new} = x_{old} + \lambda d \f$. It is designed to compute a step
length \f$ \lambda \f$ 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, \f$ \lambda
\f$ is computed from a single evaluation of,
\f[
\lambda = - \frac{F(x_{old})^T d}{d^T J(x_{old})d}
\f]
where \f$ J \f$ is the n x n Jacobian matrix. Explicit construction of
\f$ J \f$ is avoided by performing the product \f$ Jd \f$ using a
directional derivative (cf NOX::Epetra::MatrixFree):
\f[
J(x_{old})d \approx \frac{F(x_{old} + \delta d) - F(x_{old})}{\delta}
\f]
where \f$ \delta = 10^{-6} (10^{-6} + ||x_{old}|| / ||d||) \f$ .
<b> Derivation / Theory: </b>
This linesearch is derived by attempting to achieve in a single step,
the following minimization:
\f[
\min_\lambda \phi(\lambda)\equiv\phi (x_{old}+ \lambda d)
\f]
where \f$ \phi \f$ is a merit function chosen (but never explicitly
given) so that an equivalence to %Linear CG holds, ie \f$ \nabla\phi(x)
\leftrightarrow F(x) \f$. The minimization above can now be cast as
an equation:
\f[
\phi ' (\lambda) = \nabla\phi (x_{old}+ \lambda d)^T d =
F(x_{old}+ \lambda d)^T d = 0~~.
\f]
An approximate solution to this equation can be obtained from a
second-order expansion of \f[ \phi(\lambda) \f],
\f[
\phi(\lambda)\approx\phi (0) + \phi ' (0)\lambda + \phi '' (0)
\frac{\lambda^2}{2}
\f]
from which it immediately follows
\f[
\%lambda_{min} \approx - \frac{\phi ' (0)}{\phi '' (0)} =
- \frac{F(x_{old})^T d}{d^T J(x_{old})d}
\f]
<b> Input Parameters </b>
The %NonlinearCG linesearch is selected using:
"Line Search"
<li> "Method" = "%NonlinearCG" [required]
Currently, no adjustable parameters exist for this linesarch.
<b>References</b>
<ul>
This linesearch is adapted from ideas presented in Section 14.2 of:
<li>Jonathan Richard Shewchuk,
<A HREF="http://www-2.cs.cmu.edu/~jrs/jrspapers.html"/> "An
Introduction to the Conjugate Gradient Method Without the Agonizing
Pain</A>," 1994.</li> Though presented within the context of nonlinear
optimization, the connection to solving nonlinear equation systems is
made via the equivalence \f$ f'(x) \leftrightarrow F(x) \f$.
\author Russ Hooper, Org. 9233, Sandia National Labs
*/
class NonlinearCG : public Generic {
public:
//! Constructor
NonlinearCG(const Teuchos::RCP<NOX::GlobalData>& gd,
Teuchos::ParameterList& params);
//! Destructor
~NonlinearCG();
// derived
bool reset(const Teuchos::RCP<NOX::GlobalData>& gd,
Teuchos::ParameterList& params);
// derived
bool compute(NOX::Abstract::Group& newgrp, double& step,
const NOX::Abstract::Vector& dir,
const NOX::Solver::Generic& s);
private:
//! Method for computing directional derivatives numerically
NOX::Abstract::Vector& computeDirectionalDerivative(
const Abstract::Vector& dir,
const Abstract::Group& grp);
//! Printing utilities
Teuchos::RCP<NOX::Utils> utils;
//! Temporary Vector pointer used to compute directional derivatives
Teuchos::RCP<NOX::Abstract::Vector> vecPtr;
//! Temporary Group pointer used to compute directional derivatives
Teuchos::RCP<NOX::Abstract::Group> grpPtr;
//! Utililty object to test for NaN or Inf values for computed steps
Teuchos::RCP<NOX::StatusTest::FiniteValue> finiteValueTester;
};
} // namespace LineSearch
} // namespace NOX
#endif
|