ROL
ROL_ConstraintFromObjective.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_CONSTRAINTFROMOBJECTIVE_H
11 #define ROL_CONSTRAINTFROMOBJECTIVE_H
12 
13 #include "ROL_Objective.hpp"
14 #include "ROL_Constraint.hpp"
15 #include "ROL_SingletonVector.hpp"
16 
27 namespace ROL {
28 
29 template<typename Real>
30 class ConstraintFromObjective : public Constraint<Real> {
31 private:
32  const Ptr<Objective<Real>> obj_;
33  Ptr<Vector<Real>> dualVector_;
34  const Real offset_;
36 
37 public:
38  ConstraintFromObjective( const Ptr<Objective<Real>> &obj, const Real offset = 0 );
39 
40  const Ptr<Objective<Real>> getObjective(void) const;
41 
42  void setParameter( const std::vector<Real> &param ) override;
43 
44  void update( const Vector<Real>& x, UpdateType type, int iter = -1 ) override;
45  void update( const Vector<Real>& x, bool flag = true, int iter = -1 ) override;
46  void value( Vector<Real>& c, const Vector<Real>& x, Real& tol ) override;
47  void applyJacobian( Vector<Real>& jv, const Vector<Real>& v, const Vector<Real>& x, Real& tol ) override;
48  void applyAdjointJacobian( Vector<Real>& ajv, const Vector<Real>& v, const Vector<Real>& x, Real& tol ) override;
49  void applyAdjointHessian( Vector<Real>& ahuv, const Vector<Real>& u, const Vector<Real>& v, const Vector<Real>& x, Real& tol ) override;
50 
51 private:
52  Real getValue( const Vector<Real>& x );
53  void setValue( Vector<Real>& x, Real val );
54 
55 }; // ConstraintFromObjective
56 
57 } // namespace ROL
58 
60 
61 #endif // ROL_CONSTRAINTFROMOBJECTIVE_H
Provides the interface to evaluate objective functions.
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the constraint Jacobian at , , to vector .
void setValue(Vector< Real > &x, Real val)
Creates a constraint from an objective function and a offset value.
const Ptr< Objective< Real > > obj_
const Ptr< Objective< Real > > getObjective(void) const
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Evaluate the constraint operator at .
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 constraint function.
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
ConstraintFromObjective(const Ptr< Objective< Real >> &obj, const Real offset=0)
void setParameter(const std::vector< Real > &param) override
void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the adjoint of the the constraint Jacobian at , , to vector .
Defines the general constraint operator interface.