ROL
ROL_TypeB_ColemanLiAlgorithm.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_COLEMANLIALGORITHM_HPP
45#define ROL_TYPEB_COLEMANLIALGORITHM_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_;
76
77 // NONMONOTONE PARAMETER
78 bool useNM_;
80
81 // ITERATION FLAGS/INFORMATION
83 int SPflag_;
84 int SPiter_;
85
86 // SECANT INFORMATION
90
91 // TRUNCATED CG INFORMATION
92 Real tol1_;
93 Real tol2_;
94 int maxit_;
95
96 // ALGORITHM SPECIFIC PARAMETERS
97 Real mu0_;
98 Real spexp_;
99 Real alphaMax_;
100
101 mutable int nhess_;
102 unsigned verbosity_;
104
105 bool hasEcon_;
106 Ptr<ReducedLinearConstraint<Real>> rcon_;
107 Ptr<NullSpaceOperator<Real>> ns_;
108
109 using TypeB::Algorithm<Real>::state_;
110 using TypeB::Algorithm<Real>::status_;
111 using TypeB::Algorithm<Real>::proj_;
112
113public:
114 ColemanLiAlgorithm(ParameterList &list, const Ptr<Secant<Real>> &secant = nullPtr);
115
116 using TypeB::Algorithm<Real>::run;
117 void run( Vector<Real> &x,
118 const Vector<Real> &g,
119 Objective<Real> &obj,
121 std::ostream &outStream = std::cout) override;
122
123 void writeHeader( std::ostream& os ) const override;
124
125 void writeName( std::ostream& os ) const override;
126
127 void writeOutput( std::ostream& os, bool write_header = false ) const override;
128
129private:
130 void initialize(Vector<Real> &x,
131 const Vector<Real> &g,
132 Objective<Real> &obj,
134 std::ostream &outStream = std::cout);
135
136 // Compute the projected step s = P(x + alpha*w) - x
137 // Returns the norm of the projected step s
138 // s -- The projected step upon return
139 // w -- The direction vector w (unchanged)
140 // x -- The anchor vector x (unchanged)
141 // alpha -- The step size (unchanged)
142 // bnd -- The bound constraint
143 Real dgpstep(Vector<Real> &s, const Vector<Real> &w,
144 const Vector<Real> &x, const Real alpha,
145 std::ostream &outStream = std::cout) const;
146
147 // Compute sigma such that ||x+sigma*p||_inv(M) = del. This is called
148 // if dtrpcg detects negative curvature or if the step violates
149 // the trust region bound
150 // xtx -- The dot product <x, inv(M)x> (unchanged)
151 // ptp -- The dot product <p, inv(M)p> (unchanged)
152 // ptx -- The dot product <p, inv(M)x> (unchanged)
153 // del -- Trust region radius (unchanged)
154 Real dtrqsol(const Real xtx, const Real ptp, const Real ptx, const Real del) const;
155
156 // Solve the trust region subproblem: minimize q(w) subject to the
157 // trust region constraint ||w||_inv(M) <= del using the Steihaug-Toint
158 // Conjugate Gradients algorithm
159 // w -- The step vector to be computed
160 // iflag -- Termination flag
161 // iter -- Number of CG iterations
162 // g -- Vector containing gradient (dual space)
163 // x -- Vector containing iterate (primal space)
164 // gdual -- Vector containing primal gradient (primal space)
165 // del -- Trust region radius (unchanged)
166 // model -- Trust region model
167 // bnd -- Bound constraint used to remove active variables
168 // tol -- Residual stopping tolerance (unchanged)
169 // stol -- Preconditioned residual stopping tolerance (unchanged)
170 // p -- Primal working array that stores the CG step
171 // q -- Dual working array that stores the Hessian applied to p
172 // r -- Primal working array that stores the preconditioned residual
173 // t -- Dual working array that stores the residual
174 // pwa1 -- Primal working array that stores the pruned vector in hessVec
175 // pwa2 -- Primal working array that stores the pruned vector in hessVec
176 // dwa -- Dual working array that stores the pruned vector in precond
177 Real dtrpcg(Vector<Real> &w, int &iflag, int &iter,
178 const Vector<Real> &g, const Vector<Real> &x, const Vector<Real> &gdual,
179 const Real del, TrustRegionModel_U<Real> &model, BoundConstraint<Real> &bnd,
180 const Real tol, const Real stol,
182 Vector<Real> &t, Vector<Real> &pwa1, Vector<Real> &pwa2,
183 Vector<Real> &dwa,
184 std::ostream &outStream = std::cout) const;
185
186 void applyC(Vector<Real> &Cv,
187 const Vector<Real> &v,
188 const Vector<Real> &x,
189 const Vector<Real> &g,
191 Vector<Real> &pwa) const;
192
193 void applyHessian(Vector<Real> &hv,
194 const Vector<Real> &v,
195 const Vector<Real> &x,
196 const Vector<Real> &g,
199 Real &tol,
200 Vector<Real> &pwa1,
201 Vector<Real> &pwa2) const;
202
203 void applyPrecond(Vector<Real> &hv,
204 const Vector<Real> &v,
205 const Vector<Real> &x,
206 const Vector<Real> &g,
209 Real &tol,
210 Vector<Real> &dwa,
211 Vector<Real> &pwa) const;
212
213}; // class ROL::TypeB::ColemanLiAlgorithm
214
215} // namespace TypeB
216} // namespace ROL
217
219
220#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 affine-scaling trust-region algorithm of Coleman and Li.
Real dgpstep(Vector< Real > &s, const Vector< Real > &w, const Vector< Real > &x, const Real alpha, std::ostream &outStream=std::cout) const
int nhess_
Number of Hessian applications.
bool useSecantPrecond_
Flag to use secant as a preconditioner (default: false)
int maxit_
Maximum number of CG iterations (default: 20)
Ptr< ReducedLinearConstraint< Real > > rcon_
Equality constraint restricted to current active variables.
void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, std::ostream &outStream=std::cout)
bool writeHeader_
Flag to write header at every iteration.
Real dtrpcg(Vector< Real > &w, int &iflag, int &iter, const Vector< Real > &g, const Vector< Real > &x, const Vector< Real > &gdual, const Real del, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, const Real tol, const Real stol, Vector< Real > &p, Vector< Real > &q, Vector< Real > &r, Vector< Real > &t, Vector< Real > &pwa1, Vector< Real > &pwa2, Vector< Real > &dwa, std::ostream &outStream=std::cout) const
Real dtrqsol(const Real xtx, const Real ptp, const Real ptx, const Real del) const
Real alphaMax_
Maximum value of relaxation parameter (default: 0.999)
void applyPrecond(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, Real &tol, Vector< Real > &dwa, Vector< Real > &pwa) const
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...
int SPflag_
Subproblem solver termination flag.
int SPiter_
Subproblem solver iteration count.
TRUtils::ETRFlag TRflag_
Trust-region exit flag.
ESecant esec_
Secant type (default: Limited-Memory BFGS)
bool useSecantHessVec_
Flag to use secant as Hessian (default: false)
void writeOutput(std::ostream &os, bool write_header=false) const override
Print iterate status.
unsigned verbosity_
Output level (default: 0)
bool interpRad_
Interpolate the trust-region radius if ratio is negative (default: false)
Real spexp_
Relative tolerance exponent for subproblem solve (default: 1, range: [1,2])
Real gamma0_
Radius decrease rate (negative rho) (default: 0.0625)
Real tol1_
Absolute tolerance for truncated CG (default: 1e-4)
Real eta1_
Radius decrease threshold (default: 0.05)
Real gamma1_
Radius decrease rate (positive rho) (default: 0.25)
Real delMax_
Maximum trust-region radius (default: ROL_INF)
Ptr< NullSpaceOperator< Real > > ns_
Null space projection onto reduced equality constraint Jacobian.
Real eta2_
Radius increase threshold (default: 0.9)
void writeName(std::ostream &os) const override
Print step name.
bool hasEcon_
Flag signifies if equality constraints exist.
Real eta0_
Step acceptance threshold (default: 0.05)
Real TRsafe_
Safeguard size for numerically evaluating ratio (default: 1e2)
Real mu0_
Sufficient decrease parameter (default: 1e-2)
Real gamma2_
Radius increase rate (default: 2.5)
void applyHessian(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, Real &tol, Vector< Real > &pwa1, Vector< Real > &pwa2) const
Real eps_
Safeguard for numerically evaluating ratio.
Ptr< TrustRegionModel_U< Real > > model_
Container for trust-region model.
Real tol2_
Relative tolerance for truncated CG (default: 1e-2)
void applyC(Vector< Real > &Cv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, BoundConstraint< Real > &bnd, Vector< Real > &pwa) const
void writeHeader(std::ostream &os) const override
Print iterate header.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:84