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); }
81 u0_->zero(); z0_->zero();
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
Provides the interface to evaluate simulation-based objective functions.
typename PV< Real >::size_type size_type
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_12(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Defines the linear algebra of vector space on a generic partitioned vector.
virtual void gradient_2(Vector< Real > &g, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Compute gradient with respect to second component.
Defines the linear algebra or vector space interface.
virtual void hessVec_21(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
virtual Real value(const Vector< Real > &u, const Vector< Real > &z, Real &tol)=0
Compute value.
VectorWorkspace< Real > workspace_
Ptr< V > copy(const V &x)
PV & partition(V &x) const
const PV & partition(const V &x) const
virtual void gradient_1(Vector< Real > &g, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Compute gradient with respect to first component.
virtual void hessVec_22(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
std::vector< PV >::size_type size_type
virtual void hessVec_11(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z, Real &tol)
Apply Hessian approximation to vector.
typename PV< Real >::size_type size_type