TrustRegionNewton.h
Go to the documentation of this file.
1/*!
2 *
3 *
4 * \brief Trust-Region Newton-Step Method
5 *
6 * \author O. Krause
7 * \date 2015
8 *
9 *
10 * \par Copyright 1995-2017 Shark Development Team
11 *
12 * <BR><HR>
13 * This file is part of Shark.
14 * <https://shark-ml.github.io/Shark/>
15 *
16 * Shark is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU Lesser General Public License as published
18 * by the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * Shark is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with Shark. If not, see <http://www.gnu.org/licenses/>.
28 *
29 */
30
31#ifndef ALGORITHMS_GRADIENTDESCENT_TRUST_REGION_NEWTON_H
32#define ALGORITHMS_GRADIENTDESCENT_TRUST_REGION_NEWTON_H
33
36
37namespace shark {
38
39/// \brief Simple Trust-Region method based on the full Hessian matrix
40///
41/// While normal Newton methods compute the Newton steps and perform a line-search
42/// In the Newton direction, trust region methods first choose a maximal step-length and
43/// then try to find an approximate best point of the second order tailor expansion in that
44/// region. more formally, we solve
45/// \f[ \min_{p} m(p) = p^T B p +g^Tp, ||p||<\delta \f]
46/// where \f$B\f$ is the Hessian and \f$g\f$ the gradient of the current point \f$x\f$.
47/// Given this step, we compute how much the model agrees with the actual function, i.e.
48/// \f[ \rho = \frac{ f(x+p)-f(p) }{m(p)} \f]
49/// If this value is large, that is, the improvement in function value is approximately as
50/// large or larger as the model predicted, we increase \f$\delta\f$ to make larger steps
51/// possible, otherwise we decrease it, if the model predicted a much larger improvement
52/// than observed - in the worst case, the new point is worse than the old one.
53///
54/// As a further check, to improve convergence, we do not accept every step, but those
55/// with \f$ \rho > c > 0 \f$. This ensures that we do not overjump the optimum too much
56/// and leads to a better (worst case) convergence rate.
57///
58/// The optimal step is computed by a conjugate gradient method that stops once a
59/// target tolerance is reached, or the step approaches the boundary (which happens,
60/// for example, when the Hessian is indefinite or rank-deficient). Thus, computation
61/// time is not wasted for steps that are far away from the optimum. The tolerance
62/// is set by a forcing-schedule so that accuracy increases in the vicinity of the
63/// optimum, enabling solutions with arbitrary precision.
64///
65/// The algorithm is based on
66/// Jorge Nocedal, Stephen J. Wright
67/// Numerical Optimization, 2nd Edition
68/// Algorithm 4.1 with Algorithm 7.2 to solve the sub-problem
69/// \ingroup gradientopt
71{
72public:
73 /// \brief Default constructor.
75
76 /// \brief Initialize the iterative optimizer with a problem (objective function) and a starting point.
77 ///
78 /// The initial trust region radius is set to 0.1
79 void init(ObjectiveFunctionType& objectiveFunction, SearchPointType const& startingPoint){
80 init(objectiveFunction,startingPoint,0.1);
81 }
82 /// \brief Initialize the iterative optimizer with a problem (objective function), a starting point and an initial value for the trust-region
83 SHARK_EXPORT_SYMBOL void init(ObjectiveFunctionType const& objectiveFunction, SearchPointType const& startingPoint,double initialDelta);
85
86 /// \brief From INameable: return the class name.
87 std::string name() const
88 { return "TrustRegionNewton"; }
89
90 /// \brief Minimal improvement ratio (see the algorithm details in the class description).
91 double minImprovementRatio()const{
93 }
94
95 /// \brief Minimal improvement ratio (see the algorithm details in the class description).
98 }
99
100 /// \brief Perform one trust region Newton step, update point and trust region radius.
101 SHARK_EXPORT_SYMBOL void step(ObjectiveFunctionType const& objectiveFunction);
102
103protected:
104 double m_delta; ///< Current trust region size
105 double m_minImprovementRatio; ///< Minimal improvement ratio (see the algorithm details in the class description).
106 ObjectiveFunctionType::SecondOrderDerivative m_derivatives; ///< First and second derivative of the objective function in the current point.
107};
108}
109#endif