ROL
ROL_TypeB_KelleySachsAlgorithm.hpp
Go to the documentation of this file.
1// @HEADER
2// ************************************************************************
3//
4// Rapid Optimization Library (ROL) Package
5// Copyright (2014) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact lead developers:
38// Drew Kouri (dpkouri@sandia.gov) and
39// Denis Ridzal (dridzal@sandia.gov)
40//
41// ************************************************************************
42// @HEADER
43
44#ifndef ROL_TYPEB_KELLEYSACHSALGORITHM_HPP
45#define ROL_TYPEB_KELLEYSACHSALGORITHM_HPP
46
52
57namespace ROL {
58namespace TypeB {
59
60template<typename Real>
62private:
63 Ptr<TrustRegionModel_U<Real>> model_;
64
65 // TRUST REGION PARAMETERS
66 Real delMax_;
67 Real eta0_;
68 Real eta1_;
69 Real eta2_;
70 Real gamma0_;
71 Real gamma1_;
72 Real gamma2_;
73 Real TRsafe_;
74 Real eps_;
75
76 // ITERATION FLAGS/INFORMATION
78 int SPflag_;
79 int SPiter_;
80
81 // SECANT INFORMATION
85
86 // TRUNCATED CG INFORMATION
87 int maxit_;
88 Real tol1_;
89 Real tol2_;
90
91 // ALGORITHM SPECIFIC PARAMETERS
92 int minit_;
93 Real mu0_;
94 Real mu1_;
95 Real eps0_;
96 Real beta_;
97 Real alpha0_;
98
99 mutable int nhess_;
100 unsigned verbosity_;
102
103 using TypeB::Algorithm<Real>::state_;
104 using TypeB::Algorithm<Real>::status_;
105 using TypeB::Algorithm<Real>::proj_;
106
107public:
108 KelleySachsAlgorithm(ParameterList &list, const Ptr<Secant<Real>> &secant = nullPtr);
109
110 using TypeB::Algorithm<Real>::run;
111 void run( Vector<Real> &x,
112 const Vector<Real> &g,
113 Objective<Real> &obj,
115 std::ostream &outStream = std::cout) override;
116
117 void run( Problem<Real> &problem,
118 std::ostream &outStream = std::cout ) override;
119
120 void run( Vector<Real> &x,
121 const Vector<Real> &g,
122 Objective<Real> &obj,
124 Constraint<Real> &linear_econ,
125 Vector<Real> &linear_emul,
126 const Vector<Real> &linear_eres,
127 std::ostream &outStream = std::cout ) override;
128
129 void writeHeader( std::ostream& os ) const override;
130
131 void writeName( std::ostream& os ) const override;
132
133 void writeOutput( std::ostream& os, bool write_header = false ) const override;
134
135private:
136 void initialize(Vector<Real> &x,
137 const Vector<Real> &g,
138 Objective<Real> &obj,
140 std::ostream &outStream = std::cout);
141
142 // Compute sigma such that ||x+sigma*p||_inv(M) = del. This is called
143 // if trpcg detects negative curvature or if the step violates
144 // the trust region bound
145 // xtx -- The dot product <x, inv(M)x> (unchanged)
146 // ptp -- The dot product <p, inv(M)p> (unchanged)
147 // ptx -- The dot product <p, inv(M)x> (unchanged)
148 // del -- Trust region radius (unchanged)
149 Real trqsol(const Real xtx, const Real ptp, const Real ptx, const Real del) const;
150
151 // Solve the trust region subproblem: minimize q(w) subject to the
152 // trust region constraint ||w||_inv(M) <= del using the Steihaug-Toint
153 // Conjugate Gradients algorithm
154 // w -- The step vector to be computed
155 // iflag -- Termination flag
156 // iter -- Number of CG iterations
157 // g -- Free components of gradient (unchanged)
158 // x -- Current iterate (unchanged)
159 // g0 -- Gradient (unchanged)
160 // del -- Trust region radius (unchanged)
161 // model -- Trust region model
162 // bnd -- Bound constraint used to remove active variables
163 // eps -- Epsilon binding set tolerance
164 // tol -- Residual stopping tolerance (unchanged)
165 // stol -- Preconditioned residual stopping tolerance (unchanged)
166 // itermax -- Maximum number of iterations
167 // p -- Primal working array that stores the CG step
168 // q -- Dual working array that stores the Hessian applied to p
169 // r -- Primal working array that stores the preconditioned residual
170 // t -- Dual working array that stores the residual
171 // pwa -- Primal working array that stores the pruned vector in hessVec
172 // dwa -- Dual working array that stores the pruned vector in precond
173 Real trpcg(Vector<Real> &w, int &iflag, int &iter,
174 const Vector<Real> &g, const Vector<Real> &x,
175 const Vector<Real> &g0,
176 const Real del, TrustRegionModel_U<Real> &model,
177 BoundConstraint<Real> &bnd, Real eps,
178 const Real tol, const int itermax,
181 std::ostream &outStream = std::cout) const;
182
184 const Vector<Real> &v,
185 const Vector<Real> &x,
186 const Vector<Real> &g,
187 Real eps,
190 Real &tol,
191 Vector<Real> &pwa,
192 Vector<Real> &dwa) const;
193
195 const Vector<Real> &v,
196 const Vector<Real> &x,
197 const Vector<Real> &g,
198 Real eps,
201 Real &tol,
202 Vector<Real> &pwa,
203 Vector<Real> &dwa) const;
204
205}; // class ROL::TypeB::KelleySachsAlgorithm
206
207} // namespace TypeB
208} // namespace ROL
209
211
212#endif
Provides the interface to apply upper and lower bound constraints.
Defines the general constraint operator interface.
Provides the interface to evaluate objective functions.
Provides interface for and implements limited-memory secant operators.
Provides the interface to evaluate trust-region model functions.
Provides an interface to run bound constrained optimization algorithms.
Ptr< PolyhedralProjection< Real > > proj_
const Ptr< AlgorithmState< Real > > state_
const Ptr< CombinedStatusTest< Real > > status_
Provides an interface to run the trust-region algorithm of Kelley and Sachs.
Real eta1_
Radius decrease threshold (default: 0.05)
Real gamma1_
Radius decrease rate (positive rho) (default: 0.25)
int minit_
Maximum number of minor (subproblem solve) iterations (default: 10)
Real eta2_
Radius increase threshold (default: 0.9)
Real eps0_
Epsilon binding set tolerance (default: 1e-3)
Real trqsol(const Real xtx, const Real ptp, const Real ptx, const Real del) const
Real eta0_
Step acceptance threshold (default: 0.05)
Real mu1_
Sufficient decrease parameter postsmoothing (default: 0.9999)
void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, std::ostream &outStream=std::cout) override
Run algorithm on bound constrained problems (Type-B). This general interface supports the use of dual...
unsigned verbosity_
Output level (default: 0)
int maxit_
Maximum number of CG iterations (default: 20)
Real alpha0_
Initial step size for projected search (default: 1)
Real tol2_
Relative tolerance for truncated CG (default: 1e-2)
Real mu0_
Sufficient decrease parameter (default: 1e-2)
void writeOutput(std::ostream &os, bool write_header=false) const override
Print iterate status.
KelleySachsAlgorithm(ParameterList &list, const Ptr< Secant< Real > > &secant=nullPtr)
bool writeHeader_
Flag to write header at every iteration.
Ptr< TrustRegionModel_U< Real > > model_
Container for trust-region model.
void applyFreePrecond(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, Real eps, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, Real &tol, Vector< Real > &pwa, Vector< Real > &dwa) const
TRUtils::ETRFlag TRflag_
Trust-region exit flag.
int SPflag_
Subproblem solver termination flag.
Real beta_
Projected search backtracking rate (default: 1e-2)
void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, std::ostream &outStream=std::cout)
Real gamma2_
Radius increase rate (default: 2.5)
Real delMax_
Maximum trust-region radius (default: ROL_INF)
ESecant esec_
Secant type (default: Limited-Memory BFGS)
void writeName(std::ostream &os) const override
Print step name.
int SPiter_
Subproblem solver iteration count.
Real eps_
Safeguard for numerically evaluating ratio.
Real tol1_
Absolute tolerance for truncated CG (default: 1e-4)
Real TRsafe_
Safeguard size for numerically evaluating ratio (default: 1e2)
void writeHeader(std::ostream &os) const override
Print iterate header.
int nhess_
Number of Hessian applications.
Real trpcg(Vector< Real > &w, int &iflag, int &iter, const Vector< Real > &g, const Vector< Real > &x, const Vector< Real > &g0, const Real del, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, Real eps, const Real tol, const int itermax, Vector< Real > &p, Vector< Real > &q, Vector< Real > &r, Vector< Real > &t, Vector< Real > &pwa, Vector< Real > &dwa, std::ostream &outStream=std::cout) const
Real gamma0_
Radius decrease rate (negative rho) (default: 0.0625)
void applyFreeHessian(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, Real eps, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, Real &tol, Vector< Real > &pwa, Vector< Real > &dwa) const
bool useSecantPrecond_
Flag to use secant as a preconditioner (default: false)
bool useSecantHessVec_
Flag to use secant as Hessian (default: false)
Defines the linear algebra or vector space interface.