ROL
ROL_TypeB_TrustRegionSPGAlgorithm.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Rapid Optimization Library (ROL) Package
4//
5// Copyright 2014 NTESS and the ROL contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef ROL_TYPEB_TRUSTREGIONSPGALGORITHM_HPP
11#define ROL_TYPEB_TRUSTREGIONSPGALGORITHM_HPP
12
16
21namespace ROL {
22namespace TypeB {
23
24template<typename Real>
26private:
27 Ptr<TrustRegionModel_U<Real>> model_;
28
29 // TRUST REGION PARAMETERS
30 Real delMax_;
31 Real eta0_;
32 Real eta1_;
33 Real eta2_;
34 Real gamma0_;
35 Real gamma1_;
36 Real gamma2_;
37 Real TRsafe_;
38 Real eps_;
40
41 // ITERATION FLAGS/INFORMATION
43 int SPflag_;
44 int SPiter_;
45
46 // SECANT INFORMATION
50
51 // TRUNCATED CG INFORMATION
52 Real tol1_;
53 Real tol2_;
54 int maxit_;
55
56 // ALGORITHM SPECIFIC PARAMETERS
57 bool useNM_;
59 Real mu0_;
60 Real spexp_;
61 int redlim_;
62 int explim_;
63 Real alpha_;
65 Real interpf_;
66 Real extrapf_;
67 Real qtol_;
70 Real gamma_;
72 bool useMin_;
75
76 // Inexactness Parameters
77 std::vector<bool> useInexact_;
78 Real scale0_;
79 Real scale1_;
80 Real scale_;
81 Real omega_;
82 Real force_;
85 Real gtol_;
86
87 mutable int nhess_;
88 unsigned verbosity_;
90
91 using TypeB::Algorithm<Real>::state_;
92 using TypeB::Algorithm<Real>::status_;
93 using TypeB::Algorithm<Real>::proj_;
94
95public:
96 TrustRegionSPGAlgorithm(ParameterList &list, const Ptr<Secant<Real>> &secant = nullPtr);
97
98 using TypeB::Algorithm<Real>::run;
99 void run( Vector<Real> &x,
100 const Vector<Real> &g,
101 Objective<Real> &obj,
103 std::ostream &outStream = std::cout) override;
104
105 void writeHeader( std::ostream& os ) const override;
106
107 void writeName( std::ostream& os ) const override;
108
109 void writeOutput( std::ostream& os, const bool write_header = false ) const override;
110
111private:
112 void initialize(Vector<Real> &x,
113 const Vector<Real> &g,
114 Real ftol,
115 Objective<Real> &obj,
117 std::ostream &outStream = std::cout);
118
119 Real computeValue(Real inTol,
120 Real &outTol,
121 Real pRed,
122 Real &fold,
123 int iter,
124 const Vector<Real> &x,
125 const Vector<Real> &xold,
126 Objective<Real> &obj);
127
128 void computeGradient(const Vector<Real> &x,
129 Vector<Real> &g,
130 Vector<Real> &pwa,
131 Real del,
132 Objective<Real> &obj,
133 bool accept,
134 Real &gtol,
135 Real &gnorm,
136 std::ostream &outStream = std::cout) const;
137
138 // Compute the projected step s = P(x + alpha*w) - x
139 // Returns the norm of the projected step s
140 // s -- The projected step upon return
141 // w -- The direction vector w (unchanged)
142 // x -- The anchor vector x (unchanged)
143 // alpha -- The step size (unchanged)
144 Real dgpstep(Vector<Real> &s, const Vector<Real> &w,
145 const Vector<Real> &x, const Real alpha,
146 std::ostream &outStream = std::cout) const;
147
148 // Compute Cauchy point, i.e., the minimizer of q(P(x - alpha*g)-x)
149 // subject to the trust region constraint ||P(x - alpha*g)-x|| <= del
150 // s -- The Cauchy step upon return: Primal optimization space vector
151 // alpha -- The step length for the Cauchy point upon return
152 // x -- The anchor vector x (unchanged): Primal optimization space vector
153 // g -- The (dual) gradient vector g (unchanged): Primal optimization space vector
154 // del -- The trust region radius (unchanged)
155 // model -- Trust region model
156 // dwa -- Dual working array, stores Hessian applied to step
157 // dwa1 -- Dual working array
158 Real dcauchy(Vector<Real> &s, Real &alpha, Real &q,
159 const Vector<Real> &x, const Vector<Real> &g,
160 const Real del, TrustRegionModel_U<Real> &model,
161 Vector<Real> &dwa, Vector<Real> &dwa1,
162 std::ostream &outStream = std::cout);
163
164 void dpsg_simple(Vector<Real> &y, Real &q, Vector<Real> &gmod, const Vector<Real> &x,
165 Real del, TrustRegionModel_U<Real> &model, Vector<Real> &pwa,
166 Vector<Real> &pwa1, Vector<Real> &dwa, std::ostream &outStream = std::cout);
167
168 void dpsg(Vector<Real> &y, Real &q, Vector<Real> &gmod, const Vector<Real> &x,
169 Real del, TrustRegionModel_U<Real> &model, Vector<Real> &ymin,
170 Vector<Real> &pwa, Vector<Real> &pwa1, Vector<Real> &pwa2,
171 Vector<Real> &pwa3, Vector<Real> &pwa4, Vector<Real> &pwa5,
172 Vector<Real> &dwa, std::ostream &outStream = std::cout);
173
174 void dproj(Vector<Real> &x, const Vector<Real> &x0, Real del,
176 Vector<Real> &pwa, std::ostream &outStream = std::cout) const;
177
178}; // class ROL::TypeB::TrustRegionSPGAlgorithm
179
180} // namespace TypeB
181} // namespace ROL
182
184
185#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.
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 computeGradient(const Vector< Real > &x, Vector< Real > &g, Vector< Real > &pwa, Real del, Objective< Real > &obj, bool accept, Real &gtol, Real &gnorm, std::ostream &outStream=std::cout) const
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)
bool useSecantPrecond_
Flag to use secant as a preconditioner (default: false)
void writeOutput(std::ostream &os, const bool write_header=false) const override
Print iterate status.
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 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.