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_;
92 int maxNM_;
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_;
108
109 // Inexactness Parameters
110 std::vector<bool> useInexact_;
113 Real scale_;
114 Real omega_;
115 Real force_;
118
119 mutable int nhess_;
120 unsigned verbosity_;
122
123 using TypeB::Algorithm<Real>::state_;
124 using TypeB::Algorithm<Real>::status_;
125 using TypeB::Algorithm<Real>::proj_;
126
127public:
128 TrustRegionSPGAlgorithm(ParameterList &list, const Ptr<Secant<Real>> &secant = nullPtr);
129
130 using TypeB::Algorithm<Real>::run;
131 void run( Vector<Real> &x,
132 const Vector<Real> &g,
133 Objective<Real> &obj,
135 std::ostream &outStream = std::cout) override;
136
137 void writeHeader( std::ostream& os ) const override;
138
139 void writeName( std::ostream& os ) const override;
140
141 void writeOutput( std::ostream& os, bool write_header = false ) const override;
142
143private:
144 void initialize(Vector<Real> &x,
145 const Vector<Real> &g,
146 Real ftol,
147 Objective<Real> &obj,
149 std::ostream &outStream = std::cout);
150
151 Real computeValue(Real inTol,
152 Real &outTol,
153 Real pRed,
154 Real &fold,
155 int iter,
156 const Vector<Real> &x,
157 const Vector<Real> &xold,
158 Objective<Real> &obj);
159
160 Real computeGradient(const Vector<Real> &x,
161 Vector<Real> &g,
162 Vector<Real> &pwa,
163 Real del,
164 Objective<Real> &obj,
165 std::ostream &outStream = std::cout) const;
166
167 // Compute the projected step s = P(x + alpha*w) - x
168 // Returns the norm of the projected step s
169 // s -- The projected step upon return
170 // w -- The direction vector w (unchanged)
171 // x -- The anchor vector x (unchanged)
172 // alpha -- The step size (unchanged)
173 Real dgpstep(Vector<Real> &s, const Vector<Real> &w,
174 const Vector<Real> &x, const Real alpha,
175 std::ostream &outStream = std::cout) const;
176
177 // Compute Cauchy point, i.e., the minimizer of q(P(x - alpha*g)-x)
178 // subject to the trust region constraint ||P(x - alpha*g)-x|| <= del
179 // s -- The Cauchy step upon return: Primal optimization space vector
180 // alpha -- The step length for the Cauchy point upon return
181 // x -- The anchor vector x (unchanged): Primal optimization space vector
182 // g -- The (dual) gradient vector g (unchanged): Primal optimization space vector
183 // del -- The trust region radius (unchanged)
184 // model -- Trust region model
185 // dwa -- Dual working array, stores Hessian applied to step
186 // dwa1 -- Dual working array
187 Real dcauchy(Vector<Real> &s, Real &alpha, Real &q,
188 const Vector<Real> &x, const Vector<Real> &g,
189 const Real del, TrustRegionModel_U<Real> &model,
190 Vector<Real> &dwa, Vector<Real> &dwa1,
191 std::ostream &outStream = std::cout);
192
193 void dpsg(Vector<Real> &y, Real &q, Vector<Real> &gmod, const Vector<Real> &x,
194 Real del, TrustRegionModel_U<Real> &model, Vector<Real> &ymin,
195 Vector<Real> &pwa, Vector<Real> &pwa1, Vector<Real> &pwa2,
196 Vector<Real> &pwa3, Vector<Real> &pwa4, Vector<Real> &pwa5,
197 Vector<Real> &dwa, std::ostream &outStream = std::cout);
198
199 void dproj(Vector<Real> &x, const Vector<Real> &x0, Real del,
201 Vector<Real> &pwa, std::ostream &outStream = std::cout) const;
202
203}; // class ROL::TypeB::TrustRegionSPGAlgorithm
204
205} // namespace TypeB
206} // namespace ROL
207
209
210#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)
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.
TrustRegionSPGAlgorithm(ParameterList &list, const Ptr< Secant< Real > > &secant=nullPtr)
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