ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
sol
status
ROL_PH_StatusTest.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_PH_STATUSTEST_H
11
#define ROL_PH_STATUSTEST_H
12
13
#include "
ROL_StatusTest.hpp
"
14
18
19
20
namespace
ROL
{
21
22
template
<
class
Real>
23
class
PH_StatusTest
:
public
StatusTest
<Real> {
24
private
:
25
26
Real
mu_
;
27
Real
epsilon_
;
28
Ptr<const Vector<Real>>
xbar_
;
29
Real
tol_
;
30
Ptr<Vector<Real>>
x_
;
31
32
public
:
33
34
PH_StatusTest
( ROL::ParameterList &parlist,
const
Vector<Real>
&x ) {
35
mu_
= parlist.sublist(
"SOL"
).sublist(
"Progressive Hedging"
).get(
"Fixed Tolerance"
, 1e-4);
36
epsilon_
= parlist.sublist(
"SOL"
).sublist(
"Progressive Hedging"
).get(
"Dynamic Tolerance"
, 0.1);
37
x_
= x.
clone
();
38
}
39
40
void
setData
(
const
int
iter,
const
Ptr<
const
Vector<Real>
> &xbar) {
41
const
Real one(1);
42
tol_
=
mu_
*std::pow(one-
epsilon_
,iter+1);
43
xbar_
= xbar;
44
}
45
46
bool
check
(
AlgorithmState<Real>
&state ) {
47
const
Real one(1);
48
x_
->set(*state.
iterateVec
);
x_
->axpy(-one,*
xbar_
);
49
Real xnorm =
x_
->norm();
50
if
( state.
gnorm
<=
tol_
*std::min(one,xnorm) ) {
51
state.
statusFlag
=
EXITSTATUS_USERDEFINED
;
52
return
false
;
53
}
54
return
true
;
55
}
56
57
};
// class PH_StatusTest
58
59
}
// namespace ROL
60
61
#endif
ROL_StatusTest.hpp
ROL::PH_StatusTest::xbar_
Ptr< const Vector< Real > > xbar_
Definition
ROL_PH_StatusTest.hpp:28
ROL::PH_StatusTest::PH_StatusTest
PH_StatusTest(ROL::ParameterList &parlist, const Vector< Real > &x)
Definition
ROL_PH_StatusTest.hpp:34
ROL::PH_StatusTest::x_
Ptr< Vector< Real > > x_
Definition
ROL_PH_StatusTest.hpp:30
ROL::PH_StatusTest::tol_
Real tol_
Definition
ROL_PH_StatusTest.hpp:29
ROL::PH_StatusTest::epsilon_
Real epsilon_
Definition
ROL_PH_StatusTest.hpp:27
ROL::PH_StatusTest::check
bool check(AlgorithmState< Real > &state)
Definition
ROL_PH_StatusTest.hpp:46
ROL::PH_StatusTest::mu_
Real mu_
Definition
ROL_PH_StatusTest.hpp:26
ROL::PH_StatusTest::setData
void setData(const int iter, const Ptr< const Vector< Real > > &xbar)
Definition
ROL_PH_StatusTest.hpp:40
ROL::ROL::StatusTest::StatusTest
StatusTest(ParameterList &parlist)
Definition
ROL_Constraint_SerialSimOpt.hpp:36
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::clone
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::EXITSTATUS_USERDEFINED
@ EXITSTATUS_USERDEFINED
Definition
ROL_Types.hpp:88
ROL::AlgorithmState
State for algorithm class. Will be used for restarts.
Definition
ROL_Types.hpp:109
ROL::AlgorithmState::gnorm
Real gnorm
Definition
ROL_Types.hpp:117
ROL::AlgorithmState::iterateVec
ROL::Ptr< Vector< Real > > iterateVec
Definition
ROL_Types.hpp:123
ROL::AlgorithmState::statusFlag
EExitStatus statusFlag
Definition
ROL_Types.hpp:126
Generated by
1.17.0