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"
20#include <iostream>
21
22namespace ROL {
23
24template<typename Real>
25class FletcherObjectiveBase : public Objective<Real> {
26protected:
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
62public:
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);
82 void reset(Real sigma, Real delta);
83
84protected:
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
Contains definitions of custom data types in ROL.
Defines the general constraint operator interface.
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< VectorController< Real, int > > g_
Ptr< const Vector< Real > > getLagrangianGradient(const Vector< Real > &x)
Ptr< const Vector< Real > > getConstraintVec(const Vector< Real > &x)
void objGrad(Vector< Real > &g, const Vector< Real > &x, Real &tol)
const Ptr< Objective< Real > > obj_
Ptr< VectorController< Real, int > > gPhi_
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
Real objValue(const Vector< Real > &x, Real &tol)
Ptr< ScalarController< Real, int > > fval_
Ptr< VectorController< Real, int > > c_
Real getObjectiveValue(const Vector< Real > &x)
void conValue(Vector< Real > &c, const Vector< Real > &x, Real &tol)
Ptr< PartitionedVector< Real > > bb_
Ptr< PartitionedVector< Real > > ww_
Ptr< ScalarController< Real, int > > fPhi_
Ptr< PartitionedVector< Real > > vv_
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)
const Ptr< Constraint< Real > > con_
Ptr< VectorController< Real, int > > y_
Ptr< const Vector< Real > > getMultiplierVec(const Vector< Real > &x)
Provides the interface to evaluate objective functions.
Defines the linear algebra or vector space interface.