ROL
ROL_Reduced_Objective_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_OBJECTIVE_SIMOPT_H
11#define ROL_REDUCED_OBJECTIVE_SIMOPT_H
12
16#include "ROL_BatchManager.hpp"
17
18namespace ROL {
19
20template<typename Real>
21class Reduced_Objective_SimOpt : public Objective<Real> {
22private:
23 const Ptr<Objective_SimOpt<Real>> obj_;
24 const Ptr<Constraint_SimOpt<Real>> con_;
25 Ptr<VectorController<Real>> stateStore_;
26 Ptr<VectorController<Real>> adjointStore_;
27
28 // Primal vectors
29 Ptr<Vector<Real>> state_;
30 Ptr<Vector<Real>> adjoint_;
31 Ptr<Vector<Real>> state_sens_;
32 Ptr<Vector<Real>> adjoint_sens_;
33
34 // Dual vectors
35 Ptr<Vector<Real>> dualstate_;
36 Ptr<Vector<Real>> dualstate1_;
37 Ptr<Vector<Real>> dualadjoint_;
38 Ptr<Vector<Real>> dualcontrol_;
39
40 const bool storage_;
41 const bool useFDhessVec_;
42
45
51
52public:
64 const Ptr<Objective_SimOpt<Real>> &obj,
65 const Ptr<Constraint_SimOpt<Real>> &con,
66 const Ptr<Vector<Real>> &state,
67 const Ptr<Vector<Real>> &control,
68 const Ptr<Vector<Real>> &adjoint,
69 const bool storage = true,
70 const bool useFDhessVec = false);
71
86 const Ptr<Objective_SimOpt<Real>> &obj,
87 const Ptr<Constraint_SimOpt<Real>> &con,
88 const Ptr<Vector<Real>> &state,
89 const Ptr<Vector<Real>> &control,
90 const Ptr<Vector<Real>> &adjoint,
91 const Ptr<Vector<Real>> &dualstate,
92 const Ptr<Vector<Real>> &dualcontrol,
93 const Ptr<Vector<Real>> &dualadjoint,
94 const bool storage = true,
95 const bool useFDhessVec = false);
96
109 const Ptr<Objective_SimOpt<Real>> &obj,
110 const Ptr<Constraint_SimOpt<Real>> &con,
111 const Ptr<VectorController<Real>> &stateStore,
112 const Ptr<Vector<Real>> &state,
113 const Ptr<Vector<Real>> &control,
114 const Ptr<Vector<Real>> &adjoint,
115 const bool storage = true,
116 const bool useFDhessVec = false);
117
133 const Ptr<Objective_SimOpt<Real>> &obj,
134 const Ptr<Constraint_SimOpt<Real>> &con,
135 const Ptr<VectorController<Real>> &stateStore,
136 const Ptr<Vector<Real>> &state,
137 const Ptr<Vector<Real>> &control,
138 const Ptr<Vector<Real>> &adjoint,
139 const Ptr<Vector<Real>> &dualstate,
140 const Ptr<Vector<Real>> &dualcontrol,
141 const Ptr<Vector<Real>> &dualadjoint,
142 const bool storage = true,
143 const bool useFDhessVec = false);
144
147 void update( const Vector<Real> &z, bool flag = true, int iter = -1 ) override;
148 void update( const Vector<Real> &z, UpdateType type, int iter = -1 ) override;
149
154 Real value( const Vector<Real> &z, Real &tol ) override;
155
161 void gradient( Vector<Real> &g, const Vector<Real> &z, Real &tol ) override;
162
166 void hessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &z, Real &tol ) override;
167
170 virtual void precond( Vector<Real> &Pv, const Vector<Real> &v, const Vector<Real> &z, Real &tol ) override;
171
174 void summarize(std::ostream &stream, const Ptr<BatchManager<Real>> &bman = nullPtr) const;
175
178 void reset();
179
180// For parametrized (stochastic) objective functions and constraints
181public:
182 void setParameter(const std::vector<Real> &param) override;
183
184private:
185 void solve_state_equation(const Vector<Real> &z, Real &tol);
186
191 void solve_adjoint_equation(const Vector<Real> &z, Real &tol);
192
197 void solve_state_sensitivity(const Vector<Real> &v, const Vector<Real> &z, Real &tol);
198
206 void solve_adjoint_sensitivity(const Vector<Real> &v, const Vector<Real> &z, Real &tol);
207
208}; // class Reduced_Objective_SimOpt
209
210} // namespace ROL
211
213
214#endif
Defines the constraint operator interface for simulation-based optimization.
Provides the interface to evaluate simulation-based objective functions.
Provides the interface to evaluate objective functions.
virtual void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &z, Real &tol) override
Apply a reduced Hessian preconditioner.
Ptr< VectorController< Real > > adjointStore_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &z, Real &tol) override
Given , evaluate the Hessian of the objective function in the direction .
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 .
Real value(const Vector< Real > &z, Real &tol) override
Given , evaluate the objective function where solves .
const Ptr< Constraint_SimOpt< Real > > con_
void solve_adjoint_equation(const Vector< Real > &z, Real &tol)
Given which solves the state equation, solve the adjoint equation for .
Ptr< VectorController< Real > > stateStore_
void update(const Vector< Real > &z, bool flag=true, int iter=-1) override
Update the SimOpt objective function and equality constraint.
void solve_state_equation(const Vector< Real > &z, Real &tol)
void gradient(Vector< Real > &g, const Vector< Real > &z, Real &tol) override
Given , evaluate the gradient of the objective function where solves .
void solve_adjoint_sensitivity(const Vector< Real > &v, const Vector< Real > &z, Real &tol)
Given , the adjoint variable , and a direction , solve the adjoint sensitvity equation for .
void setParameter(const std::vector< Real > &param) override
void summarize(std::ostream &stream, const Ptr< BatchManager< Real > > &bman=nullPtr) const
const Ptr< Objective_SimOpt< Real > > obj_
Defines the linear algebra or vector space interface.