ROL
ROL_PolyhedralProjection_Def.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_POLYHEDRALPROJECTION_DEF_H
11 #define ROL_POLYHEDRALPROJECTION_DEF_H
12 
13 namespace ROL {
14 
15 template<typename Real>
17  : bnd_(bnd), con_(nullPtr) {}
18 
19 template<typename Real>
21  const Vector<Real> &xdual,
22  const Ptr<BoundConstraint<Real>> &bnd,
23  const Ptr<Constraint<Real>> &con,
24  const Vector<Real> &mul,
25  const Vector<Real> &res)
26  : bnd_(bnd), con_(con) {
27  xprim_ = xprim.clone();
28  xdual_ = xdual.clone();
29  mul_ = mul.clone();
30  res_ = res.clone();
31 }
32 
33 template<typename Real>
34 void PolyhedralProjection<Real>::project(Vector<Real> &x, std::ostream &stream) {
35  if (con_ == nullPtr) {
36  bnd_->project(x);
37  }
38  else {
39  throw Exception::NotImplemented(">>> ROL::PolyhedralProjection::project : No projection implemented!");
40  }
41 }
42 
43 template<typename Real>
44 const Ptr<Constraint<Real>> PolyhedralProjection<Real>::getLinearConstraint(void) const {
45  return con_;
46 }
47 
48 template<typename Real>
49 const Ptr<BoundConstraint<Real>> PolyhedralProjection<Real>::getBoundConstraint(void) const {
50  return bnd_;
51 }
52 
53 template<typename Real>
54 const Ptr<Vector<Real>> PolyhedralProjection<Real>::getMultiplier(void) const {
55  return mul_;
56 }
57 
58 template<typename Real>
59 const Ptr<Vector<Real>> PolyhedralProjection<Real>::getResidual(void) const {
60  return res_;
61 }
62 
63 } // namespace ROL
64 
65 #endif
PolyhedralProjection(const Ptr< BoundConstraint< Real >> &bnd)
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void project(Vector< Real > &x, std::ostream &stream=std::cout)
const Ptr< Constraint< Real > > getLinearConstraint(void) const
const Ptr< Vector< Real > > getResidual(void) const
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
const Ptr< Vector< Real > > getMultiplier(void) const
Provides the interface to apply upper and lower bound constraints.
const Ptr< BoundConstraint< Real > > getBoundConstraint(void) const
Defines the general constraint operator interface.