44 #ifndef ROL_SERIALOBJECTIVE_HPP
45 #define ROL_SERIALOBJECTIVE_HPP
47 #include <type_traits>
69 template<
typename Real>
77 Ptr<DynamicObjective<Real>>
obj_;
96 Real& tol )
override {
106 result +=
obj_->value( up[k-1], up[k], zp[k],
ts(k) );
114 Real& tol )
override {
120 auto tmp =
clone(gp[0]);
126 obj_->gradient_uo( x, up[0], up[1], zp[1],
ts(1) );
130 obj_->gradient_un( gp[k], up[k-1], up[k], zp[k],
ts(k) );
131 obj_->gradient_uo( x, up[k], up[k+1], zp[k+1],
ts(k+1) );
137 obj_->gradient_un( gp[N], up[N-1], up[N], zp[N],
ts(N) );
144 Real& tol )
override {
154 obj_->gradient_z( gp[k], up[k-1], up[k], zp[k],
ts(k) );
162 Real& tol )
override {
167 auto tmp =
clone(hvp[0]);
173 obj_->hessVec_uo_uo( x, vp[0], up[0], up[1], zp[1],
ts(1) );
177 obj_->hessVec_un_un( hvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
178 obj_->hessVec_uo_uo( x, vp[k], up[k], up[k+1], zp[k+1],
ts(k+1) );
184 obj_->hessVec_un_un( hvp[N], vp[N], up[N-1], up[N], zp[N],
ts(N) );
192 Real& tol )
override {
197 auto tmp =
clone(hvp[0]);
203 obj_->hessVec_uo_z( x, vp[0], up[0], up[1], zp[1],
ts(1) );
207 obj_->hessVec_un_z( hvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
208 obj_->hessVec_uo_z( x, vp[k], up[k], up[k+1], zp[k+1],
ts(k+1) );
214 obj_->hessVec_un_z( hvp[N], vp[N], up[N-1], up[N], zp[N],
ts(N) );
223 Real& tol )
override {
228 auto tmp =
clone(hvp[0]);
236 obj_->hessVec_z_un( hvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
237 obj_->hessVec_z_uo( x, vp[k-1], up[k-1], up[k], zp[k],
ts(k) );
247 Real& tol )
override {
256 obj_->hessVec_z_z( hvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
266 template<
typename DynObj,
typename Real,
typename P = Ptr<SerialObjective<Real>> >
267 inline typename std::enable_if<std::is_base_of<DynamicObjective<Real>,DynObj>
::value,P>::type
271 return makePtr<SerialObjective<Real>>(obj,u_initial,timeStampsPtr);
277 #endif // ROL_SERIALOBJECTIVE_HPP
PartitionedVector< Real > & partition(Vector< Real > &x)
const Vector< Real > & getInitialCondition() const
Provides the interface to evaluate simulation-based objective functions.
typename PV< Real >::size_type size_type
virtual void gradient_2(Vector< Real > &g, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Compute gradient with respect to second component.
virtual void hessVec_11(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Apply Hessian approximation to vector.
Defines the linear algebra of vector space on a generic partitioned vector.
ROL::Objective_SimOpt value
size_type numTimeSteps() const
virtual Real value(const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Compute value.
Defines the linear algebra or vector space interface.
Defines the time-dependent objective function interface for simulation-based optimization. Computes time-local contributions of value, gradient, Hessian-vector product etc to a larger composite objective defined over the simulation time. In contrast to other objective classes Objective_TimeSimOpt has a default implementation of value which returns zero, as time-dependent simulation based optimization problems may have an objective value which depends only on the final state of the system.
virtual void hessVec_22(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
SerialObjective(const Ptr< DynamicObjective< Real >> &obj, const Vector< Real > &u_initial, const TimeStampsPtr< Real > timeStampsPtr)
typename std::vector< Real >::size_type size_type
Ptr< Vector< Real > > clone(const Vector< Real > &x)
Ptr< DynamicObjective< Real > > obj_
Evaluates ROL::DynamicObjective over a sequential set of time intervals.
std::enable_if< std::is_base_of< DynamicObjective< Real >, DynObj >::value, P >::type make_SerialObjective(const Ptr< DynObj > &obj, const Vector< Real > &u_initial, const TimeStampsPtr< Real > timeStampsPtr)
bool getSkipInitialCondition() const
Provides behavior common to SerialObjective as SerialConstaint.
Ptr< std::vector< TimeStamp< Real >>> TimeStampsPtr
virtual void hessVec_12(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
const TimeStamp< Real > & ts(size_type i) const
virtual void gradient_1(Vector< Real > &g, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override
Compute gradient with respect to first component.
virtual void hessVec_21(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol) override