45 #ifndef ROL_SERIALCONSTRAINT_HPP
46 #define ROL_SERIALCONSTRAINT_HPP
48 #include <type_traits>
63 template<
typename Real>
72 Ptr<DynamicConstraint<Real>>
con_;
91 Real& tol )
override {
101 con_->solve( cp[k], up[k-1], up[k], zp[k],
ts(k) );
109 Real& tol )
override {
119 con_->value( cp[k], up[k-1], up[k], zp[k],
ts(k) );
128 Real& tol )
override {
133 auto tmp =
clone(jvp[0]);
141 con_->applyJacobian_uo( x, vp[k-1], up[k-1], up[k], zp[k],
ts(k) );
142 con_->applyJacobian_un( jvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
154 Real& tol)
override {
159 auto tmp =
clone(ijvp[0]);
164 up[0], zp[0],
ts(0) );
168 con_->applyJacobian_uo( x, ijvp[k-1], up[k-1], up[k], zp[k],
ts(k) );
171 con_->applyInverseJacobian_un( ijvp[k], x, up[k-1], up[k], zp[k],
ts(k) );
183 Real& tol)
override {
188 auto tmp =
clone(ajvp[0]);
196 con_->applyAdjointJacobian_un( ajvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
197 con_->applyAdjointJacobian_uo( x, vp[k], up[k-1], up[k], zp[k],
ts(k) );
208 Real& tol)
override {
213 auto tmp =
clone(iajvp[0]);
218 con_->applyInverseAdjointJacobian_un( iajvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
222 con_->applyAdjointJacobian_uo( x, iajvp[k+1], up[k], up[k+1], zp[k+1],
ts(k+1) );
225 con_->applyInverseAdjointJacobian_un( iajvp[k], x, up[k-1], up[k], zp[k],
ts(k) );
229 con_->applyAdjointJacobian_uo( x, iajvp[1], up[0], up[1], zp[1],
ts(1) );
234 con_->applyInverseAdjointJacobian_un( iajvp[0], x,
getZeroState(), up[0], zp[0],
ts(0) );
237 else iajvp[0].set(x);
246 Real &tol )
override {
255 con_->applyJacobian_z( jvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
264 Real& tol )
override {
273 con_->applyAdjointJacobian_z( ajvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
284 Real& tol)
override {
290 auto tmp =
clone(ahwvp[0]);
295 con_->applyAdjointHessian_un_un( ahwvp[0], wp[0], vp[0],
getZeroState(), up[0], zp[0],
ts(0) );
296 con_->applyAdjointHessian_un_uo( x, wp[1], vp[1], up[0], up[1], zp[1],
ts(1) );
298 con_->applyAdjointHessian_uo_uo( x, wp[1], vp[0], up[0], up[1], zp[1],
ts(1) );
305 con_->applyAdjointHessian_un_un( ahwvp[k], wp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
306 con_->applyAdjointHessian_uo_un( x, wp[k], vp[k-1], up[k-1], up[k], zp[k],
ts(k) );
310 con_->applyAdjointHessian_un_uo( x, wp[k+1], vp[k+1], up[k], up[k+1], zp[k+1],
ts(k+1) );
312 con_->applyAdjointHessian_uo_uo( x, wp[k+1], vp[k], up[k], up[k+1], zp[k+1],
ts(k+1) );
326 Real& tol)
override {
335 Real& tol)
override {
343 Real& tol)
override {
349 up[0], zp[0],
ts(0) );
352 con_->applyAdjointHessian_z_z( ahwvp[k], wp[k], vp[k], up[k-1],
353 up[k], zp[k],
ts(k) );
363 template<
typename DynCon,
typename Real,
typename P = Ptr<SerialConstra
int<Real>>>
364 inline typename std::enable_if<std::is_base_of<DynamicConstraint<Real>,DynCon>
::value,P>::type
368 return makePtr<SerialConstraint<Real>>(con,u_initial,timeStampsPtr);
379 #endif // ROL_SERIALCONSTRAINT_HPP
PartitionedVector< Real > & partition(Vector< Real > &x)
const Vector< Real > & getInitialCondition() const
typename PV< Real >::size_type size_type
virtual void applyAdjointHessian_12(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the optimization-space derivative of the adjoint of the constraint simulation-space Jacobian at...
const Vector< Real > & getZeroState() const
Defines the time-dependent constraint operator interface for simulation-based optimization.
Defines the linear algebra of vector space on a generic partitioned vector.
virtual void applyAdjointHessian_21(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the simulation-space derivative of the adjoint of the constraint optimization-space Jacobian at...
virtual void applyAdjointHessian_22(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the optimization-space derivative of the adjoint of the constraint optimization-space Jacobian ...
ROL::Objective_SimOpt value
size_type numTimeSteps() const
virtual void value(Vector< Real > &c, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Evaluate the constraint operator at .
Defines the linear algebra or vector space interface.
virtual void applyAdjointJacobian_1(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, const Vector< Real > &dualv, Real &tol) override
Apply the adjoint of the partial constraint Jacobian at , , to the vector . This is the secondary int...
virtual void applyJacobian_1(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the partial constraint Jacobian at , , to the vector .
virtual void applyJacobian_2(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the partial constraint Jacobian at , , to the vector .
std::enable_if< std::is_base_of< DynamicConstraint< Real >, DynCon >::value, P >::type make_SerialConstraint(const Ptr< DynCon > &con, const Vector< Real > &u_initial, const TimeStampsPtr< Real > timeStampsPtr)
Ptr< Vector< Real > > clone(const Vector< Real > &x)
typename std::vector< Real >::size_type size_type
virtual void applyAdjointJacobian_2(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the adjoint of the partial constraint Jacobian at , , to vector . This is the primary interface...
SerialConstraint(const Ptr< DynamicConstraint< Real >> &con, const Vector< Real > &u_initial, const TimeStampsPtr< Real > &timeStampsPtr)
void applyInverseAdjointJacobian_1(Vector< Real > &iajv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the inverse of the adjoint of the partial constraint Jacobian at , , to the vector ...
bool getSkipInitialCondition() const
Provides behavior common to SerialObjective as SerialConstaint.
virtual void applyAdjointHessian_11(Vector< Real > &ahwv, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the simulation-space derivative of the adjoint of the constraint simulation-space Jacobian at ...
Ptr< DynamicConstraint< Real > > con_
Ptr< std::vector< TimeStamp< Real >>> TimeStampsPtr
virtual void solve(Vector< Real > &c, Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Given , solve for .
Evaluates ROL::DynamicConstraint over a sequential set of time intervals.
Defines the constraint operator interface for simulation-based optimization.
const TimeStamp< Real > & ts(size_type i) const
virtual void applyInverseJacobian_1(Vector< Real > &ijv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply the inverse partial constraint Jacobian at , , to the vector .