ROL
ROL_TypeB_TrustRegionSPGAlgorithm.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_TRUSTREGIONSPGALGORITHM_HPP
45#define ROL_TYPEB_TRUSTREGIONSPGALGORITHM_HPP
46
50
55namespace ROL {
56namespace TypeB {
57
58template<typename Real>
60private:
61 Ptr<TrustRegionModel_U<Real>> model_;
62
63 // TRUST REGION PARAMETERS
64 Real delMax_;
65 Real eta0_;
66 Real eta1_;
67 Real eta2_;
68 Real gamma0_;
69 Real gamma1_;
70 Real gamma2_;
71 Real TRsafe_;
72 Real eps_;
74
75 // ITERATION FLAGS/INFORMATION
77 int SPflag_;
78 int SPiter_;
79
80 // SECANT INFORMATION
84
85 // TRUNCATED CG INFORMATION
86 Real tol1_;
87 Real tol2_;
88 int maxit_;
89
90 // ALGORITHM SPECIFIC PARAMETERS
91 bool useNM_;
93 Real mu0_;
94 Real spexp_;
95 int redlim_;
96 int explim_;
97 Real alpha_;
99 Real interpf_;
100 Real extrapf_;
101 Real qtol_;
104 Real gamma_;
109
110 // Inexactness Parameters
111 std::vector<bool> useInexact_;
114 Real scale_;
115 Real omega_;
116 Real force_;
119
120 mutable int nhess_;
121 unsigned verbosity_;
123
124 using TypeB::Algorithm<Real>::state_;
125 using TypeB::Algorithm<Real>::status_;
126 using TypeB::Algorithm<Real>::proj_;
127
128public:
129 TrustRegionSPGAlgorithm(ParameterList &list, const Ptr<Secant<Real>> &secant = nullPtr);
130
131 using TypeB::Algorithm<Real>::run;
132 void run( Vector<Real> &x,
133 const Vector<Real> &g,
134 Objective<Real> &obj,
136 std::ostream &outStream = std::cout) override;
137
138 void writeHeader( std::ostream& os ) const override;
139
140 void writeName( std::ostream& os ) const override;
141
142 void writeOutput( std::ostream& os, bool write_header = false ) const override;
143
144private:
145 void initialize(Vector<Real> &x,
146 const Vector<Real> &g,
147 Real ftol,
148 Objective<Real> &obj,
150 std::ostream &outStream = std::cout);
151
152 Real computeValue(Real inTol,
153 Real &outTol,
154 Real pRed,
155 Real &fold,
156 int iter,
157 const Vector<Real> &x,
158 const Vector<Real> &xold,
159 Objective<Real> &obj);
160
161 Real computeGradient(const Vector<Real> &x,
162 Vector<Real> &g,
163 Vector<Real> &pwa,
164 Real del,
165 Objective<Real> &obj,
166 std::ostream &outStream = std::cout) const;
167
168 // Compute the projected step s = P(x + alpha*w) - x
169 // Returns the norm of the projected step s
170 // s -- The projected step upon return
171 // w -- The direction vector w (unchanged)
172 // x -- The anchor vector x (unchanged)
173 // alpha -- The step size (unchanged)
174 Real dgpstep(Vector<Real> &s, const Vector<Real> &w,
175 const Vector<Real> &x, const Real alpha,
176 std::ostream &outStream = std::cout) const;
177
178 // Compute Cauchy point, i.e., the minimizer of q(P(x - alpha*g)-x)
179 // subject to the trust region constraint ||P(x - alpha*g)-x|| <= del
180 // s -- The Cauchy step upon return: Primal optimization space vector
181 // alpha -- The step length for the Cauchy point upon return
182 // x -- The anchor vector x (unchanged): Primal optimization space vector
183 // g -- The (dual) gradient vector g (unchanged): Primal optimization space vector
184 // del -- The trust region radius (unchanged)
185 // model -- Trust region model
186 // dwa -- Dual working array, stores Hessian applied to step
187 // dwa1 -- Dual working array
188 Real dcauchy(Vector<Real> &s, Real &alpha, Real &q,
189 const Vector<Real> &x, const Vector<Real> &g,
190 const Real del, TrustRegionModel_U<Real> &model,
191 Vector<Real> &dwa, Vector<Real> &dwa1,
192 std::ostream &outStream = std::cout);
193
194 void dpsg_simple(Vector<Real> &y, Real &q, Vector<Real> &gmod, const Vector<Real> &x,
195 Real del, TrustRegionModel_U<Real> &model, Vector<Real> &pwa,
196 Vector<Real> &pwa1, Vector<Real> &dwa, std::ostream &outStream = std::cout);
197
198 void dpsg(Vector<Real> &y, Real &q, Vector<Real> &gmod, const Vector<Real> &x,
199 Real del, TrustRegionModel_U<Real> &model, Vector<Real> &ymin,
200 Vector<Real> &pwa, Vector<Real> &pwa1, Vector<Real> &pwa2,
201 Vector<Real> &pwa3, Vector<Real> &pwa4, Vector<Real> &pwa5,
202 Vector<Real> &dwa, std::ostream &outStream = std::cout);
203
204 void dproj(Vector<Real> &x, const Vector<Real> &x0, Real del,
206 Vector<Real> &pwa, std::ostream &outStream = std::cout) const;
207
208}; // class ROL::TypeB::TrustRegionSPGAlgorithm
209
210} // namespace TypeB
211} // namespace ROL
212
214
215#endif
Provides the interface to apply upper and lower bound constraints.
Provides the interface to evaluate objective functions.
Provides interface for and implements limited-memory secant operators.
Definition: ROL_Secant.hpp:79
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.
Real gamma0_
Radius decrease rate (negative rho) (default: 0.0625)
Real computeValue(Real inTol, Real &outTol, Real pRed, Real &fold, int iter, const Vector< Real > &x, const Vector< Real > &xold, Objective< Real > &obj)
void initialize(Vector< Real > &x, const Vector< Real > &g, Real ftol, Objective< Real > &obj, BoundConstraint< Real > &bnd, std::ostream &outStream=std::cout)
int explim_
Maximum number of Cauchy point expansion steps (default: 10)
ESecant esec_
Secant type (default: Limited-Memory BFGS)
int SPflag_
Subproblem solver termination flag.
bool writeHeader_
Flag to write header at every iteration.
bool useSecantHessVec_
Flag to use secant as Hessian (default: false)
Real tol1_
Absolute tolerance for truncated CG (default: 1e-4)
bool interpRad_
Interpolate the trust-region radius if ratio is negative (default: false)
Real dcauchy(Vector< Real > &s, Real &alpha, Real &q, const Vector< Real > &x, const Vector< Real > &g, const Real del, TrustRegionModel_U< Real > &model, Vector< Real > &dwa, Vector< Real > &dwa1, std::ostream &outStream=std::cout)
void dpsg_simple(Vector< Real > &y, Real &q, Vector< Real > &gmod, const Vector< Real > &x, Real del, TrustRegionModel_U< Real > &model, Vector< Real > &pwa, Vector< Real > &pwa1, Vector< Real > &dwa, std::ostream &outStream=std::cout)
int maxit_
Maximum number of CG iterations (default: 25)
Real eps_
Safeguard for numerically evaluating ratio.
Real eta0_
Step acceptance threshold (default: 0.05)
TRUtils::ETRFlag TRflag_
Trust-region exit flag.
void dpsg(Vector< Real > &y, Real &q, Vector< Real > &gmod, const Vector< Real > &x, Real del, TrustRegionModel_U< Real > &model, Vector< Real > &ymin, Vector< Real > &pwa, Vector< Real > &pwa1, Vector< Real > &pwa2, Vector< Real > &pwa3, Vector< Real > &pwa4, Vector< Real > &pwa5, Vector< Real > &dwa, std::ostream &outStream=std::cout)
Real computeGradient(const Vector< Real > &x, Vector< Real > &g, Vector< Real > &pwa, Real del, Objective< Real > &obj, std::ostream &outStream=std::cout) const
bool useSecantPrecond_
Flag to use secant as a preconditioner (default: false)
Real spexp_
Relative tolerance exponent for subproblem solve (default: 1, range: [1,2])
Real eta2_
Radius increase threshold (default: 0.9)
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...
Real gamma2_
Radius increase rate (default: 2.5)
Real extrapf_
Extrapolation rate for Cauchy point computation (default: 1e1)
Real alpha_
Initial Cauchy point step length (default: 1.0)
int redlim_
Maximum number of Cauchy point reduction steps (default: 10)
Real TRsafe_
Safeguard size for numerically evaluating ratio (default: 1e2)
int SPiter_
Subproblem solver iteration count.
Real eta1_
Radius decrease threshold (default: 0.05)
void writeOutput(std::ostream &os, bool write_header=false) const override
Print iterate status.
void writeName(std::ostream &os) const override
Print step name.
void writeHeader(std::ostream &os) const override
Print iterate header.
bool normAlpha_
Normalize initial Cauchy point step length (default: false)
Real interpf_
Backtracking rate for Cauchy point computation (default: 1e-1)
void dproj(Vector< Real > &x, const Vector< Real > &x0, Real del, Vector< Real > &y0, Vector< Real > &y1, Vector< Real > &yc, Vector< Real > &pwa, std::ostream &outStream=std::cout) const
Real tol2_
Relative tolerance for truncated CG (default: 1e-2)
Real delMax_
Maximum trust-region radius (default: ROL_INF)
Real qtol_
Relative tolerance for computed decrease in Cauchy point computation (default: 1-8)
Real gamma1_
Radius decrease rate (positive rho) (default: 0.25)
Ptr< TrustRegionModel_U< Real > > model_
Container for trust-region model.
Real dgpstep(Vector< Real > &s, const Vector< Real > &w, const Vector< Real > &x, const Real alpha, std::ostream &outStream=std::cout) const
Real mu0_
Sufficient decrease parameter (default: 1e-2)
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:84