44 #ifndef ROL_SIMULATED_EQUALITY_CONSTRAINT_H 45 #define ROL_SIMULATED_EQUALITY_CONSTRAINT_H 56 const Teuchos::RCP<SampleGenerator<Real> >
sampler_;
57 const Teuchos::RCP<EqualityConstraint_SimOpt<Real> >
pcon_;
66 const bool useWeights =
true)
75 Teuchos::RCP<const Vector<Real> > uptr = uz.
get_1();
76 Teuchos::RCP<const Vector<Real> > zptr = uz.get_2();
81 catch (
const std::bad_cast &e) {}
84 std::vector<Real> param;
85 Real weight(0), one(1);
87 param =
sampler_->getMyPoint(static_cast<int>(i));
88 weight =
sampler_->getMyWeight(static_cast<int>(i));
89 pcon_->setParameter(param);
90 pcon_->value(*(pc.
get(i)), *(pu.
get(i)), *zptr, tol);
92 pc.
get(i)->scale(weight);
107 Teuchos::RCP<const Vector<Real> > xuptr = xuz.
get_1();
108 Teuchos::RCP<const Vector<Real> > xzptr = xuz.get_2();
113 catch (
const std::bad_cast &e) {}
117 Teuchos::RCP<const Vector<Real> > vuptr = vuz.
get_1();
118 Teuchos::RCP<const Vector<Real> > vzptr = vuz.
get_2();
123 catch (
const std::bad_cast &e) {}
126 std::vector<Real> param;
127 Real weight(0), one(1);
129 param =
sampler_->getMyPoint(static_cast<int>(i));
130 weight =
sampler_->getMyWeight(static_cast<int>(i));
131 pcon_->setParameter(param);
134 pcon_->applyJacobian(*(pjv.
get(i)), vi, xi, tol);
136 pjv.
get(i)->scale(weight);
148 Teuchos::RCP<Vector<Real> > ajvuptr = ajvuz.
get_1();
149 Teuchos::RCP<Vector<Real> > ajvzptr = ajvuz.
get_2();
154 catch (
const std::bad_cast &e) {}
158 Teuchos::RCP<const Vector<Real> > xuptr = xuz.
get_1();
159 Teuchos::RCP<const Vector<Real> > xzptr = xuz.
get_2();
164 catch (
const std::bad_cast &e) {}
169 std::vector<Real> param;
170 Real weight(0), one(1);
171 Teuchos::RCP<Vector<Real> > tmp1 = ajvzptr->clone();
172 Teuchos::RCP<Vector<Real> > tmp2 = ajvzptr->clone();
174 param =
sampler_->getMyPoint(static_cast<int>(i));
175 weight =
sampler_->getMyWeight(static_cast<int>(i));
176 pcon_->setParameter(param);
179 pcon_->applyAdjointJacobian(ajvi, *(pv.
get(i)), xi, tol);
197 Teuchos::RCP<Vector<Real> > ahuvuptr = ahuvuz.
get_1();
198 Teuchos::RCP<Vector<Real> > ahuvzptr = ahuvuz.
get_2();
203 catch (
const std::bad_cast &e) {}
209 Teuchos::RCP<const Vector<Real> > vuptr = vuz.
get_1();
210 Teuchos::RCP<const Vector<Real> > vzptr = vuz.get_2();
215 catch (
const std::bad_cast &e) {}
219 Teuchos::RCP<const Vector<Real> > xuptr = xuz.
get_1();
220 Teuchos::RCP<const Vector<Real> > xzptr = xuz.
get_2();
225 catch (
const std::bad_cast &e) {}
228 std::vector<Real> param;
229 Real weight(0), one(1);
230 Teuchos::RCP<Vector<Real> > tmp1 = ahuvzptr->clone();
231 Teuchos::RCP<Vector<Real> > tmp2 = ahuvzptr->clone();
233 param =
sampler_->getMyPoint(static_cast<int>(i));
234 weight =
sampler_->getMyWeight(static_cast<int>(i));
235 pcon_->setParameter(param);
239 pcon_->applyAdjointHessian(ahuvi, *(pu.
get(i)), vi, xi, tol);
258 Teuchos::RCP<const Vector<Real> > xuptr = xuz.
get_1();
259 Teuchos::RCP<const Vector<Real> > xzptr = xuz.get_2();
264 catch (
const std::bad_cast &e) {}
268 Teuchos::RCP<const Vector<Real> > guptr = guz.
get_1();
269 Teuchos::RCP<const Vector<Real> > gzptr = guz.
get_2();
274 catch (
const std::bad_cast &e) {}
279 std::vector<Real> param;
280 Real weight(0), one(1);
282 param =
sampler_->getMyPoint(static_cast<int>(i));
283 weight =
sampler_->getMyWeight(static_cast<int>(i));
284 pcon_->setParameter(param);
287 pcon_->applyPreconditioner(*(ppv.
get(i)), *(pv.
get(i)), xi, gi, tol);
289 ppv.
get(i)->scale(one/(weight*weight));
void value(Vector< Real > &c, const Vector< Real > &x, Real &tol)
Evaluate the constraint operator at .
const Teuchos::RCP< EqualityConstraint_SimOpt< Real > > pcon_
const Teuchos::RCP< SampleGenerator< Real > > sampler_
Defines the linear algebra or vector space interface for simulation-based optimization.
virtual void applyPreconditioner(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, Real &tol)
Apply a constraint preconditioner at , , to vector . Ideally, this preconditioner satisfies the follo...
size_type numVectors() const
Teuchos::RCP< const Vector< Real > > get_2() const
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.
Teuchos::RCP< const Vector< Real > > getVector(void) const
Defines the linear algebra of a vector space on a generic partitioned vector where the individual vec...
virtual void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the constraint Jacobian at , , to vector .
Defines the equality constraint operator interface.
Teuchos::RCP< const Vector< Real > > get_1() const
virtual ~SimulatedEqualityConstraint()
virtual void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the adjoint of the the constraint Jacobian at , , to vector .
virtual void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
SimulatedEqualityConstraint(const Teuchos::RCP< SampleGenerator< Real > > &sampler, const Teuchos::RCP< EqualityConstraint_SimOpt< Real > > &pcon, const bool useWeights=true)
Teuchos::RCP< const Vector< Real > > get(size_type i) const