ROL
ROL_FletcherObjectiveBase.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_FLETCHEROBJECTVEBASE_H
11 #define ROL_FLETCHEROBJECTVEBASE_H
12 
13 #include "ROL_Objective.hpp"
14 #include "ROL_Constraint.hpp"
15 #include "ROL_Types.hpp"
16 #include "ROL_Ptr.hpp"
17 #include "ROL_KrylovFactory.hpp"
19 #include "ROL_ScalarController.hpp"
20 #include <iostream>
21 
22 namespace ROL {
23 
24 template<typename Real>
25 class FletcherObjectiveBase : public Objective<Real> {
26 protected:
27  const Ptr<Objective<Real>> obj_;
28  const Ptr<Constraint<Real>> con_;
29 
30  Real sigma_; // penalty parameter
31  Real delta_; // regularization parameter
32  Real quadPenaltyParameter_; // augmented Lagrangian penalty parameter
35 
36  // Evaluation counters
38 
39  Ptr<ScalarController<Real,int>> fPhi_; // value of penalty function
40  Ptr<VectorController<Real,int>> gPhi_; // gradient of penalty function
41  Ptr<VectorController<Real,int>> y_; // multiplier estimate
42  Ptr<ScalarController<Real,int>> fval_; // value of objective function
43  Ptr<VectorController<Real,int>> g_; // gradient of objective value
44  Ptr<VectorController<Real,int>> c_; // constraint value
45 
46  Ptr<Vector<Real>> scaledc_; // penaltyParameter_ * c_
47  Ptr<Vector<Real>> gL_; // gradient of Lagrangian (g - A*y)
48  Ptr<Vector<Real>> gLdual_; // dual gradient of Lagrangian (g - A*y)
49  Ptr<Vector<Real>> xprim_, xdual_, cprim_, cdual_;
50 
51  Real cnorm_; // norm of constraint violation
52 
53  Real multSolverError_; // Error from augmented system solve in value()
54  Real gradSolveError_; // Error from augmented system solve in gradient()
55 
56  // For Augmented system solves
57  Ptr<Krylov<Real>> krylov_;
59  Ptr<Vector<Real>> v1_, v2_, b1_, b2_, w1_, w2_;
60  Ptr<PartitionedVector<Real>> vv_, bb_, ww_;
61 
62 public:
63  FletcherObjectiveBase(const Ptr<Objective<Real>> &obj,
64  const Ptr<Constraint<Real>> &con,
65  const Vector<Real> &xprim,
66  const Vector<Real> &xdual,
67  const Vector<Real> &cprim,
68  const Vector<Real> &cdual,
69  ParameterList &parlist);
70 
71  virtual void update( const Vector<Real> &x, UpdateType type, int iter = -1 ) override;
72 
73  // Accessors
74  Ptr<const Vector<Real>> getLagrangianGradient(const Vector<Real>& x);
75  Ptr<const Vector<Real>> getConstraintVec(const Vector<Real>& x);
76  Ptr<const Vector<Real>> getMultiplierVec(const Vector<Real>& x);
77  Ptr<const Vector<Real>> getGradient(const Vector<Real>& x);
78  Real getObjectiveValue(const Vector<Real>& x);
79  int getNumberFunctionEvaluations() const;
80  int getNumberGradientEvaluations() const;
82  void reset(Real sigma, Real delta);
83 
84 protected:
85  Real objValue(const Vector<Real>& x, Real &tol);
86  void objGrad(Vector<Real> &g, const Vector<Real>& x, Real &tol);
87  void conValue(Vector<Real> &c, const Vector<Real>&x, Real &tol);
88  void computeMultipliers(Vector<Real> &y, Vector<Real> &gL, const Vector<Real> &x, Vector<Real> &g, Vector<Real> &c, Real tol);
89  virtual void solveAugmentedSystem(Vector<Real> &v1, Vector<Real> &v2, const Vector<Real> &b1, const Vector<Real> &b2, const Vector<Real> &x, Real &multSolverError_, bool refine) = 0;
90 
91 }; // class FletcherObjectiveBase
92 
93 } // namespace ROL
94 
96 
97 #endif
Provides the interface to evaluate objective functions.
Ptr< const Vector< Real > > getGradient(const Vector< Real > &x)
void computeMultipliers(Vector< Real > &y, Vector< Real > &gL, const Vector< Real > &x, Vector< Real > &g, Vector< Real > &c, Real tol)
Ptr< VectorController< Real, int > > g_
Real objValue(const Vector< Real > &x, Real &tol)
const Ptr< Constraint< Real > > con_
Contains definitions of custom data types in ROL.
Ptr< ScalarController< Real, int > > fPhi_
Ptr< ScalarController< Real, int > > fval_
Ptr< const Vector< Real > > getMultiplierVec(const Vector< Real > &x)
Ptr< VectorController< Real, int > > y_
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
void objGrad(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Ptr< PartitionedVector< Real > > vv_
Ptr< VectorController< Real, int > > gPhi_
Ptr< PartitionedVector< Real > > ww_
Real getObjectiveValue(const Vector< Real > &x)
const Ptr< Objective< Real > > obj_
virtual void solveAugmentedSystem(Vector< Real > &v1, Vector< Real > &v2, const Vector< Real > &b1, const Vector< Real > &b2, const Vector< Real > &x, Real &multSolverError_, bool refine)=0
Ptr< PartitionedVector< Real > > bb_
Ptr< VectorController< Real, int > > c_
Ptr< const Vector< Real > > getConstraintVec(const Vector< Real > &x)
FletcherObjectiveBase(const Ptr< Objective< Real >> &obj, const Ptr< Constraint< Real >> &con, const Vector< Real > &xprim, const Vector< Real > &xdual, const Vector< Real > &cprim, const Vector< Real > &cdual, ParameterList &parlist)
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
Ptr< const Vector< Real > > getLagrangianGradient(const Vector< Real > &x)
Defines the general constraint operator interface.
void conValue(Vector< Real > &c, const Vector< Real > &x, Real &tol)