ROL
ROL_Reduced_Constraint_SimOpt.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_REDUCED_CONSTRAINT_SIMOPT_H
11 #define ROL_REDUCED_CONSTRAINT_SIMOPT_H
12 
14 #include "ROL_VectorController.hpp"
15 #include "ROL_BatchManager.hpp"
16 
17 namespace ROL {
18 
19 template <class Real>
20 class Reduced_Constraint_SimOpt : public Constraint<Real> {
21 private:
22  const ROL::Ptr<Constraint_SimOpt<Real>> conVal_, conRed_;
23  const ROL::Ptr<VectorController<Real>> stateStore_, adjointStore_;
24 
25  // Primal vectors
26  const ROL::Ptr<Vector<Real>> state_, adjoint_, residual_;
27  const ROL::Ptr<Vector<Real>> state_sens_, adjoint_sens_;
28 
29  // Dual vectors
30  const ROL::Ptr<Vector<Real>> dualstate_, dualstate1_, dualadjoint_;
31  const ROL::Ptr<Vector<Real>> dualcontrol_, dualresidual_;
32 
33  const bool storage_;
34  const bool useFDhessVec_;
35 
37  unsigned nstat_, nadjo_, nssen_, nasen_;
38 
42  bool newUpdate_;
43  bool isUpdated_;
44 
45  void solve_state_equation(const Vector<Real> &z, Real &tol);
46 
51  void solve_adjoint_equation(const Vector<Real> &w, const Vector<Real> &z, Real &tol);
52 
57  void solve_state_sensitivity(const Vector<Real> &v, const Vector<Real> &z, Real &tol);
58 
66  void solve_adjoint_sensitivity(const Vector<Real> &w, const Vector<Real> &v, const Vector<Real> &z, Real &tol);
67 
68 public:
82  const ROL::Ptr<Constraint_SimOpt<Real>> &conVal,
83  const ROL::Ptr<Constraint_SimOpt<Real>> &conRed,
84  const ROL::Ptr<VectorController<Real>> &stateStore,
85  const ROL::Ptr<Vector<Real>> &state,
86  const ROL::Ptr<Vector<Real>> &control,
87  const ROL::Ptr<Vector<Real>> &adjoint,
88  const ROL::Ptr<Vector<Real>> &residual,
89  bool storage = true,
90  bool useFDhessVec = false);
91 
109  const ROL::Ptr<Constraint_SimOpt<Real>> &conVal,
110  const ROL::Ptr<Constraint_SimOpt<Real>> &conRed,
111  const ROL::Ptr<VectorController<Real>> &stateStore,
112  const ROL::Ptr<Vector<Real>> &state,
113  const ROL::Ptr<Vector<Real>> &control,
114  const ROL::Ptr<Vector<Real>> &adjoint,
115  const ROL::Ptr<Vector<Real>> &residual,
116  const ROL::Ptr<Vector<Real>> &dualstate,
117  const ROL::Ptr<Vector<Real>> &dualcontrol,
118  const ROL::Ptr<Vector<Real>> &dualadjoint,
119  const ROL::Ptr<Vector<Real>> &dualresidual,
120  bool storage = true,
121  bool useFDhessVec = false);
122 
123  void summarize(std::ostream &stream, const Ptr<BatchManager<Real>> &bman = nullPtr) const;
124 
125  void reset();
126 
129  void update( const Vector<Real> &z, bool flag = true, int iter = -1 );
130  void update( const Vector<Real> &z, UpdateType type, int iter = -1 );
131 
136  void value( Vector<Real> &c, const Vector<Real> &z, Real &tol );
137 
143  void applyJacobian( Vector<Real> &jv, const Vector<Real> &v,
144  const Vector<Real> &z, Real &tol );
145 
146  void applyAdjointJacobian( Vector<Real> &ajw, const Vector<Real> &w,
147  const Vector<Real> &z, Real &tol );
148 
152  void applyAdjointHessian( Vector<Real> &ahwv, const Vector<Real> &w,
153  const Vector<Real> &v, const Vector<Real> &z,
154  Real &tol );
155 
156 // For parametrized (stochastic) objective functions and constraints
157 public:
158  void setParameter(const std::vector<Real> &param) {
160  conVal_->setParameter(param);
161  conRed_->setParameter(param);
162  }
163 }; // class Reduced_Constraint_SimOpt
164 
165 } // namespace ROL
166 
168 
169 #endif
const ROL::Ptr< Vector< Real > > dualadjoint_
Reduced_Constraint_SimOpt(const ROL::Ptr< Constraint_SimOpt< Real >> &conVal, const ROL::Ptr< Constraint_SimOpt< Real >> &conRed, const ROL::Ptr< VectorController< Real >> &stateStore, const ROL::Ptr< Vector< Real >> &state, const ROL::Ptr< Vector< Real >> &control, const ROL::Ptr< Vector< Real >> &adjoint, const ROL::Ptr< Vector< Real >> &residual, bool storage=true, bool useFDhessVec=false)
Constructor.
void solve_state_sensitivity(const Vector< Real > &v, const Vector< Real > &z, Real &tol)
Given which solves the state equation and a direction , solve the state senstivity equation for ...
void applyAdjointHessian(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &z, Real &tol)
Given , evaluate the Hessian of the objective function in the direction .
const ROL::Ptr< Vector< Real > > dualstate1_
const ROL::Ptr< Vector< Real > > state_
void applyAdjointJacobian(Vector< Real > &ajw, const Vector< Real > &w, const Vector< Real > &z, Real &tol)
Apply the adjoint of the the constraint Jacobian at , , to vector .
void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &z, Real &tol)
Given , apply the Jacobian to a vector where solves .
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
const ROL::Ptr< VectorController< Real > > stateStore_
void solve_state_equation(const Vector< Real > &z, Real &tol)
void value(Vector< Real > &c, const Vector< Real > &z, Real &tol)
Given , evaluate the equality constraint where solves .
const ROL::Ptr< Vector< Real > > dualresidual_
void solve_adjoint_equation(const Vector< Real > &w, const Vector< Real > &z, Real &tol)
Given which solves the state equation, solve the adjoint equation for .
const ROL::Ptr< Vector< Real > > adjoint_
void solve_adjoint_sensitivity(const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &z, Real &tol)
Given , the adjoint variable , and a direction , solve the adjoint sensitvity equation for ...
virtual void setParameter(const std::vector< Real > &param)
const ROL::Ptr< Vector< Real > > dualcontrol_
const ROL::Ptr< Vector< Real > > state_sens_
const ROL::Ptr< Vector< Real > > dualstate_
const ROL::Ptr< Constraint_SimOpt< Real > > conVal_
const ROL::Ptr< Vector< Real > > adjoint_sens_
void setParameter(const std::vector< Real > &param)
const ROL::Ptr< Constraint_SimOpt< Real > > conRed_
Defines the constraint operator interface for simulation-based optimization.
void update(const Vector< Real > &z, bool flag=true, int iter=-1)
Update the SimOpt objective function and equality constraint.
Defines the general constraint operator interface.
const ROL::Ptr< VectorController< Real > > adjointStore_
void summarize(std::ostream &stream, const Ptr< BatchManager< Real >> &bman=nullPtr) const
const ROL::Ptr< Vector< Real > > residual_