44 #ifndef ROL_COMPOSITE_EQUALITY_CONSTRAINT_SIMOPT_H 45 #define ROL_COMPOSITE_EQUALITY_CONSTRAINT_SIMOPT_H 78 const Teuchos::RCP<EqualityConstraint_SimOpt<Real> >
conVal_;
79 const Teuchos::RCP<EqualityConstraint_SimOpt<Real> >
conRed_;
81 Teuchos::RCP<Vector<Real> >
Sz_;
98 bool isComputed =
false;
100 isComputed = stateStore_->get(*Sz_,param);
103 if (!isComputed || !storage_) {
105 conRed_->update_2(z,updateFlag_,updateIter_);
107 conRed_->solve(*primRed_,*Sz_,z,tol);
109 conRed_->update_1(*Sz_,updateFlag_,updateIter_);
111 conRed_->update(*Sz_, z, updateFlag_, updateIter_);
114 stateStore_->set(*Sz_,param);
123 conRed_->applyJacobian_2(*primRed_, v, *Sz_, z, tol);
124 conRed_->applyInverseJacobian_1(jv, *primRed_, *Sz_, z, tol);
125 jv.
scale(static_cast<Real>(-1));
132 conRed_->applyInverseAdjointJacobian_1(*dualRed_, v, *Sz_, z, tol);
133 conRed_->applyAdjointJacobian_2(ajv, *dualRed_, *Sz_, z, tol);
134 ajv.
scale(static_cast<Real>(-1));
142 const bool storage =
true,
const bool isConRedParametrized =
false)
144 updateFlag_(true), updateIter_(0), storage_(storage),
145 isConRedParametrized_(isConRedParametrized) {
147 primRed_ = cRed.
clone();
148 dualRed_ = cRed.
dual().clone();
150 dualZ_ = z.
dual().clone();
151 dualZ1_ = z.
dual().clone();
162 conVal_->update_1(u, flag, iter);
164 conVal_->update(u, *Sz_, flag, iter);
172 Real ctol = std::sqrt(ROL_EPSILON<Real>());
173 stateStore_->equalityConstraintUpdate(
true);
179 conVal_->value(c, u, *Sz_, tol);
184 conVal_->solve(c, u, *Sz_, tol);
190 conVal_->applyJacobian_1(jv, v, u, *Sz_, tol);
196 conVal_->applyJacobian_2(jv, *primZ_, u, *Sz_, tol);
202 conVal_->applyInverseJacobian_1(ijv, v, u, *Sz_, tol);
208 conVal_->applyAdjointJacobian_1(ajv, v, u, *Sz_, tol);
214 conVal_->applyAdjointJacobian_2(*dualZ_, v, u, *Sz_, tol);
221 conVal_->applyInverseAdjointJacobian_1(ijv, v, u, *Sz_, tol);
227 conVal_->applyAdjointHessian_11(ahwv, w, v, u, z, tol);
233 conVal_->applyAdjointHessian_12(*dualZ_, w, v, u, *Sz_, tol);
240 conVal_->applyAdjointHessian_21(ahwv, w, *primZ_, u, *Sz_, tol);
248 conVal_->applyAdjointJacobian_2(*dualZ_, w, u, *Sz_, tol);
249 conRed_->applyInverseAdjointJacobian_1(*dualRed_, *dualZ_, *Sz_, z, tol);
250 conRed_->applyAdjointHessian_22(*dualZ_, *dualRed_, v, *Sz_, z, tol);
251 ahwv.
axpy(static_cast<Real>(-1), *dualZ_);
252 conRed_->applyAdjointHessian_12(*dualZ_, *dualRed_, *primZ_, *Sz_, z, tol);
253 ahwv.
axpy(static_cast<Real>(-1), *dualZ_);
255 conRed_->applyAdjointHessian_11(*dualZ1_, *dualRed_, *primZ_, *Sz_, z, tol);
256 conRed_->applyAdjointHessian_21(*dualZ_, *dualRed_, v, *Sz_, z, tol);
257 dualZ1_->plus(*dualZ_);
258 dualZ1_->scale(static_cast<Real>(-1));
260 conVal_->applyAdjointHessian_22(*dualZ_, w, *primZ_, u, *Sz_, tol);
261 dualZ1_->plus(*dualZ_);
270 conVal_->setParameter(param);
271 if (isConRedParametrized_) {
272 conRed_->setParameter(param);
void update_2(const Vector< Real > &z, bool flag=true, int iter=-1)
Update constraint functions with respect to Opt variable. x is the optimization variable, flag = true if optimization variable is changed, iter is the outer algorithm iterations count.
virtual void scale(const Real alpha)=0
Compute where .
void applyInverseAdjointJacobian_1(Vector< Real > &ijv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the inverse of the adjoint of the partial constraint Jacobian at , , to the vector ...
void solveConRed(const Vector< Real > &z, Real &tol)
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
void applyAdjointHessian_21(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the simulation-space derivative of the adjoint of the constraint optimization-space Jacobian at...
Teuchos::RCP< SimController< Real > > stateStore_
virtual void setParameter(const std::vector< Real > ¶m)
const std::vector< Real > getParameter(void) const
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
const Teuchos::RCP< EqualityConstraint_SimOpt< Real > > conRed_
const bool isConRedParametrized_
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
Defines the equality constraint operator interface for simulation-based optimization.
void update_1(const Vector< Real > &u, bool flag=true, int iter=-1)
Update constraint functions with respect to Sim variable. x is the optimization variable, flag = true if optimization variable is changed, iter is the outer algorithm iterations count.
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 > > primZ_
void applySens(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &z, Real &tol)
void applyAdjointHessian_12(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the optimization-space derivative of the adjoint of the constraint simulation-space Jacobian at...
void update(const Vector< Real > &u, const Vector< Real > &z, bool flag=true, int iter=-1)
Update constraint functions. x is the optimization variable, flag = true if optimization variable is ...
void applyAdjointHessian_11(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the simulation-space derivative of the adjoint of the constraint simulation-space Jacobian at ...
Teuchos::RCP< Vector< Real > > primRed_
void applyAdjointSens(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &z, Real &tol)
Teuchos::RCP< Vector< Real > > dualZ_
void applyAdjointJacobian_2(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the adjoint of the partial constraint Jacobian at , , to vector . This is the primary interface...
void applyAdjointHessian_22(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the optimization-space derivative of the adjoint of the constraint optimization-space Jacobian ...
void solve(Vector< Real > &c, Vector< Real > &u, const Vector< Real > &z, Real &tol)
Given , solve for .
void setParameter(const std::vector< Real > ¶m)
Teuchos::RCP< Vector< Real > > dualZ1_
const Teuchos::RCP< EqualityConstraint_SimOpt< Real > > conVal_
Teuchos::RCP< Vector< Real > > dualRed_
void applyJacobian_1(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the partial constraint Jacobian at , , to the vector .
void applyAdjointJacobian_1(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the adjoint of the partial constraint Jacobian at , , to the vector . This is the primary inter...
void applyInverseJacobian_1(Vector< Real > &ijv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the inverse partial constraint Jacobian at , , to the vector .
void applyJacobian_2(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply the partial constraint Jacobian at , , to the vector .
Teuchos::RCP< Vector< Real > > Sz_
void value(Vector< Real > &c, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Evaluate the constraint operator at .
CompositeEqualityConstraint_SimOpt(const Teuchos::RCP< EqualityConstraint_SimOpt< Real > > &conVal, const Teuchos::RCP< EqualityConstraint_SimOpt< Real > > &conRed, const Vector< Real > &cVal, const Vector< Real > &cRed, const Vector< Real > &u, const Vector< Real > &Sz, const Vector< Real > &z, const bool storage=true, const bool isConRedParametrized=false)
Defines a composite equality constraint operator interface for simulation-based optimization.