ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
status
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
16
namespace
ROL
{
17
18
template
<
class
Real>
19
class
BundleStatusTest
:
public
StatusTest
<Real> {
20
private
:
21
22
Real
tol_
;
23
int
max_iter_
;
24
25
public
:
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
{
48
state.
statusFlag
= (std::max(state.
aggregateGradientNorm
,state.
aggregateModelError
) <=
tol_
?
EXITSTATUS_CONVERGED
49
: state.
iter
>=
max_iter_
?
EXITSTATUS_MAXITER
50
: state.
flag
==
true
?
EXITSTATUS_CONVERGED
51
:
EXITSTATUS_LAST
);
52
}
53
return
stat;
54
}
55
56
};
// class BundleStatusTest
57
58
}
// namespace ROL
59
60
#endif
ROL_StatusTest.hpp
ROL_Types.hpp
Contains definitions of custom data types in ROL.
ROL::BundleStatusTest::max_iter_
int max_iter_
Definition
ROL_BundleStatusTest.hpp:23
ROL::BundleStatusTest::BundleStatusTest
BundleStatusTest(ROL::ParameterList &parlist)
Definition
ROL_BundleStatusTest.hpp:29
ROL::BundleStatusTest::BundleStatusTest
BundleStatusTest(Real tol=1.e-6, int max_iter=100)
Definition
ROL_BundleStatusTest.hpp:35
ROL::BundleStatusTest::check
virtual bool check(AlgorithmState< Real > &state)
Check algorithm status.
Definition
ROL_BundleStatusTest.hpp:40
ROL::BundleStatusTest::~BundleStatusTest
virtual ~BundleStatusTest()
Definition
ROL_BundleStatusTest.hpp:27
ROL::BundleStatusTest::tol_
Real tol_
Definition
ROL_BundleStatusTest.hpp:22
ROL::ROL::StatusTest::StatusTest
StatusTest(ParameterList &parlist)
Definition
ROL_Constraint_SerialSimOpt.hpp:36
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::EXITSTATUS_MAXITER
@ EXITSTATUS_MAXITER
Definition
ROL_Types.hpp:85
ROL::EXITSTATUS_CONVERGED
@ EXITSTATUS_CONVERGED
Definition
ROL_Types.hpp:84
ROL::EXITSTATUS_LAST
@ EXITSTATUS_LAST
Definition
ROL_Types.hpp:89
ROL::AlgorithmState
State for algorithm class. Will be used for restarts.
Definition
ROL_Types.hpp:109
ROL::AlgorithmState::aggregateGradientNorm
Real aggregateGradientNorm
Definition
ROL_Types.hpp:120
ROL::AlgorithmState::aggregateModelError
Real aggregateModelError
Definition
ROL_Types.hpp:121
ROL::AlgorithmState::statusFlag
EExitStatus statusFlag
Definition
ROL_Types.hpp:126
ROL::AlgorithmState::flag
bool flag
Definition
ROL_Types.hpp:122
ROL::AlgorithmState::iter
int iter
Definition
ROL_Types.hpp:110
Generated by
1.17.0