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) );
113 con_->update( up[k-1], up[k], zp[k],
ts(k) );
121 Real& tol )
override {
131 con_->value( cp[k], up[k-1], up[k], zp[k],
ts(k) );
140 Real& tol )
override {
145 auto tmp =
clone(jvp[0]);
153 con_->applyJacobian_uo( x, vp[k-1], up[k-1], up[k], zp[k],
ts(k) );
154 con_->applyJacobian_un( jvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
166 Real& tol)
override {
171 auto tmp =
clone(ijvp[0]);
176 up[0], zp[0],
ts(0) );
180 con_->applyJacobian_uo( x, ijvp[k-1], up[k-1], up[k], zp[k],
ts(k) );
183 con_->applyInverseJacobian_un( ijvp[k], x, up[k-1], up[k], zp[k],
ts(k) );
196 Real& tol)
override {
201 auto tmp =
clone(ajvp[0]);
209 con_->applyAdjointJacobian_un( ajvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
210 con_->applyAdjointJacobian_uo( x, vp[k], up[k-1], up[k], zp[k],
ts(k) );
221 Real& tol)
override {
226 auto tmp =
clone(iajvp[0]);
231 con_->applyInverseAdjointJacobian_un( iajvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
235 con_->applyAdjointJacobian_uo( x, iajvp[k+1], up[k], up[k+1], zp[k+1],
ts(k+1) );
238 con_->applyInverseAdjointJacobian_un( iajvp[k], x, up[k-1], up[k], zp[k],
ts(k) );
242 con_->applyAdjointJacobian_uo( x, iajvp[1], up[0], up[1], zp[1],
ts(1) );
247 con_->applyInverseAdjointJacobian_un( iajvp[0], x,
getZeroState(), up[0], zp[0],
ts(0) );
250 else iajvp[0].set(x);
259 Real &tol )
override {
268 con_->applyJacobian_z( jvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
278 Real& tol )
override {
287 con_->applyAdjointJacobian_z( ajvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
298 Real& tol)
override {
304 auto tmp =
clone(ahwvp[0]);
309 con_->applyAdjointHessian_un_un( ahwvp[0], wp[0], vp[0],
getZeroState(), up[0], zp[0],
ts(0) );
310 con_->applyAdjointHessian_un_uo( x, wp[1], vp[1], up[0], up[1], zp[1],
ts(1) );
312 con_->applyAdjointHessian_uo_uo( x, wp[1], vp[0], up[0], up[1], zp[1],
ts(1) );
319 con_->applyAdjointHessian_un_un( ahwvp[k], wp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
320 con_->applyAdjointHessian_uo_un( x, wp[k], vp[k-1], up[k-1], up[k], zp[k],
ts(k) );
324 con_->applyAdjointHessian_un_uo( x, wp[k+1], vp[k+1], up[k], up[k+1], zp[k+1],
ts(k+1) );
326 con_->applyAdjointHessian_uo_uo( x, wp[k+1], vp[k], up[k], up[k+1], zp[k+1],
ts(k+1) );
340 Real& tol)
override {
349 Real& tol)
override {
357 Real& tol)
override {
363 up[0], zp[0],
ts(0) );
366 con_->applyAdjointHessian_z_z( ahwvp[k], wp[k], vp[k], up[k-1],
367 up[k], zp[k],
ts(k) );
377 template<
typename DynCon,
typename Real,
typename P = Ptr<SerialConstra
int<Real>>>
378 inline typename std::enable_if<std::is_base_of<DynamicConstraint<Real>,DynCon>
::value,P>::type
382 return makePtr<SerialConstraint<Real>>(con,u_initial,timeStampsPtr);
393 #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 update(const Vector< Real > &u, const Vector< Real > &z, bool flag=true, int iter=-1) override
Update constraint functions. x is the optimization variable, flag = true if optimization variable is ...
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 .