10 #ifndef ROL_ELASTICOBJECTIVEDEF_H
11 #define ROL_ELASTICOBJECTIVEDEF_H
16 template<
typename Real>
19 const Real penaltyParameter,
24 ParameterList &parlist)
25 : sigma_(sigma), cscale_(1) {
26 alobj_ = makePtr<AugmentedLagrangianObjective<Real>>(obj,con,penaltyParameter,dualOptVec,primConVec,dualConVec,parlist);
27 e_ = primConVec.clone(); e_->setScalar(static_cast<Real>(1));
28 tmp_ = primConVec.clone();
31 template<
typename Real>
34 const Real penaltyParameter,
39 const bool scaleLagrangian,
40 const int HessianApprox)
41 : sigma_(sigma), cscale_(1) {
42 alobj_ = makePtr<AugmentedLagrangianObjective<Real>>(obj,con,penaltyParameter,dualOptVec,primConVec,dualConVec,scaleLagrangian,HessianApprox);
43 e_ = primConVec.clone(); e_->setScalar(static_cast<Real>(1));
44 tmp_ = primConVec.clone();
47 template<
typename Real>
50 alobj_->update(*xs,type,iter);
53 template<
typename Real>
56 alobj_->setScaling(fscale,cscale);
59 template<
typename Real>
64 Real val = alobj_->value(*xs,tol);
65 tmp_->set(*xu); tmp_->plus(*xv);
66 Real pen = sigma_ * cscale_ * e_->dot(*tmp_);
70 template<
typename Real>
76 alobj_->gradient(*gs,*xs,tol);
77 gu->set(*e_); gu->scale(sigma_ * cscale_);
78 gv->set(*e_); gv->scale(sigma_ * cscale_);
81 template<
typename Real>
88 alobj_->hessVec(*hvs,*vs,*xs,tol);
93 template<
typename Real>
95 return alobj_->getObjectiveValue(x,tol);
98 template<
typename Real>
100 return alobj_->getObjectiveGradient(x,tol);
103 template<
typename Real>
105 return alobj_->getConstraintVec(x,tol);
108 template<
typename Real>
110 return alobj_->getNumberConstraintEvaluations();
113 template<
typename Real>
115 return alobj_->getNumberFunctionEvaluations();
118 template<
typename Real>
120 return alobj_->getNumberGradientEvaluations();
123 template<
typename Real>
126 alobj_->reset(multiplier,penaltyParameter);
129 template<
typename Real>
Provides the interface to evaluate objective functions.
const Ptr< const Vector< Real > > getConstraintVec(const Vector< Real > &x, Real &tol)
Ptr< AugmentedLagrangianObjective< Real > > alobj_
Defines the linear algebra of vector space on a generic partitioned vector.
int getNumberFunctionEvaluations(void) const
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Compute gradient.
const Ptr< AugmentedLagrangianObjective< Real > > getAugmentedLagrangian(void) const
Defines the linear algebra or vector space interface.
Real getObjectiveValue(const Vector< Real > &x, Real &tol)
void setScaling(const Real fscale=1.0, const Real cscale=1.0)
const Ptr< const Vector< Real > > getObjectiveGradient(const Vector< Real > &x, Real &tol)
int getNumberConstraintEvaluations(void) const
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply Hessian approximation to vector.
Real value(const Vector< Real > &x, Real &tol) override
Compute value.
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
int getNumberGradientEvaluations(void) const
ElasticObjective(const Ptr< Objective< Real >> &obj, const Ptr< Constraint< Real >> &con, const Real penaltyParameter, const Real sigma, const Vector< Real > &dualOptVec, const Vector< Real > &primConVec, const Vector< Real > &dualConVec, ParameterList &parlist)
void reset(const Vector< Real > &multiplier, Real penaltyParameter, Real sigma)
Ptr< Vector< Real > > tmp_
Defines the general constraint operator interface.