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"
16
27namespace ROL {
28
29template<typename Real>
30class ConstraintFromObjective : public Constraint<Real> {
31private:
32 const Ptr<Objective<Real>> obj_;
33 Ptr<Vector<Real>> dualVector_;
34 const Real offset_;
36
37public:
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
51private:
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
Creates a constraint from an objective function and a offset value.
void setValue(Vector< Real > &x, Real val)
void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update constraint function.
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol) override
Evaluate the constraint operator at .
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 ,...
const Ptr< Objective< Real > > obj_
void setParameter(const std::vector< Real > &param) override
const Ptr< Objective< Real > > getObjective(void) const
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 .
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol) override
Apply the constraint Jacobian at , , to vector .
Defines the general constraint operator interface.
Provides the interface to evaluate objective functions.
Defines the linear algebra or vector space interface.