ROL
ROL_TypeE_CompositeStepAlgorithm.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_TYPEE_COMPOSITESTEPALGORITHM_H
45 #define ROL_TYPEE_COMPOSITESTEPALGORITHM_H
46 
47 #include "ROL_TypeE_Algorithm.hpp"
48 
55 namespace ROL {
56 namespace TypeE {
57 
58 template<typename Real>
60 private:
61  // Parameter list.
62  ParameterList list_;
63 
64  // Vectors used for cloning.
65  ROL::Ptr<Vector<Real> > xvec_;
66  ROL::Ptr<Vector<Real> > gvec_;
67  ROL::Ptr<Vector<Real> > cvec_;
68  ROL::Ptr<Vector<Real> > lvec_;
69 
70  // Diagnostic return flags for subalgorithms.
71  int flagCG_;
72  int flagAC_;
73  int iterCG_;
74 
75  // Stopping conditions.
78  Real tolCG_;
79  Real tolOSS_;
81 
82  // Tolerances and stopping conditions for subalgorithms.
83  Real lmhtol_;
84  Real qntol_;
85  Real pgtol_;
86  Real projtol_;
87  Real tangtol_;
88  Real tntmax_;
89 
90  // Trust-region parameters.
91  Real zeta_;
92  Real Delta_;
93  Real penalty_;
94  Real eta_;
96 
97  Real ared_;
98  Real pred_;
99  Real snorm_;
100  Real nnorm_;
101  Real tnorm_;
102 
103  // Output flags.
104  bool infoQN_;
105  bool infoLM_;
106  bool infoTS_;
107  bool infoAC_;
108  bool infoLS_;
109  bool infoALL_;
110 
111  // Performance summary.
118 
119  // Verbosity flags.
122 
125 
128  void initialize(Vector<Real> &x,
129  const Vector<Real> &g,
130  Vector<Real> &l,
131  const Vector<Real> &c,
132  Objective<Real> &obj,
133  Constraint<Real> &con,
134  std::ostream &outStream = std::cout);
135 
138  void computeTrial(Vector<Real> &s,
139  const Vector<Real> &x,
140  const Vector<Real> &l,
141  Objective<Real> &obj,
142  Constraint<Real> &con,
143  std::ostream &os);
144 
147  void updateRadius(Vector<Real> &x,
148  Vector<Real> &l,
149  const Vector<Real> &s,
150  Objective<Real> &obj,
151  Constraint<Real> &con,
152  std::ostream &os);
153 
164  const Vector<Real> &x,
165  const Vector<Real> &gf,
166  Constraint<Real> &con,
167  std::ostream &os);
168 
192  const Vector<Real> &c,
193  const Vector<Real> &x,
194  Real delta,
195  Constraint<Real> &con,
196  std::ostream &os);
197 
213  Vector<Real> &tCP,
214  Vector<Real> &Wg,
215  const Vector<Real> &x,
216  const Vector<Real> &g,
217  const Vector<Real> &n,
218  const Vector<Real> &l,
219  Real delta,
220  Objective<Real> &obj,
221  Constraint<Real> &con,
222  std::ostream &os);
223 
226  void accept(Vector<Real> &s, Vector<Real> &n, Vector<Real> &t, Real f_new, Vector<Real> &c_new,
227  Vector<Real> &gf_new, Vector<Real> &l_new, Vector<Real> &g_new,
228  const Vector<Real> &x, const Vector<Real> &l, Real f, const Vector<Real> &gf, const Vector<Real> &c,
229  const Vector<Real> &g, Vector<Real> &tCP, Vector<Real> &Wg,
230  Objective<Real> &obj, Constraint<Real> &con, std::ostream &os);
231 
232  template<typename T> int sgn(T val) const;
233 
234  void printInfoLS(const std::vector<Real> &res, std::ostream& os) const;
235 
236  Real setTolOSS(const Real intol) const;
237 
238 
239 public:
240 
241  CompositeStepAlgorithm(ParameterList &list);
242 
244  virtual void run(Vector<Real> &x,
245  const Vector<Real> &g,
246  Objective<Real> &obj,
247  Constraint<Real> &econ,
248  Vector<Real> &emul,
249  const Vector<Real> &eres,
250  std::ostream &outStream = std::cout) override;
251 
252  virtual void writeHeader(std::ostream& os) const override;
253 
254  virtual void writeName(std::ostream& os) const override;
255 
256  virtual void writeOutput(std::ostream& os, const bool print_header = false) const override;
257 
258 }; // class ROL::TypeE::CompositeStepAlgorithm
259 
260 } // namespace TypeE
261 } // namespace ROL
262 
264 
265 #endif
Provides the interface to evaluate objective functions.
void computeTrial(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, Constraint< Real > &con, std::ostream &os)
Compute trial step.
void accept(Vector< Real > &s, Vector< Real > &n, Vector< Real > &t, Real f_new, Vector< Real > &c_new, Vector< Real > &gf_new, Vector< Real > &l_new, Vector< Real > &g_new, const Vector< Real > &x, const Vector< Real > &l, Real f, const Vector< Real > &gf, const Vector< Real > &c, const Vector< Real > &g, Vector< Real > &tCP, Vector< Real > &Wg, Objective< Real > &obj, Constraint< Real > &con, std::ostream &os)
Check acceptance of subproblem solutions, adjust merit function penalty parameter, ensure global convergence.
virtual void writeHeader(std::ostream &os) const override
Print iterate header.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:80
virtual void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, Constraint< Real > &econ, Vector< Real > &emul, const Vector< Real > &eres, std::ostream &outStream=std::cout) override
Run algorithm on equality constrained problems (Type-E). This general interface supports the use of d...
Provides an interface to run equality constrained optimization algorithms using the Composite-Step Tr...
void computeQuasinormalStep(Vector< Real > &n, const Vector< Real > &c, const Vector< Real > &x, Real delta, Constraint< Real > &con, std::ostream &os)
Compute quasi-normal step by minimizing the norm of the linearized constraint.
void updateRadius(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, Constraint< Real > &con, std::ostream &os)
Update trust-region radius, take step, etc.
virtual void writeName(std::ostream &os) const override
Print step name.
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, Constraint< Real > &con, std::ostream &outStream=std::cout)
Initialize algorithm by computing a few quantities.
void computeLagrangeMultiplier(Vector< Real > &l, const Vector< Real > &x, const Vector< Real > &gf, Constraint< Real > &con, std::ostream &os)
Compute Lagrange multipliers by solving the least-squares problem minimizing the gradient of the Lagr...
void solveTangentialSubproblem(Vector< Real > &t, Vector< Real > &tCP, Vector< Real > &Wg, const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &n, const Vector< Real > &l, Real delta, Objective< Real > &obj, Constraint< Real > &con, std::ostream &os)
Solve tangential subproblem.
void printInfoLS(const std::vector< Real > &res, std::ostream &os) const
virtual void writeOutput(std::ostream &os, const bool print_header=false) const override
Print iterate status.
Defines the general constraint operator interface.