46 #ifndef ROL_OBJECTIVE_SERIALSIMOPT_HPP
47 #define ROL_OBJECTIVE_SERIALSIMOPT_HPP
53 template<
typename Real>
74 const PV&
partition(
const V& x )
const {
return static_cast<const PV&
>(x); }
85 virtual Real
value(
const V& u,
const V& z, Real& tol )
override {
91 Real result =
obj_->value( *
ui_, *(up.get(0)), *(zp.get(0)), tol );
93 for(
size_type k=1; k<up.numVector(); ++k ) {
94 result +=
obj_->value( *(up.get(k-1), *(up.get(k)), *(zp.get(k)), tol );
99 virtual void gradient_1(
V& g,
const V &u,
const V& z, Real& tol )
override {
106 obj_->gradient_1( *(gp.get(0)), *
ui_, *
ui_, *(up.get(0)), *(zp.get(0)), tol );
108 for(
size_type k=1; k<up.numVector(); ++k ) {
109 obj_->gradient_1( *(gp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
113 virtual void gradient_2(
V& g,
const V& u,
const V& z, Real& tol )
override {
120 obj_->gradient_2( *(gp.get(0)), *
ui_, *
ui_, *(up.get(0)), *(zp.get(0)), tol );
122 for(
size_type k=1; k<up.numVector(); ++k ) {
123 obj_->gradient_2( *(gp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
128 const V& u,
const V& z, Real& tol )
override {
137 obj_->hessVec_11( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
140 obj_->hessVec_11( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
144 virtual void hessVec_12(
V& hv,
const V& v,
const V&u,
const V&z, Real &tol )
override {
153 obj_->hessVec_12( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
155 for(
size_type k=1; k<up.numVector(); ++k ) {
156 obj_->hessVec_12( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
160 virtual void hessVec_21(
V&hv,
const V&v,
const V&u,
const V&z, Real &tol )
override {
169 obj_->hessVec_21( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
171 for(
size_type k=1; k<up.numVector(); ++k ) {
172 obj_->hessVec_21( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
176 virtual void hessVec_22(
V&hv,
const V&v,
const V&u,
const V&z, Real &tol )
override {
185 obj_->hessVec_22( *(hvp.get(0)), *(vp.get(0)), *
ui_, *(up.get(0)), *(zp.get(0)), tol );
187 for(
size_type k=1; k<up.numVector(); ++k ) {
188 obj_->hessVec_22( *(hvp.get(k)), *(vp.get(k)), *(up.get(k-1)), *(up.get(k)), *(zp.get(k)), tol );
197 #endif // ROL_OBJECTIVE_SERIALSIMOPT_HPP
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
PV & partition(V &x) const
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