10 #ifndef ROL_CONSTRAINTFROMOBJECTIVE_DEF_H
11 #define ROL_CONSTRAINTFROMOBJECTIVE_DEF_H
15 template<
typename Real>
17 obj_(obj), dualVector_(nullPtr), offset_(offset), isDualInitialized_(false) {}
19 template<
typename Real>
22 template<
typename Real>
24 obj_->setParameter(param);
28 template<
typename Real>
30 obj_->update(x,type,iter);
33 template<
typename Real>
35 obj_->update(x,flag,iter);
38 template<
typename Real>
40 setValue(c,
obj_->value(x,tol) - offset_ );
43 template<
typename Real>
45 if ( !isDualInitialized_ ) {
47 isDualInitialized_ =
true;
49 obj_->gradient(*dualVector_,x,tol);
51 setValue(jv,v.
apply(*dualVector_));
54 template<
typename Real>
56 obj_->gradient(ajv,x,tol);
57 ajv.
scale(getValue(v));
60 template<
typename Real>
62 obj_->hessVec(ahuv,v,x,tol);
63 ahuv.
scale(getValue(u));
66 template<
typename Real>
71 template<
typename Real>
78 #endif // ROL_CONSTRAINTFROMOBJECTIVE_H
Provides the interface to evaluate objective functions.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the constraint Jacobian at , , to vector .
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
void setValue(Vector< Real > &x, Real val)
const Ptr< Objective< Real > > getObjective(void) const
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Evaluate the constraint operator at .
Defines the linear algebra or vector space interface.
Real getValue(const Vector< Real > &x)
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update constraint function.
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
virtual void setParameter(const std::vector< Real > ¶m)
ConstraintFromObjective(const Ptr< Objective< Real >> &obj, const Real offset=0)
void setParameter(const std::vector< Real > ¶m) override
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the adjoint of the the constraint Jacobian at , , to vector .