44 #ifndef ROL_LINEARCOMBINATIONOBJECTIVE_H 45 #define ROL_LINEARCOMBINATIONOBJECTIVE_H 48 #include "Teuchos_RCP.hpp" 55 const std::vector<Teuchos::RCP<Objective<Real> > >
obj_;
65 xdual_(Teuchos::null), initialized_(false) {
67 weights_.clear(); weights_.assign(size_,static_cast<Real>(1));
72 :
Objective<Real>(), obj_(obj), weights_(weights), size_(weights.size()),
73 xdual_(Teuchos::null), initialized_(false) {}
76 for (
size_t i=0; i<
size_; ++i) {
77 obj_[i]->update(x,flag,iter);
83 for (
size_t i = 0; i <
size_; i++) {
84 val += weights_[i]*obj_[i]->value(x,tol);
95 for (
size_t i = 0; i <
size_; i++) {
96 obj_[i]->gradient(*xdual_,x,tol);
97 g.
axpy(weights_[i],*xdual_);
107 for (
size_t i = 0; i <
size_; i++) {
108 obj_[i]->hessVec(*xdual_,v,x,tol);
109 hv.
axpy(weights_[i],*xdual_);
117 for (
size_t i = 0; i <
size_; ++i) {
118 obj_[i]->setParameter(param);
Provides the interface to evaluate objective functions.
LinearCombinationObjective(const std::vector< Real > &weights, const std::vector< Teuchos::RCP< Objective< Real > > > &obj)
const double weights[4][5]
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
Teuchos::RCP< Vector< Real > > xdual_
LinearCombinationObjective(const std::vector< Teuchos::RCP< Objective< Real > > > &obj)
virtual void setParameter(const std::vector< Real > ¶m)
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
std::vector< Real > weights_
void setParameter(const std::vector< Real > ¶m)
Real value(const Vector< Real > &x, Real &tol)
Compute value.
const std::vector< Teuchos::RCP< Objective< Real > > > obj_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.