ROL
ROL_TypeU_TrustRegionAlgorithm.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_TYPEU_TRUSTREGIONALGORITHM_H
45 #define ROL_TYPEU_TRUSTREGIONALGORITHM_H
46 
47 #include "ROL_TypeU_Algorithm.hpp"
49 #include "ROL_TrustRegion_U.hpp"
51 #include "ROL_Secant.hpp"
52 
58 namespace ROL {
59 namespace TypeU {
60 
61 template<typename Real>
62 class TrustRegionAlgorithm : public Algorithm<Real> {
63 private:
64  // TRUST REGION INFORMATION
65  Ptr<TrustRegion_U<Real>> solver_;
66  Ptr<TrustRegionModel_U<Real>> model_;
68  Real delMax_;
69  Real eta0_;
70  Real eta1_;
71  Real eta2_;
72  Real gamma0_;
73  Real gamma1_;
74  Real gamma2_;
75  Real TRsafe_;
76  Real eps_;
78  int SPflag_;
79  int SPiter_;
80 
81  // SECANT INFORMATION
85 
86  // INEXACT COMPUTATION PARAMETERS
87  std::vector<bool> useInexact_;
88  Real scale0_;
89  Real scale1_;
92 
93  // VERBOSITY SETTING
94  int verbosity_;
95  bool printHeader_;
96 
100 
101 public:
102 
103  TrustRegionAlgorithm( ParameterList &parlist,
104  const Ptr<Secant<Real>> &secant = nullPtr );
105 
106  using Algorithm<Real>::run;
107  void run( Vector<Real> &x,
108  const Vector<Real> &g,
109  Objective<Real> &obj,
110  std::ostream &outStream = std::cout) override;
111 
112  void writeHeader( std::ostream& os ) const override;
113 
114  void writeName( std::ostream& os ) const override;
115 
116  void writeOutput( std::ostream& os, bool print_header = false ) const override;
117 
118 private:
119 
120  void initialize(const Vector<Real> &x, const Vector<Real> &g, Vector<Real> &Bg,
121  Objective<Real> &obj, std::ostream &outStream = std::cout);
122 
123  Real computeValue(const Vector<Real> &x, Objective<Real> &obj, Real pRed);
124 
137  void computeGradient(const Vector<Real> &x, Objective<Real> &obj);
138 
139 }; // class ROL::TrustRegionAlgorithm
140 } // namespace TypeU
141 } // namespace ROL
142 
144 
145 #endif
int verbosity_
Print additional information to screen if > 0.
Provides the interface to evaluate objective functions.
void computeGradient(const Vector< Real > &x, Objective< Real > &obj)
Compute gradient to iteratively satisfy inexactness condition.
void initialize(const Vector< Real > &x, const Vector< Real > &g, Vector< Real > &Bg, Objective< Real > &obj, std::ostream &outStream=std::cout)
Real scale1_
Scale for inexact gradient computation.
TrustRegionAlgorithm(ParameterList &parlist, const Ptr< Secant< Real >> &secant=nullPtr)
Real delMax_
Maximum trust-region radius.
Ptr< TrustRegion_U< Real > > solver_
Container for trust-region solver object.
bool printHeader_
Print header at every iteration.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:80
Ptr< TrustRegionModel_U< Real > > model_
Container for trust-region model.
Real gamma0_
Radius decrease rate (negative rho).
ETRFlag
Enumation of flags used by trust-region solvers.
void writeOutput(std::ostream &os, bool print_header=false) const override
Print iterate status.
ESecant
Enumeration of secant update algorithms.
Definition: ROL_Types.hpp:484
Contains definitions of enums for trust region algorithms.
int SPiter_
Subproblem solver iteration count.
int SPflag_
Subproblem solver termination flag.
Provides an interface to run unconstrained optimization algorithms.
void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, std::ostream &outStream=std::cout) override
Run algorithm on unconstrained problems (Type-U). This general interface supports the use of dual opt...
void writeName(std::ostream &os) const override
Print step name.
Provides interface for and implements limited-memory secant operators.
Definition: ROL_Secant.hpp:79
Real scale0_
Scale for inexact gradient computation.
void writeHeader(std::ostream &os) const override
Print iterate header.
Real TRsafe_
Safeguard size for numerically evaluating ratio.
Real gamma1_
Radius decrease rate (positive rho).
TRUtils::ETRFlag TRflag_
Trust-region exit flag.
ETrustRegionU etr_
Trust-region subproblem solver type.
ETrustRegionU
Enumeration of trust-region solver types.
std::vector< bool > useInexact_
Flags for inexact (0) objective function, (1) gradient, (2) Hessian.
Provides an interface to run trust-region methods for unconstrained optimization algorithms.
Real eps_
Safeguard for numerically evaluating ratio.
Real computeValue(const Vector< Real > &x, Objective< Real > &obj, Real pRed)