ROL
ROL_FletcherStatusTest.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_FletcherStatusTest_H
11#define ROL_FletcherStatusTest_H
12
13#include "ROL_StatusTest.hpp"
14
21namespace ROL {
22
23template <class Real>
24class FletcherStatusTest : public StatusTest<Real> {
25private:
26
27 Real gtol_;
28 Real ctol_;
29 Real stol_;
31
32public:
33
35
36 FletcherStatusTest( ROL::ParameterList &parlist ) {
37 Real em6(1e-6);
38 gtol_ = parlist.sublist("Status Test").get("Gradient Tolerance", em6);
39 ctol_ = parlist.sublist("Status Test").get("Constraint Tolerance", em6);
40 stol_ = parlist.sublist("Status Test").get("Step Tolerance", em6*gtol_);
41 max_iter_ = parlist.sublist("Status Test").get("Iteration Limit", 100);
42 }
43
44 FletcherStatusTest( Real gtol = 1e-6, Real ctol = 1e-6, Real stol = 1e-12, int max_iter = 100 ) :
45 gtol_(gtol), ctol_(ctol), stol_(stol), max_iter_(max_iter) {}
46
49 virtual bool check( AlgorithmState<Real> &state ) {
50 if ( ((state.gnorm > gtol_) || (state.cnorm > ctol_)) &&
51 (state.snorm > stol_) && (state.aggregateGradientNorm > gtol_) &&
52 (state.iter < max_iter_) && (!state.flag)) {
53 return true;
54 }
55 else {
56 state.statusFlag = ((state.gnorm <= gtol_) && (state.cnorm <= ctol_) ? EXITSTATUS_CONVERGED
57 : state.snorm <= stol_ ? EXITSTATUS_STEPTOL
60 : state.flag==true ? EXITSTATUS_CONVERGED
62 return false;
63 }
64 }
65
66}; // class FletcherStatusTest
67
68} // namespace ROL
69
70#endif
71
Provides an interface to check status of optimization algorithms for problems with equality constrain...
FletcherStatusTest(ROL::ParameterList &parlist)
virtual bool check(AlgorithmState< Real > &state)
Check algorithm status.
FletcherStatusTest(Real gtol=1e-6, Real ctol=1e-6, Real stol=1e-12, int max_iter=100)
Provides an interface to check status of optimization algorithms.
@ EXITSTATUS_STEPTOL
Definition ROL_Types.hpp:86
@ EXITSTATUS_MAXITER
Definition ROL_Types.hpp:85
@ EXITSTATUS_CONVERGED
Definition ROL_Types.hpp:84
@ EXITSTATUS_LAST
Definition ROL_Types.hpp:89
State for algorithm class. Will be used for restarts.
EExitStatus statusFlag