45 #ifndef ROL_SERIALCONSTRAINT_HPP
46 #define ROL_SERIALCONSTRAINT_HPP
66 template<
typename Real>
74 Ptr<DynamicConstraint<Real>>
con_;
120 con_->solve( *(cp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
135 con_->value( *(cp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
141 Real& tol )
override {
150 con_->applyJacobian_un( *(jvp.get(0)), *(vp.get(0)), *
u_zero_, *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
153 con_->applyJacobian_uo( x, *(vp.get(k-1)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
154 con_->applyJacobian_un( *(jvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
170 con_->applyInverseJacobian_un( *(ijvp.get(0)), *(vp.get(0)), *
u_zero_, *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
173 con_->applyJacobian_uo( x, *(ijvp.get(k-1)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
175 x.plus( *(vp.get(k)) );
176 con_->applyInverseJacobian_un( *(ijvp.get(k)), x, *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
191 con_->applyAdjointJacobian_un( *(ajvp.get(0)), *(vp.get(0)), *
u_zero_, *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
194 con_->applyAdjointJacobian_un( *(ajvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
195 con_->applyAdjointJacobian_uo( x, *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
196 ajvp.get(k-1)->plus(x);
211 con_->applyInverseAdjointJacobian_un( *(iajvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
214 con_->applyAdjointJacobian_uo( x, *(iajvp.get(k+1)), *(up.get(k)), *(up.get(k+1)), *(zp.get(k+1)),
timeStamp_->at(k+1) );
216 x.plus( *(vp.get(k) ) );
217 con_->applyInverseAdjointJacobian_un( *(iajvp.get(k)), x, *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
220 con_->applyAdjointJacobian_uo( x, *(iajvp.get(1)), *(up.get(0)), *(up.get(1)), *(zp.get(1)),
timeStamp_->at(1) );
222 x.plus( *(vp.get(0) ) );
224 con_->applyInverseAdjointJacobian_un( *(iajvp.get(0)), x, *
u_zero_, *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
228 iajvp.get(0)->set(x);
241 con_->applyJacobian_z( *(jvp.get(0)), *(vp.get(0)), *
u_zero_, *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
244 con_->applyJacobian_z( *(jvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
255 con_->applyAdjointJacobian_z( *(ajvp.get(0)), *(vp.get(0)), *
u_zero_, *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
258 con_->applyAdjointJacobian_z( *(ajvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
274 con_->applyAdjointHessian_un_un( *(ahwvp.get(0)), *(wp.get(0)), *(vp.get(0)), *
u_zero_, *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
275 con_->applyAdjointHessian_un_uo( x, *(wp.get(1)), *(vp.get(1)), *(up.get(0)), *(up.get(1)), *(zp.get(1)),
timeStamp_->at(1) );
276 ahwvp.get(0)->plus(x);
277 con_->applyAdjointHessian_uo_uo( x, *(wp.get(1)), *(vp.get(0)), *(up.get(0)), *(up.get(1)), *(zp.get(1)),
timeStamp_->at(1) );
278 ahwvp.get(0)->plus(x);
283 con_->applyAdjointHessian_un_un( *(ahwvp.get(k)), *(wp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
284 con_->applyAdjointHessian_uo_un( x, *(wp.get(k)), *(vp.get(k-1)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
285 ahwvp.get(k)->plus(x);
288 con_->applyAdjointHessian_un_uo( x, *(wp.get(k+1)), *(vp.get(k+1)), *(up.get(k)), *(up.get(k+1)), *(zp.get(k+1)),
timeStamp_->at(k+1) );
289 ahwvp.get(k)->plus(x);
290 con_->applyAdjointHessian_uo_uo( x, *(wp.get(k+1)), *(vp.get(k)), *(up.get(k)), *(up.get(k+1)), *(zp.get(k+1)),
timeStamp_->at(k+1) );
291 ahwvp.get(k)->plus(x);
302 Real &tol)
override {}
310 Real &tol)
override {}
318 con_->applyAdjointHessian_z_z( *(ahwvp.get(0)), *(wp.get(0)), *(vp.get(0)), *
u_initial_,
319 *(up.get(0)), *(zp.get(0)),
timeStamp_->at(0) );
322 con_->applyAdjointHessian_z_z( *(ahwvp.get(k)), *(wp.get(k)), *(vp.get(k)), *(up.get(k-1)),
323 *(up.get(k)), *(zp.get(k)),
timeStamp_->at(k) );
332 template<
typename Real>
338 #endif // ROL_SERIALCONSTRAINT_HPP
virtual void value(Vector< Real > &c, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Evaluate the constraint operator at .
typename PV< Real >::size_type size_type
void setTimeStamp(const Ptr< vector< TimeStamp< Real >>> &timeStamp)
Ptr< Vector< Real > > u_initial_
Defines the time-dependent constraint operator interface for simulation-based optimization.
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...
Defines the linear algebra of vector space on a generic partitioned vector.
PV & partition(Vector< Real > &x) const
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...
Contains local time step information.
Defines the linear algebra or vector space interface.
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 .
Ptr< DynamicConstraint< Real > > con_
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 ...
void setSkipInitialCondition(bool skip)
VectorWorkspace< Real > workspace_
size_type numTimeSteps(void) const
bool getSkipInitialCondition() const
const Vector< Real > & getInitialCondition() const
SerialConstraint(const Ptr< DynamicConstraint< Real >> &con, const Vector< Real > &u_initial, const Ptr< vector< TimeStamp< Real >>> &timeStamp)
Ptr< std::vector< TimeStamp< Real > > > timeStamp_
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 .
Ptr< vector< TimeStamp< Real > > > getTimeStamp() const
Ptr< Vector< Real > > u_zero_
void setInitialCondition(const Vector< Real > &u_initial)
virtual void solve(Vector< Real > &c, Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Given , solve for .
const PV & partition(const Vector< Real > &x) const
Evaluates ROL::DynamicConstraint over a sequential set of time intervals.
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 ...
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...
typename std::vector< Real >::size_type size_type
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 ...
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 .