ROL
ROL_Bundle_U_AS.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
44 #ifndef ROL_BUNDLE_U_AS_H
45 #define ROL_BUNDLE_U_AS_H
46 
47 #include "ROL_Bundle_U.hpp"
48 
53 namespace ROL {
54 
55 template<typename Real>
56 class Bundle_U_AS : public Bundle_U<Real> {
57 /***********************************************************************************************/
58 /***************** BUNDLE STORAGE **************************************************************/
59 /***********************************************************************************************/
60 private:
61 
62  Ptr<Vector<Real>> tG_;
63  Ptr<Vector<Real>> eG_;
64  Ptr<Vector<Real>> yG_;
65  Ptr<Vector<Real>> gx_;
66  Ptr<Vector<Real>> ge_;
67 
68  std::set<unsigned> workingSet_;
69  std::set<unsigned> nworkingSet_;
70 
72 
73 /***********************************************************************************************/
74 /***************** BUNDLE MODIFICATION AND ACCESS ROUTINES *************************************/
75 /***********************************************************************************************/
76 public:
77  Bundle_U_AS(const unsigned maxSize = 10,
78  const Real coeff = 0.0,
79  const Real omega = 2.0,
80  const unsigned remSize = 2);
81 
82  void initialize(const Vector<Real> &g);
83 
84  unsigned solveDual(const Real t, const unsigned maxit = 1000, const Real tol = 1.e-8);
85 
86 /***********************************************************************************************/
87 /***************** DUAL CUTTING PLANE PROBLEM ROUTINES *****************************************/
88 /***********************************************************************************************/
89 private:
90  void initializeDualSolver(void);
91 
92  void computeLagMult(std::vector<Real> &lam, const Real mu, const std::vector<Real> &g) const;
93 
94  bool isNonnegative(unsigned &ind, const std::vector<Real> &x) const;
95 
96  Real computeStepSize(unsigned &ind, const std::vector<Real> &x, const std::vector<Real> &p) const;
97 
98  unsigned solveEQPsubproblem(std::vector<Real> &s, Real &mu,
99  const std::vector<Real> &g, const Real tol) const;
100 
101  void applyPreconditioner(std::vector<Real> &Px, const std::vector<Real> &x) const;
102 
103  void applyG(std::vector<Real> &Gx, const std::vector<Real> &x) const;
104 
105  void applyPreconditioner_Identity(std::vector<Real> &Px, const std::vector<Real> &x) const;
106 
107  void applyG_Identity(std::vector<Real> &Gx, const std::vector<Real> &x) const;
108 
109  void applyPreconditioner_Jacobi(std::vector<Real> &Px, const std::vector<Real> &x) const;
110 
111  void applyG_Jacobi(std::vector<Real> &Gx, const std::vector<Real> &x) const;
112 
113  void applyPreconditioner_SymGS(std::vector<Real> &Px, const std::vector<Real> &x) const;
114 
115  void applyG_SymGS(std::vector<Real> &Gx, const std::vector<Real> &x) const;
116 
117  void computeResidualUpdate(std::vector<Real> &r, std::vector<Real> &g) const;
118 
119  void applyFullMatrix(std::vector<Real> &Hx, const std::vector<Real> &x) const;
120 
121  void applyMatrix(std::vector<Real> &Hx, const std::vector<Real> &x) const;
122 
123  unsigned projectedCG(std::vector<Real> &x, Real &mu, const std::vector<Real> &b, const Real tol) const;
124 
125  Real dot(const std::vector<Real> &x, const std::vector<Real> &y) const;
126 
127  Real norm(const std::vector<Real> &x) const;
128 
129  void axpy(const Real a, const std::vector<Real> &x, std::vector<Real> &y) const;
130 
131  void scale(std::vector<Real> &x, const Real a) const;
132 
133  void scale(std::vector<Real> &x, const Real a, const std::vector<Real> &y) const;
134 
135  unsigned solveDual_arbitrary(const Real t, const unsigned maxit = 1000, const Real tol = 1.e-8);
136 
137  /************************************************************************/
138  /********************** PROJECTION ONTO FEASIBLE SET ********************/
139  /************************************************************************/
140  void project(std::vector<Real> &x, const std::vector<Real> &v) const;
141 
142  Real computeCriticality(const std::vector<Real> &g, const std::vector<Real> &sol) const;
143 }; // class Bundle_AS
144 
145 } // namespace ROL
146 
147 #include "ROL_Bundle_U_AS_Def.hpp"
148 
149 #endif
bool isNonnegative(unsigned &ind, const std::vector< Real > &x) const
Real norm(const std::vector< Real > &x) const
void scale(std::vector< Real > &x, const Real a) const
Ptr< Vector< Real > > yG_
void applyPreconditioner(std::vector< Real > &Px, const std::vector< Real > &x) const
Ptr< Vector< Real > > eG_
unsigned solveEQPsubproblem(std::vector< Real > &s, Real &mu, const std::vector< Real > &g, const Real tol) const
void applyPreconditioner_Jacobi(std::vector< Real > &Px, const std::vector< Real > &x) const
Real dot(const std::vector< Real > &x, const std::vector< Real > &y) const
void applyG_Identity(std::vector< Real > &Gx, const std::vector< Real > &x) const
Provides the interface for and implements a bundle.
Ptr< Vector< Real > > ge_
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:80
void applyPreconditioner_SymGS(std::vector< Real > &Px, const std::vector< Real > &x) const
Ptr< Vector< Real > > tG_
void applyMatrix(std::vector< Real > &Hx, const std::vector< Real > &x) const
Ptr< Vector< Real > > gx_
Real computeCriticality(const std::vector< Real > &g, const std::vector< Real > &sol) const
std::set< unsigned > workingSet_
std::set< unsigned > nworkingSet_
unsigned projectedCG(std::vector< Real > &x, Real &mu, const std::vector< Real > &b, const Real tol) const
unsigned solveDual_arbitrary(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
unsigned solveDual(const Real t, const unsigned maxit=1000, const Real tol=1.e-8)
Provides the interface for and implements an active set bundle.
void computeResidualUpdate(std::vector< Real > &r, std::vector< Real > &g) const
void applyG(std::vector< Real > &Gx, const std::vector< Real > &x) const
void initialize(const Vector< Real > &g)
Real computeStepSize(unsigned &ind, const std::vector< Real > &x, const std::vector< Real > &p) const
void applyG_Jacobi(std::vector< Real > &Gx, const std::vector< Real > &x) const
void axpy(const Real a, const std::vector< Real > &x, std::vector< Real > &y) const
void applyPreconditioner_Identity(std::vector< Real > &Px, const std::vector< Real > &x) const
void initializeDualSolver(void)
void applyFullMatrix(std::vector< Real > &Hx, const std::vector< Real > &x) const
void computeLagMult(std::vector< Real > &lam, const Real mu, const std::vector< Real > &g) const
void project(std::vector< Real > &x, const std::vector< Real > &v) const
Bundle_U_AS(const unsigned maxSize=10, const Real coeff=0.0, const Real omega=2.0, const unsigned remSize=2)
void applyG_SymGS(std::vector< Real > &Gx, const std::vector< Real > &x) const