ROL
ROL_ObjectiveFromConstraint_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_OBJECTIVE_FROM_CONSTRAINT_DEF_H
11 #define ROL_OBJECTIVE_FROM_CONSTRAINT_DEF_H
12 
13 namespace ROL {
14 
15 template<typename Real>
17  const Vector<Real> &l ) :
18  con_(con), l_(l.clone()), c_(l.dual().clone()) {
19  l_->set(l);
20 }
21 
22 template<typename Real>
24  con_->update(x,type,iter);
25 }
26 
27 template<typename Real>
28 void ObjectiveFromConstraint<Real>::update( const Vector<Real> &x, bool flag, int iter ) {
29  con_->update(x,flag,iter);
30 }
31 
32 template<typename Real>
34  con_->value(*c_,x,tol);
35  //return l_->dot(c_->dual());
36  return l_->apply(*c_);
37 }
38 
39 template<typename Real>
41  con_->applyAdjointJacobian(g,*l_,x,tol);
42 }
43 
44 template<typename Real>
46  con_->applyAdjointHessian(hv,*l_,v,x,tol);
47 }
48 
49 template<typename Real>
51  l_->set(l);
52 }
53 
54 } // namespace ROL
55 
56 #endif // ROL_OBJECTIVE_FROM_CONSTRAINT_DEF_H
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
Real value(const Vector< Real > &x, Real &tol) override
Compute value.
void updateMultiplier(const Vector< Real > &l)
ObjectiveFromConstraint(const Ptr< Constraint< Real >> &con, const Vector< Real > &l)
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply Hessian approximation to vector.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Compute gradient.
Defines the general constraint operator interface.