ROL
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 
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) ) {
52  return false;
53  }
54  return true;
55  }
56 
57 }; // class PH_StatusTest
58 
59 } // namespace ROL
60 
61 #endif
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
EExitStatus statusFlag
Definition: ROL_Types.hpp:126
void setData(const int iter, const Ptr< const Vector< Real >> &xbar)
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
State for algorithm class. Will be used for restarts.
Definition: ROL_Types.hpp:109
Ptr< Vector< Real > > x_
PH_StatusTest(ROL::ParameterList &parlist, const Vector< Real > &x)
bool check(AlgorithmState< Real > &state)
Check algorithm status.
ROL::Ptr< Vector< Real > > iterateVec
Definition: ROL_Types.hpp:123
Provides an interface to check status of optimization algorithms.
Provides an interface to check status of the progressive hedging algorithm.
Ptr< const Vector< Real > > xbar_