44 #ifndef ROL_SERIALOBJECTIVE_HPP
45 #define ROL_SERIALOBJECTIVE_HPP
47 #include <type_traits>
69 template<
typename Real>
77 Ptr<DynamicObjective<Real>>
obj_;
95 Real& tol )
override {
105 result +=
obj_->value( up[k-1], up[k], zp[k],
ts(k) );
113 Real& tol )
override {
119 auto tmp =
clone(gp[0]);
125 obj_->gradient_uo( x, up[0], up[1], zp[1],
ts(1) );
129 obj_->gradient_un( gp[k], up[k-1], up[k], zp[k],
ts(k) );
130 obj_->gradient_uo( x, up[k], up[k+1], zp[k+1],
ts(k+1) );
136 obj_->gradient_un( gp[N], up[N-1], up[N], zp[N],
ts(N) );
143 Real& tol )
override {
153 obj_->gradient_z( gp[k], up[k-1], up[k], zp[k],
ts(k) );
161 Real& tol )
override {
166 auto tmp =
clone(hvp[0]);
172 obj_->hessVec_uo_uo( x, vp[0], up[0], up[1], zp[1],
ts(1) );
176 obj_->hessVec_un_un( hvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
177 obj_->hessVec_uo_uo( x, vp[k], up[k], up[k+1], zp[k+1],
ts(k+1) );
183 obj_->hessVec_un_un( hvp[N], vp[N], up[N-1], up[N], zp[N],
ts(N) );
191 Real& tol )
override {
196 auto tmp =
clone(hvp[0]);
202 obj_->hessVec_uo_z( x, vp[0], up[0], up[1], zp[1],
ts(1) );
206 obj_->hessVec_un_z( hvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
207 obj_->hessVec_uo_z( x, vp[k], up[k], up[k+1], zp[k+1],
ts(k+1) );
213 obj_->hessVec_un_z( hvp[N], vp[N], up[N-1], up[N], zp[N],
ts(N) );
225 Real& tol )
override {
234 obj_->hessVec_z_z( hvp[k], vp[k], up[k-1], up[k], zp[k],
ts(k) );
244 template<
typename DynObj,
typename Real,
typename P = Ptr<SerialObjective<Real>> >
245 inline typename std::enable_if<std::is_base_of<DynamicObjective<Real>,DynObj>
::value,P>::type
249 return makePtr<SerialObjective<Real>>(obj,u_initial,timeStampsPtr);
255 #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.