11 #ifndef ROL_OBJECTIVE_SERIALSIMOPT_HPP
12 #define ROL_OBJECTIVE_SERIALSIMOPT_HPP
18 template<
typename Real>
39 const PV&
partition(
const V& x )
const {
return static_cast<const PV&
>(x); }
50 virtual Real
value(
const V& u,
const V& z, Real& tol )
override {
56 Real result =
obj_->value( *
ui_, *(up.get(0)), *(zp.get(0)), tol );
58 for(
size_type k=1; k<up.numVector(); ++k ) {
59 result +=
obj_->value( *(up.get(k-1), *(up.get(k)), *(zp.get(k)), tol );
64 virtual void gradient_1(
V& g,
const V &u,
const V& z, Real& tol )
override {
71 obj_->gradient_1( *(gp.get(0)), *
ui_, *
ui_, *(up.get(0)), *(zp.get(0)), tol );
73 for(
size_type k=1; k<up.numVector(); ++k ) {
74 obj_->gradient_1( *(gp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
78 virtual void gradient_2(
V& g,
const V& u,
const V& z, Real& tol )
override {
85 obj_->gradient_2( *(gp.get(0)), *
ui_, *
ui_, *(up.get(0)), *(zp.get(0)), tol );
88 obj_->gradient_2( *(gp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
93 const V& u,
const V& z, Real& tol )
override {
102 obj_->hessVec_11( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
105 obj_->hessVec_11( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
109 virtual void hessVec_12(
V& hv,
const V& v,
const V&u,
const V&z, Real &tol )
override {
118 obj_->hessVec_12( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
120 for(
size_type k=1; k<up.numVector(); ++k ) {
121 obj_->hessVec_12( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
125 virtual void hessVec_21(
V&hv,
const V&v,
const V&u,
const V&z, Real &tol )
override {
134 obj_->hessVec_21( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
136 for(
size_type k=1; k<up.numVector(); ++k ) {
137 obj_->hessVec_21( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
141 virtual void hessVec_22(
V&hv,
const V&v,
const V&u,
const V&z, Real &tol )
override {
150 obj_->hessVec_22( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
152 for(
size_type k=1; k<up.numVector(); ++k ) {
153 obj_->hessVec_22( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
162 #endif // ROL_OBJECTIVE_SERIALSIMOPT_HPP
PartitionedVector< Real > & partition(Vector< Real > &x)
virtual void hessVec_21(V &hv, const V &v, const V &u, const V &z, Real &tol) override
Provides the interface to evaluate simulation-based objective functions.
typename PV< Real >::size_type size_type
virtual void gradient_1(V &g, const V &u, const V &z, Real &tol) override
const PV & partition(const V &x) const
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.
Defines the linear algebra of vector space on a generic partitioned vector.
PV & partition(V &x) const
ROL::Objective_SimOpt value
virtual void hessVec_12(V &hv, const V &v, const V &u, const V &z, Real &tol) override
Defines the linear algebra or vector space interface.
virtual void gradient_2(V &g, const V &u, const V &z, Real &tol) override
virtual void hessVec_22(V &hv, const V &v, const V &u, const V &z, Real &tol) override
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
VectorWorkspace< Real > workspace_
virtual void hessVec_11(V &hv, const V &v, const V &u, const V &z, Real &tol) override
std::vector< PV >::size_type size_type
typename PV< Real >::size_type size_type