ROL
ROL_Bundle_U.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_BUNDLE_U_H
11 #define ROL_BUNDLE_U_H
12 
13 #include "ROL_Vector.hpp"
14 #include "ROL_Ptr.hpp"
15 #include <vector>
16 #include <set>
17 
22 namespace ROL {
23 
24 template<typename Real>
25 class Bundle_U {
26 /***********************************************************************************************/
27 /***************** BUNDLE STORAGE **************************************************************/
28 /***********************************************************************************************/
29 private:
30  std::vector<Ptr<Vector<Real>>> subgradients_;
31  std::vector<Real> linearizationErrors_;
32  std::vector<Real> distanceMeasures_;
33 
34  std::vector<Real> dualVariables_;
35 
36  Ptr<Vector<Real>> tG_;
37  Ptr<Vector<Real>> eG_;
38  Ptr<Vector<Real>> yG_;
39  Ptr<Vector<Real>> gx_;
40  Ptr<Vector<Real>> ge_;
41 
42  unsigned size_;
43 
44  unsigned maxSize_;
45  unsigned remSize_;
46  Real coeff_;
47  Real omega_;
48 
50 
51  void remove(const std::vector<unsigned> &ind);
52 
53  void add(const Vector<Real> &g, const Real le, const Real dm);
54 
55 /***********************************************************************************************/
56 /***************** BUNDLE MODIFICATION AND ACCESS ROUTINES *************************************/
57 /***********************************************************************************************/
58 public:
59  virtual ~Bundle_U(void) {}
60 
61  Bundle_U(const unsigned maxSize = 10,
62  const Real coeff = 0.0,
63  const Real omega = 2.0,
64  const unsigned remSize = 2);
65 
66  virtual void initialize(const Vector<Real> &g);
67 
68  virtual unsigned solveDual(const Real t, const unsigned maxit = 1000, const Real tol = 1.e-8) = 0;
69 
70  const Real linearizationError(const unsigned i) const;
71 
72  const Real distanceMeasure(const unsigned i) const;
73 
74  const Vector<Real> & subgradient(const unsigned i) const;
75 
76  const Real getDualVariable(const unsigned i) const;
77 
78  void setDualVariable(const unsigned i, const Real val);
79 
80  void resetDualVariables(void);
81 
82  const Real computeAlpha(const Real dm, const Real le) const;
83 
84  const Real alpha(const unsigned i) const;
85 
86  unsigned size(void) const;
87 
88  void aggregate(Vector<Real> &aggSubGrad, Real &aggLinErr, Real &aggDistMeas) const;
89 
90  void reset(const Vector<Real> &g, const Real le, const Real dm);
91 
92  void update(const bool flag, const Real linErr, const Real distMeas,
93  const Vector<Real> &g, const Vector<Real> &s);
94 
95 protected:
96  const Real GiGj(const unsigned i, const unsigned j) const;
97 
98  const Real dotGi(const unsigned i, const Vector<Real> &x) const;
99 
100  void addGi(const unsigned i, const Real a, Vector<Real> &x) const;
101 
102  Real evaluateObjective(std::vector<Real> &g, const std::vector<Real> &x, const Real t) const;
103 
104  unsigned solveDual_dim1(const Real t, const unsigned maxit = 1000, const Real tol = 1.e-8);
105 
106  unsigned solveDual_dim2(const Real t, const unsigned maxit = 1000, const Real tol = 1.e-8);
107 
108 }; // class Bundle_U
109 
110 } // namespace ROL
111 
112 #include "ROL_Bundle_U_Def.hpp"
113 
114 #endif
void reset(const Vector< Real > &g, const Real le, const Real dm)
unsigned solveDual_dim1(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
unsigned maxSize_
void setDualVariable(const unsigned i, const Real val)
const Vector< Real > & subgradient(const unsigned i) const
const Real dotGi(const unsigned i, const Vector< Real > &x) const
void update(const bool flag, const Real linErr, const Real distMeas, const Vector< Real > &g, const Vector< Real > &s)
Ptr< Vector< Real > > yG_
const Real GiGj(const unsigned i, const unsigned j) const
std::vector< Real > dualVariables_
Provides the interface for and implements a bundle.
virtual unsigned solveDual(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)=0
const Real alpha(const unsigned i) const
virtual ~Bundle_U(void)
std::vector< Real > distanceMeasures_
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
virtual void initialize(const Vector< Real > &g)
void resetDualVariables(void)
unsigned size(void) const
unsigned size_
void aggregate(Vector< Real > &aggSubGrad, Real &aggLinErr, Real &aggDistMeas) const
Bundle_U(const unsigned maxSize=10, const Real coeff=0.0, const Real omega=2.0, const unsigned remSize=2)
Real evaluateObjective(std::vector< Real > &g, const std::vector< Real > &x, const Real t) const
void add(const Vector< Real > &g, const Real le, const Real dm)
Ptr< Vector< Real > > gx_
Ptr< Vector< Real > > ge_
const Real distanceMeasure(const unsigned i) const
unsigned solveDual_dim2(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
unsigned remSize_
Ptr< Vector< Real > > eG_
std::vector< Ptr< Vector< Real > > > subgradients_
void addGi(const unsigned i, const Real a, Vector< Real > &x) const
const Real linearizationError(const unsigned i) const
Ptr< Vector< Real > > tG_
std::vector< Real > linearizationErrors_
const Real getDualVariable(const unsigned i) const
const Real computeAlpha(const Real dm, const Real le) const