ROL
src
status
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
19
20
21
namespace
ROL
{
22
23
template
<
class
Real>
24
class
FletcherStatusTest
:
public
StatusTest
<Real> {
25
private
:
26
27
Real
gtol_
;
28
Real
ctol_
;
29
Real
stol_
;
30
int
max_iter_
;
31
32
public
:
33
34
virtual
~FletcherStatusTest
() {}
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
58
: state.
aggregateGradientNorm
<=
gtol_
?
EXITSTATUS_CONVERGED
59
: state.
iter
>=
max_iter_
?
EXITSTATUS_MAXITER
60
: state.
flag
==
true
?
EXITSTATUS_CONVERGED
61
:
EXITSTATUS_LAST
);
62
return
false
;
63
}
64
}
65
66
};
// class FletcherStatusTest
67
68
}
// namespace ROL
69
70
#endif
71
ROL_StatusTest.hpp
ROL::FletcherStatusTest::~FletcherStatusTest
virtual ~FletcherStatusTest()
Definition
ROL_FletcherStatusTest.hpp:34
ROL::FletcherStatusTest::FletcherStatusTest
FletcherStatusTest(ROL::ParameterList &parlist)
Definition
ROL_FletcherStatusTest.hpp:36
ROL::FletcherStatusTest::check
virtual bool check(AlgorithmState< Real > &state)
Check algorithm status.
Definition
ROL_FletcherStatusTest.hpp:49
ROL::FletcherStatusTest::gtol_
Real gtol_
Definition
ROL_FletcherStatusTest.hpp:27
ROL::FletcherStatusTest::FletcherStatusTest
FletcherStatusTest(Real gtol=1e-6, Real ctol=1e-6, Real stol=1e-12, int max_iter=100)
Definition
ROL_FletcherStatusTest.hpp:44
ROL::FletcherStatusTest::max_iter_
int max_iter_
Definition
ROL_FletcherStatusTest.hpp:30
ROL::FletcherStatusTest::stol_
Real stol_
Definition
ROL_FletcherStatusTest.hpp:29
ROL::FletcherStatusTest::ctol_
Real ctol_
Definition
ROL_FletcherStatusTest.hpp:28
ROL::ROL::StatusTest::StatusTest
StatusTest(ParameterList &parlist)
Definition
ROL_Constraint_SerialSimOpt.hpp:36
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::EXITSTATUS_STEPTOL
@ EXITSTATUS_STEPTOL
Definition
ROL_Types.hpp:86
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::cnorm
Real cnorm
Definition
ROL_Types.hpp:118
ROL::AlgorithmState::gnorm
Real gnorm
Definition
ROL_Types.hpp:117
ROL::AlgorithmState::aggregateGradientNorm
Real aggregateGradientNorm
Definition
ROL_Types.hpp:120
ROL::AlgorithmState::snorm
Real snorm
Definition
ROL_Types.hpp:119
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.15.0