44 #ifndef ROL_LINEARCOMBINATIONOBJECTIVE_H 45 #define ROL_LINEARCOMBINATIONOBJECTIVE_H 49 #include "Teuchos_RCP.hpp" 57 std::vector<Teuchos::RCP<Objective<Real> > >
obj_;
66 :
Objective<Real>(), weights_(weights), obj_(obj), size_(weights.size()),
67 xdual_(Teuchos::null), initialized_(false) {}
71 for (
size_t i = 0; i <
size_; i++) {
72 val += weights_[i]*obj_[i]->value(x,tol);
83 for (
size_t i = 0; i <
size_; i++) {
84 obj_[i]->gradient(*xdual_,x,tol);
85 g.
axpy(weights_[i],*xdual_);
95 for (
size_t i = 0; i <
size_; i++) {
96 obj_[i]->hessVec(*xdual_,v,x,tol);
97 hv.
axpy(weights_[i],*xdual_);
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.
std::vector< Teuchos::RCP< Objective< Real > > > obj_
Teuchos::RCP< Vector< Real > > xdual_
Real value(const Vector< Real > &x, Real &tol)
Compute value.
const std::vector< Real > weights_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.