45 #ifndef ROL_REDUCED_PARAMETRIZEDOBJECTIVE_SIMOPT_H 46 #define ROL_REDUCED_PARAMETRIZEDOBJECTIVE_SIMOPT_H 58 Teuchos::RCP<ParametrizedObjective_SimOpt<Real> >
obj_;
59 Teuchos::RCP<ParametrizedEqualityConstraint_SimOpt<Real> >
con_;
83 if ( state_storage_.count(this->getParameter()) && storage_ ) {
88 con_->update_2(x,flag,iter);
90 con_->solve(*dualadjoint_,*state_,x,tol);
92 con_->update_1(*state_,flag,iter);
94 obj_->update(*state_,x,flag,iter);
97 state_storage_.insert(
98 std::pair<std::vector<Real>,Teuchos::RCP<
Vector<Real> > >(
111 if ( adjoint_storage_.count(this->getParameter()) && storage_ ) {
116 obj_->gradient_1(*dualstate_,*state_,x,tol);
118 con_->applyInverseAdjointJacobian_1(*adjoint_,*dualstate_,*state_,x,tol);
119 adjoint_->scale(-1.0);
122 adjoint_storage_.insert(
123 std::pair<std::vector<Real>,Teuchos::RCP<
Vector<Real> > >(
136 con_->applyJacobian_2(*dualadjoint_,v,*state_,x,tol);
137 dualadjoint_->scale(-1.0);
138 con_->applyInverseJacobian_1(*state_sens_,*dualadjoint_,*state_,x,tol);
150 obj_->hessVec_11(*dualstate_,*state_sens_,*state_,x,tol);
151 obj_->hessVec_12(*dualstate1_,v,*state_,x,tol);
152 dualstate_->plus(*dualstate1_);
154 con_->applyAdjointHessian_11(*dualstate1_,*adjoint_,*state_sens_,*state_,x,tol);
155 dualstate_->plus(*dualstate1_);
156 con_->applyAdjointHessian_21(*dualstate1_,*adjoint_,v,*state_,x,tol);
157 dualstate_->plus(*dualstate1_);
159 dualstate_->scale(-1.0);
160 con_->applyInverseAdjointJacobian_1(*adjoint_sens_,*dualstate_,*state_,x,tol);
176 bool storage =
true,
bool useFDhessVec =
false)
177 : obj_(obj), con_(con),
178 state_(state), state_sens_(state->clone()),
179 adjoint_(adjoint), adjoint_sens_(adjoint->clone()),
180 dualstate_(state->dual().clone()), dualstate1_(state->dual().clone()),
181 dualadjoint_(adjoint->dual().clone()), dualcontrol_(Teuchos::null),
182 storage_(storage), useFDhessVec_(useFDhessVec), is_initialized_(false) {
183 state_storage_.clear();
184 adjoint_storage_.clear();
205 bool storage =
true,
bool useFDhessVec =
false)
206 : obj_(obj), con_(con),
207 state_(state), state_sens_(state->clone()),
208 adjoint_(adjoint), adjoint_sens_(adjoint->clone()),
209 dualstate_(dualstate), dualstate1_(dualstate->clone()),
210 dualadjoint_(dualadjoint->clone()), dualcontrol_(Teuchos::null),
211 storage_(storage), useFDhessVec_(useFDhessVec), is_initialized_(false) {
212 state_storage_.clear();
213 adjoint_storage_.clear();
219 con_->setParameter(param);
220 obj_->setParameter(param);
227 state_storage_.clear();
229 adjoint_storage_.clear();
241 return obj_->value(*state_,x,tol);
250 if (!is_initialized_) {
251 dualcontrol_ = g.
clone();
252 is_initialized_ =
true;
259 obj_->gradient_2(*dualcontrol_,*state_,x,tol);
261 con_->applyAdjointJacobian_2(g,*adjoint_,*state_,x,tol);
262 g.
plus(*dualcontrol_);
269 if ( useFDhessVec_ ) {
273 if (!is_initialized_) {
274 dualcontrol_ = hv.
clone();
275 is_initialized_ =
true;
286 con_->applyAdjointJacobian_2(hv,*adjoint_sens_,*state_,x,tol);
287 obj_->hessVec_21(*dualcontrol_,*state_sens_,*state_,x,tol);
288 hv.
plus(*dualcontrol_);
289 obj_->hessVec_22(*dualcontrol_,v,*state_,x,tol);
290 hv.
plus(*dualcontrol_);
291 con_->applyAdjointHessian_12(*dualcontrol_,*adjoint_,*state_sens_,*state_,x,tol);
292 hv.
plus(*dualcontrol_);
293 con_->applyAdjointHessian_22(*dualcontrol_,*adjoint_,v,*state_,x,tol);
294 hv.
plus(*dualcontrol_);
Teuchos::RCP< Vector< Real > > adjoint_
std::map< std::vector< Real >, Teuchos::RCP< Vector< Real > > > state_storage_
Reduced_ParametrizedObjective_SimOpt(Teuchos::RCP< ParametrizedObjective_SimOpt< Real > > &obj, Teuchos::RCP< ParametrizedEqualityConstraint_SimOpt< Real > > &con, Teuchos::RCP< Vector< Real > > &state, Teuchos::RCP< Vector< Real > > &adjoint, bool storage=true, bool useFDhessVec=false)
Constructor.
Teuchos::RCP< Vector< Real > > dualadjoint_
virtual void plus(const Vector &x)=0
Compute , where .
void solve_adjoint_equation(const Vector< Real > &x, Real &tol)
Given which solves the state equation, solve the adjoint equation for .
void solve_state_equation(const Vector< Real > &x, Real &tol, bool flag=true, int iter=-1)
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update the SimOpt objective function and equality constraint.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Teuchos::RCP< ParametrizedEqualityConstraint_SimOpt< Real > > con_
Teuchos::RCP< Vector< Real > > dualstate_
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
void solve_adjoint_sensitivity(const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Given , the adjoint variable , and a direction , solve the adjoint sensitvity equation for ...
Teuchos::RCP< Vector< Real > > state_sens_
Defines the linear algebra or vector space interface.
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Given , evaluate the Hessian of the objective function in the direction .
Teuchos::RCP< ParametrizedObjective_SimOpt< Real > > obj_
Teuchos::RCP< Vector< Real > > dualcontrol_
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Teuchos::RCP< Vector< Real > > state_
void solve_state_sensitivity(const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Given which solves the state equation and a direction , solve the state senstivity equation for ...
void setParameter(const std::vector< Real > ¶m)
Teuchos::RCP< Vector< Real > > dualstate1_
Real value(const Vector< Real > &x, Real &tol)
Given , evaluate the objective function where solves .
const std::vector< Real > getParameter(void) const
std::map< std::vector< Real >, Teuchos::RCP< Vector< Real > > > adjoint_storage_
virtual void setParameter(const std::vector< Real > ¶m)
virtual void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply a reduced Hessian preconditioner.
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Given , evaluate the gradient of the objective function where solves .
virtual void set(const Vector &x)
Set where .
Reduced_ParametrizedObjective_SimOpt(Teuchos::RCP< ParametrizedObjective_SimOpt< Real > > &obj, Teuchos::RCP< ParametrizedEqualityConstraint_SimOpt< Real > > &con, Teuchos::RCP< Vector< Real > > &state, Teuchos::RCP< Vector< Real > > &adjoint, Teuchos::RCP< Vector< Real > > &dualstate, Teuchos::RCP< Vector< Real > > &dualadjoint, bool storage=true, bool useFDhessVec=false)
Secondary, general constructor for use with dual optimization vector spaces where the user does not d...
Teuchos::RCP< Vector< Real > > adjoint_sens_