ROL
ROL_BundleStatusTest.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_BUNDLESTATUSTEST_H
11#define ROL_BUNDLESTATUSTEST_H
12
13#include "ROL_StatusTest.hpp"
14#include "ROL_Types.hpp"
15
16namespace ROL {
17
18template <class Real>
19class BundleStatusTest : public StatusTest<Real> {
20private:
21
22 Real tol_;
24
25public:
26
27 virtual ~BundleStatusTest() {}
28
29 BundleStatusTest( ROL::ParameterList &parlist ) {
30 Real em6(1e-6);
31 tol_ = parlist.sublist("Step").sublist("Bundle").get("Epsilon Solution Tolerance", em6);
32 max_iter_ = parlist.sublist("Status Test").get("Iteration Limit", 100);
33 }
34
35 BundleStatusTest( Real tol = 1.e-6, int max_iter = 100 ) :
36 tol_(tol), max_iter_(max_iter) {}
37
40 virtual bool check( AlgorithmState<Real> &state ) {
41 bool stat = false;
42 if ( (std::max(state.aggregateGradientNorm,state.aggregateModelError) > tol_)
43 && (state.iter < max_iter_)
44 && (state.flag == false) ) {
45 stat = true;
46 }
47 else {
50 : state.flag == true ? EXITSTATUS_CONVERGED
52 }
53 return stat;
54 }
55
56}; // class BundleStatusTest
57
58} // namespace ROL
59
60#endif
Contains definitions of custom data types in ROL.
BundleStatusTest(ROL::ParameterList &parlist)
BundleStatusTest(Real tol=1.e-6, int max_iter=100)
virtual bool check(AlgorithmState< Real > &state)
Check algorithm status.
Provides an interface to check status of optimization algorithms.
@ 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