ROL
ROL_DynamicObjective.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Rapid Optimization Library (ROL) Package
4 //
5 // Copyright 2014 NTESS and the ROL contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #pragma once
11 #ifndef ROL_DYNAMICOBJECTIVE_HPP
12 #define ROL_DYNAMICOBJECTIVE_HPP
13 
14 #include "ROL_DynamicFunction.hpp"
15 
16 
35 namespace ROL {
36 
37 template<typename Real>
38 class DynamicObjective : public DynamicFunction<Real> {
39 public:
40 
41  using V = Vector<Real>;
43 
45 
46  DynamicObjective( std::initializer_list<std::string> zero_deriv_terms ) :
47  DynamicFunction<Real>( zero_deriv_terms ) {}
48 
49  virtual ~DynamicObjective() {}
50 
51  virtual void update( const V& uo, const V& un, const V& z, const TS& timeStamp ) {
52  update_uo( uo, timeStamp );
53  update_un( un, timeStamp );
54  update_z( z, timeStamp );
55  }
56 
57  using DynamicFunction<Real>::update_uo;
58  using DynamicFunction<Real>::update_un;
59  using DynamicFunction<Real>::update_z;
60 
61  virtual Real value( const V& uo, const V& un,
62  const V& z, const TS& timeStamp ) const = 0;
63 
64  //----------------------------------------------------------------------------
65  // Gradient Terms
66  virtual void gradient_uo( V& g, const V& uo, const V& un,
67  const V& z, const TS& timeStamp ) const {}
68 
69  virtual void gradient_un( V& g, const V& uo, const V& un,
70  const V& z, const TS& timeStamp ) const {}
71 
72  virtual void gradient_z( V& g, const V& uo, const V& un,
73  const V& z, const TS& timeStamp ) const {}
74 
75  //----------------------------------------------------------------------------
76  // Hessian-Vector product terms
77  virtual void hessVec_uo_uo( V& hv, const V& v, const V& uo, const V& un,
78  const V& z, const TS& timeStamp ) const {}
79 
80  virtual void hessVec_uo_un( V& hv, const V& v, const V& uo, const V& un,
81  const V& z, const TS& timeStamp ) const {}
82 
83  virtual void hessVec_uo_z( V& hv, const V& v, const V& uo, const V& un,
84  const V& z, const TS& timeStamp ) const {}
85 
86 
87  virtual void hessVec_un_uo( V& hv, const V& v, const V& uo, const V& un,
88  const V& z, const TS& timeStamp ) const {}
89 
90  virtual void hessVec_un_un( V& hv, const V& v, const V& uo, const V& un,
91  const V& z, const TS& timeStamp ) const {}
92 
93  virtual void hessVec_un_z( V& hv, const V& v, const V& uo, const V& un,
94  const V& z, const TS& timeStamp ) const {}
95 
96 
97  virtual void hessVec_z_uo( V& hv, const V& v, const V& uo, const V& un,
98  const V& z, const TS& timeStamp ) const {}
99 
100  virtual void hessVec_z_un( V& hv, const V& v, const V& uo, const V& un,
101  const V& z, const TS& timeStamp ) const {}
102 
103  virtual void hessVec_z_z( V& hv, const V& v, const V& uo, const V& un,
104  const V& z, const TS& timeStamp ) const {}
105 };
106 
107 } // namespace ROL
108 
109 
110 #endif // ROL_DYNAMICOBJECTIVE_HPP
111 
DynamicFunction(std::initializer_list< std::string > zero_deriv_terms={})
virtual void hessVec_z_un(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void update(const Vector< Real > &u, const Vector< Real > &z, bool flag=true, int iter=-1) override
Provides update interface, casting and vector management to DynamicConstraint and DynamicObjective...
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
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_un_z(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
Vector< Real > V
virtual void update_z(const V &x, const TS &ts)
virtual void update_uo(const V &x, const TS &ts)
virtual void hessVec_z_z(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void hessVec_uo_un(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void gradient_z(V &g, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void hessVec_uo_uo(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void hessVec_un_un(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void gradient_un(V &g, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void update_un(const V &x, const TS &ts)
virtual void hessVec_un_uo(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void hessVec_z_uo(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void hessVec_uo_z(V &hv, const V &v, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual void gradient_uo(V &g, const V &uo, const V &un, const V &z, const TS &timeStamp) const
virtual Real value(const V &uo, const V &un, const V &z, const TS &timeStamp) const =0