ROL
ROL_AffineTransformObjective.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_AFFINE_TRANSFORM_OBJECTIVE_H
11 #define ROL_AFFINE_TRANSFORM_OBJECTIVE_H
12 
13 #include "ROL_Objective.hpp"
14 #include "ROL_LinearConstraint.hpp"
15 #include "ROL_VectorController.hpp"
16 
25 namespace ROL {
26 
27 template<typename Real>
28 class AffineTransformObjective : public Objective<Real> {
29 private:
30  const Ptr<Objective<Real>> obj_;
31  const Ptr<Constraint<Real>> acon_;
32 
33  Ptr<VectorController<Real>> storage_;
34  Ptr<Vector<Real>> primal_, dual_, Av_;
35 
36 public:
39  const Ptr<Constraint<Real>> &acon,
40  const Vector<Real> &range,
41  const Ptr<VectorController<Real>> &storage = nullPtr);
43  const Ptr<LinearConstraint<Real>> &acon,
44  const Ptr<VectorController<Real>> &storage = nullPtr);
46  const Ptr<const LinearOperator<Real>> &A,
47  const Ptr<const Vector<Real>> &b,
48  const Ptr<VectorController<Real>> &storage = nullPtr);
49 
50  void update( const Vector<Real> &x, UpdateType type, int iter = -1 ) override;
51  void update( const Vector<Real> &x, bool flag = true, int iter = -1 ) override;
52  Real value( const Vector<Real> &x, Real &tol ) override;
53  void gradient( Vector<Real> &g, const Vector<Real> &x, Real &tol ) override;
54  void hessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) override;
55  const Ptr<Objective<Real>> getObjective() const {return obj_;}
56 
57 public:
58  void setParameter(const std::vector<Real> &param) override;
59 
60 private:
61  Ptr<const Vector<Real>> transform(const Vector<Real> &x);
62 
63 }; // class AffineTransformObjective
64 
65 } // namespace ROL
66 
68 
69 #endif // ROL_AFFINE_TRANSFORM_OBJECTIVE_H
Provides the interface to evaluate objective functions.
Defines the general affine constraint with the form .
const Ptr< Objective< Real > > getObjective() const
Compose an objective function with an affine transformation, i.e.,.
Real value(const Vector< Real > &x, Real &tol) override
Compute value.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply Hessian approximation to vector.
Ptr< VectorController< Real > > storage_
void setParameter(const std::vector< Real > &param) override
const Ptr< Constraint< Real > > acon_
Ptr< const Vector< Real > > transform(const Vector< Real > &x)
AffineTransformObjective(const Ptr< Objective< Real >> &obj, const Ptr< Constraint< Real >> &acon, const Vector< Real > &range, const Ptr< VectorController< Real >> &storage=nullPtr)
Provides the interface to apply a linear operator.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Compute gradient.
const Ptr< Objective< Real > > obj_
Defines the general constraint operator interface.