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  // NONMONOTONE INFORMATION
82  bool useNM_;
84 
85  // SECANT INFORMATION
89 
90  // INEXACT COMPUTATION PARAMETERS
91  std::vector<bool> useInexact_;
92  Real scale0_;
93  Real scale1_;
96  Real gtol_;
97 
98  // VERBOSITY SETTING
99  int verbosity_;
101 
105 
106 public:
107 
108  TrustRegionAlgorithm( ParameterList &parlist,
109  const Ptr<Secant<Real>> &secant = nullPtr );
110 
111  using Algorithm<Real>::run;
112  void run( Vector<Real> &x,
113  const Vector<Real> &g,
114  Objective<Real> &obj,
115  std::ostream &outStream = std::cout) override;
116 
117  void writeHeader( std::ostream& os ) const override;
118 
119  void writeName( std::ostream& os ) const override;
120 
121  void writeOutput( std::ostream& os, const bool print_header = false ) const override;
122 
123 private:
124 
125  void initialize(const Vector<Real> &x, const Vector<Real> &g, Vector<Real> &Bg,
126  Objective<Real> &obj, std::ostream &outStream = std::cout);
127 
128  Real computeValue(const Vector<Real> &x, Objective<Real> &obj, Real pRed);
129 
142  void computeGradient(const Vector<Real> &x, Objective<Real> &obj, bool accept);
143 
144 }; // class ROL::TrustRegionAlgorithm
145 } // namespace TypeU
146 } // namespace ROL
147 
149 
150 #endif
int verbosity_
Print additional information to screen if &gt; 0.
Provides the interface to evaluate objective functions.
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)
void computeGradient(const Vector< Real > &x, Objective< Real > &obj, bool accept)
Compute gradient to iteratively satisfy inexactness condition.
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).
void writeOutput(std::ostream &os, const bool print_header=false) const override
Print iterate status.
ETRFlag
Enumation of flags used by trust-region solvers.
ESecant
Enumeration of secant update algorithms.
Definition: ROL_Types.hpp:486
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)