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
20namespace ROL {
21
22template <class Real>
23class PH_StatusTest : public StatusTest<Real> {
24private:
25
26 Real mu_;
28 Ptr<const Vector<Real>> xbar_;
29 Real tol_;
30 Ptr<Vector<Real>> x_;
31
32public:
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
Provides an interface to check status of the progressive hedging algorithm.
Ptr< const Vector< Real > > xbar_
PH_StatusTest(ROL::ParameterList &parlist, const Vector< Real > &x)
Ptr< Vector< Real > > x_
bool check(AlgorithmState< Real > &state)
Check algorithm status.
void setData(const int iter, const Ptr< const Vector< Real > > &xbar)
Provides an interface to check status of optimization algorithms.
Defines the linear algebra or vector space interface.
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
@ EXITSTATUS_USERDEFINED
Definition ROL_Types.hpp:88
State for algorithm class. Will be used for restarts.
ROL::Ptr< Vector< Real > > iterateVec
EExitStatus statusFlag