ROL
ROL_LinearCombinationObjective.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_LINEARCOMBINATIONOBJECTIVE_H
11 #define ROL_LINEARCOMBINATIONOBJECTIVE_H
12 
13 #include "ROL_Objective.hpp"
14 #include "ROL_Ptr.hpp"
15 
16 namespace ROL {
17 
18 template<typename Real>
19 class LinearCombinationObjective : public Objective<Real> {
20 private:
21  const std::vector<Ptr<Objective<Real>>> obj_;
22  std::vector<Real> weights_;
23  size_t size_;
24 
25  Ptr<Vector<Real>> xdual_;
27 
28 public:
29  LinearCombinationObjective(const std::vector<Ptr<Objective<Real>>> &obj);
30  LinearCombinationObjective(const std::vector<Real> &weights,
31  const std::vector<Ptr<Objective<Real>>> &obj);
32 
33  void update(const Vector<Real> &x, UpdateType type, int iter = -1) override;
34  void update(const Vector<Real> &x, bool flag = true, int iter = -1) override;
35  Real value( const Vector<Real> &x, Real &tol ) override;
36  void gradient( Vector<Real> &g, const Vector<Real> &x, Real &tol ) override;
37  void hessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) override;
38  void setParameter(const std::vector<Real> &param) override;
39 
40 }; // class LinearCombinationObjective
41 
42 } // namespace ROL
43 
45 
46 #endif
Provides the interface to evaluate objective functions.
const std::vector< Ptr< Objective< Real > > > obj_
const double weights[4][5]
Definition: ROL_Types.hpp:834
Real value(const Vector< Real > &x, Real &tol) override
Compute value.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Compute gradient.
LinearCombinationObjective(const std::vector< Ptr< Objective< Real >>> &obj)
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void setParameter(const std::vector< Real > &param) override
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply Hessian approximation to vector.
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.