ROL
ROL_TypeB_KelleySachsAlgorithm.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_KELLEYSACHSALGORITHM_HPP
11#define ROL_TYPEB_KELLEYSACHSALGORITHM_HPP
12
18
23namespace ROL {
24namespace TypeB {
25
26template<typename Real>
28private:
29 Ptr<TrustRegionModel_U<Real>> model_;
30
31 // TRUST REGION PARAMETERS
32 Real delMax_;
33 Real eta0_;
34 Real eta1_;
35 Real eta2_;
36 Real gamma0_;
37 Real gamma1_;
38 Real gamma2_;
39 Real TRsafe_;
40 Real eps_;
41
42 // ITERATION FLAGS/INFORMATION
44 int SPflag_;
45 int SPiter_;
46
47 // SECANT INFORMATION
51
52 // TRUNCATED CG INFORMATION
53 int maxit_;
54 Real tol1_;
55 Real tol2_;
56
57 // ALGORITHM SPECIFIC PARAMETERS
58 int minit_;
59 Real mu0_;
60 Real mu1_;
61 Real eps0_;
62 Real beta_;
63 Real alpha0_;
64
65 mutable int nhess_;
66 unsigned verbosity_;
68
69 using TypeB::Algorithm<Real>::state_;
70 using TypeB::Algorithm<Real>::status_;
71 using TypeB::Algorithm<Real>::proj_;
72
73public:
74 KelleySachsAlgorithm(ParameterList &list, const Ptr<Secant<Real>> &secant = nullPtr);
75
76 using TypeB::Algorithm<Real>::run;
77 void run( Vector<Real> &x,
78 const Vector<Real> &g,
79 Objective<Real> &obj,
81 std::ostream &outStream = std::cout) override;
82
83 void run( Problem<Real> &problem,
84 std::ostream &outStream = std::cout ) override;
85
86 void run( Vector<Real> &x,
87 const Vector<Real> &g,
88 Objective<Real> &obj,
90 Constraint<Real> &linear_econ,
91 Vector<Real> &linear_emul,
92 const Vector<Real> &linear_eres,
93 std::ostream &outStream = std::cout ) override;
94
95 void writeHeader( std::ostream& os ) const override;
96
97 void writeName( std::ostream& os ) const override;
98
99 void writeOutput( std::ostream& os, const bool write_header = false ) const override;
100
101private:
102 void initialize(Vector<Real> &x,
103 const Vector<Real> &g,
104 Objective<Real> &obj,
106 std::ostream &outStream = std::cout);
107
108 // Compute sigma such that ||x+sigma*p||_inv(M) = del. This is called
109 // if trpcg detects negative curvature or if the step violates
110 // the trust region bound
111 // xtx -- The dot product <x, inv(M)x> (unchanged)
112 // ptp -- The dot product <p, inv(M)p> (unchanged)
113 // ptx -- The dot product <p, inv(M)x> (unchanged)
114 // del -- Trust region radius (unchanged)
115 Real trqsol(const Real xtx, const Real ptp, const Real ptx, const Real del) const;
116
117 // Solve the trust region subproblem: minimize q(w) subject to the
118 // trust region constraint ||w||_inv(M) <= del using the Steihaug-Toint
119 // Conjugate Gradients algorithm
120 // w -- The step vector to be computed
121 // iflag -- Termination flag
122 // iter -- Number of CG iterations
123 // g -- Free components of gradient (unchanged)
124 // x -- Current iterate (unchanged)
125 // g0 -- Gradient (unchanged)
126 // del -- Trust region radius (unchanged)
127 // model -- Trust region model
128 // bnd -- Bound constraint used to remove active variables
129 // eps -- Epsilon binding set tolerance
130 // tol -- Residual stopping tolerance (unchanged)
131 // stol -- Preconditioned residual stopping tolerance (unchanged)
132 // itermax -- Maximum number of iterations
133 // p -- Primal working array that stores the CG step
134 // q -- Dual working array that stores the Hessian applied to p
135 // r -- Primal working array that stores the preconditioned residual
136 // t -- Dual working array that stores the residual
137 // pwa -- Primal working array that stores the pruned vector in hessVec
138 // dwa -- Dual working array that stores the pruned vector in precond
139 Real trpcg(Vector<Real> &w, int &iflag, int &iter,
140 const Vector<Real> &g, const Vector<Real> &x,
141 const Vector<Real> &g0,
142 const Real del, TrustRegionModel_U<Real> &model,
143 BoundConstraint<Real> &bnd, Real eps,
144 const Real tol, const int itermax,
147 std::ostream &outStream = std::cout) const;
148
150 const Vector<Real> &v,
151 const Vector<Real> &x,
152 const Vector<Real> &g,
153 Real eps,
156 Real &tol,
157 Vector<Real> &pwa,
158 Vector<Real> &dwa) const;
159
161 const Vector<Real> &v,
162 const Vector<Real> &x,
163 const Vector<Real> &g,
164 Real eps,
167 Real &tol,
168 Vector<Real> &pwa,
169 Vector<Real> &dwa) const;
170
171}; // class ROL::TypeB::KelleySachsAlgorithm
172
173} // namespace TypeB
174} // namespace ROL
175
177
178#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)
void writeOutput(std::ostream &os, const bool write_header=false) const override
Print iterate status.
Real mu0_
Sufficient decrease parameter (default: 1e-2)
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.