ROL
ROL_DynamicConstraint_CheckInterface.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_DYNAMICCONSTRAINT_CHECKINTERFACE_HPP
12 #define ROL_DYNAMICCONSTRAINT_CHECKINTERFACE_HPP
13 
14 #include "ROL_FunctionBindings.hpp"
16 
17 namespace ROL {
18 namespace details {
19 
20 using namespace std;
21 namespace ph = std::placeholders;
22 
23 template<typename Real>
25 private:
26 
27  using V = Vector<Real>;
29 
31  Real tol_;
33 
34 public:
35 
36  DynamicConstraint_CheckInterface( Con& con ) : con_(con) {
37  ts_.t.resize(2);
38  ts_.t.at(0) = 0.01;
39  ts_.t.at(1) = 0.02345;
40  ts_.k = 0;
41  }
42 
43  DynamicConstraint_CheckInterface( Con& con, TimeStamp<Real>& ts ) : con_(con), ts_(ts) {
44  }
45 
46  f_update_t<Real> update_uo( const V& un, const V& z ) {
47  return bind( &Con::update, &con_, ph::_1, cref(un), cref(z), ts_ );
48  }
49 
50  f_update_t<Real> update_un( const V& uo, const V& z ) {
51  return bind( &Con::update, &con_, cref(uo), ph::_1, cref(z), ts_ );
52  }
53 
54  f_update_t<Real> update_z( const V& uo, const V& un ) {
55  return bind( &Con::update, &con_, cref(uo), cref(un), ph::_1, ts_ );
56  }
57 
58  //----------------------------------------------------------------------------
59 
60  f_vector_t<Real> value_uo( const V& un, const V& z ) {
61  return bind( &Con::value, &con_,
62  ph::_1, ph::_2, cref(un), cref(z), ts_ );
63  }
64 
65  f_vector_t<Real> value_un( const V& uo, const V& z ) {
66  return bind( &Con::value, &con_,
67  ph::_1, cref(uo), ph::_2, cref(z), ts_ );
68  }
69 
70  f_vector_t<Real> value_z( const V& uo, const V& un ) {
71  return bind( &Con::value, &con_,
72  ph::_1, cref(uo), cref(un), ph::_2, ts_ );
73  }
74 
75  f_solve_t<Real> solve_un( const V& uo, const V& z ) {
76  return bind( &Con::solve, &con_,
77  ph::_1, cref(uo), ph::_2, cref(z), ts_ );
78  }
79 
80  //----------------------------------------------------------------------------
81 
82  f_dderiv_t<Real> jacobian_uo( const V& un, const V& z ) {
83  return bind( &Con::applyJacobian_uo, &con_, ph::_1, ph::_2, ph::_3,
84  cref(un), cref(z), ts_ );
85  }
86 
87  f_dderiv_t<Real> jacobian_un( const V& uo, const V& z ) {
88  return bind( &Con::applyJacobian_un, &con_, ph::_1, ph::_2, cref(uo),
89  ph::_3, cref(z), ts_ );
90  }
91 
92  f_dderiv_t<Real> inverseJacobian_un( const V& uo, const V& z ) {
93  return bind( &Con::applyInverseJacobian_un, &con_, ph::_1, ph::_2, cref(uo),
94  ph::_3, cref(z), ts_ );
95  }
96 
97  f_dderiv_t<Real> jacobian_z( const V& uo, const V& un ) {
98  return bind( &Con::applyJacobian_z, &con_, ph::_1, ph::_2, cref(uo),
99  cref(un), ph::_3, ts_ );
100  }
101 
102  //----------------------------------------------------------------------------
103 
104  f_dderiv_t<Real> adjointJacobian_uo( const V& un, const V& z ) {
105  return bind( &Con::applyAdjointJacobian_uo, &con_, ph::_1, ph::_2, ph::_3,
106  cref(un), cref(z), ts_ );
107  }
108 
109  f_dderiv_t<Real> adjointJacobian_un( const V& uo, const V& z ) {
110  return bind( &Con::applyAdjointJacobian_un, &con_, ph::_1, ph::_2, cref(uo),
111  ph::_3, cref(z), ts_ );
112  }
113 
114  f_dderiv_t<Real> inverseAdjointJacobian_un( const V& uo, const V& z ) {
115  return bind( &Con::applyInverseAdjointJacobian_un, &con_, ph::_1, ph::_2, cref(uo),
116  ph::_3, cref(z), ts_ );
117  }
118 
119  f_dderiv_t<Real> adjointJacobian_z( const V& uo, const V& un ) {
120  return bind( &Con::applyAdjointJacobian_z, &con_, ph::_1, ph::_2, cref(uo),
121  cref(un), ph::_3, ts_ );
122  }
123 
124  //----------------------------------------------------------------------------
125 
126  f_dderiv_t<Real> adjointJacobian_uo_uo( const V& un, const V& z ) {
127  return bind( &Con::applyAdjointJacobian_uo, &con_, ph::_1, ph::_2, ph::_3,
128  cref(un), cref(z), ts_ );
129  }
130 
131  f_dderiv_t<Real> adjointJacobian_uo_un( const V& uo, const V& z ) {
132  return bind( &Con::applyAdjointJacobian_uo, &con_, ph::_1, ph::_2, cref(uo),
133  ph::_3, cref(z), ts_ );
134  }
135 
136  f_dderiv_t<Real> adjointJacobian_uo_z( const V& uo, const V& un ) {
137  return bind( &Con::applyAdjointJacobian_uo, &con_, ph::_1, ph::_2, cref(uo),
138  cref(un), ph::_3, ts_ );
139  }
140 
141  f_dderiv_t<Real> adjointJacobian_un_uo( const V& un, const V& z ) {
142  return bind( &Con::applyAdjointJacobian_un, &con_, ph::_1, ph::_2, ph::_3,
143  cref(un), cref(z), ts_ );
144  }
145 
146  f_dderiv_t<Real> adjointJacobian_un_un( const V& uo, const V& z ) {
147  return bind( &Con::applyAdjointJacobian_un, &con_, ph::_1, ph::_2, cref(uo),
148  ph::_3, cref(z), ts_ );
149  }
150 
151  f_dderiv_t<Real> adjointJacobian_un_z( const V& uo, const V& un ) {
152  return bind( &Con::applyAdjointJacobian_un, &con_, ph::_1, ph::_2, cref(uo),
153  cref(un), ph::_3, ts_ );
154  }
155 
156  f_dderiv_t<Real> adjointJacobian_z_uo( const V& un, const V& z ) {
157  return bind( &Con::applyAdjointJacobian_z, &con_, ph::_1, ph::_2, ph::_3,
158  cref(un), cref(z), ts_ );
159  }
160 
161  f_dderiv_t<Real> adjointJacobian_z_un( const V& uo, const V& z ) {
162  return bind( &Con::applyAdjointJacobian_z, &con_, ph::_1, ph::_2, cref(uo),
163  ph::_3, cref(z), ts_ );
164  }
165 
166  f_dderiv_t<Real> adjointJacobian_z_z( const V& uo, const V& un ) {
167  return bind( &Con::applyAdjointJacobian_z, &con_, ph::_1, ph::_2, cref(uo),
168  cref(un), ph::_3, ts_ );
169  }
170 
171  //----------------------------------------------------------------------------
172 
173  f_dderiv_t<Real> adjointHessian_un_un( const V& uo, const V& z, const V& l ) {
174  return bind( &Con::applyAdjointHessian_un_un, &con_, ph::_1, cref(l), ph::_2,
175  cref(uo), ph::_3, cref(z), ts_ );
176  }
177 
178  f_dderiv_t<Real> adjointHessian_un_uo( const V& uo, const V& z, const V& l ) {
179  return bind( &Con::applyAdjointHessian_un_uo, &con_, ph::_1, cref(l), ph::_2,
180  cref(uo), ph::_3, cref(z), ts_ );
181  }
182 
183  f_dderiv_t<Real> adjointHessian_un_z( const V& uo, const V& z, const V& l ) {
184  return bind( &Con::applyAdjointHessian_un_z, &con_, ph::_1, cref(l), ph::_2,
185  cref(uo), ph::_3, cref(z), ts_ );
186  }
187 
188  //----------------------------------------------------------------------------
189 
190  f_dderiv_t<Real> adjointHessian_uo_un( const V& un, const V& z, const V& l ) {
191  return bind( &Con::applyAdjointHessian_uo_un, &con_, ph::_1, cref(l), ph::_2,
192  ph::_3, cref(un), cref(z), ts_ );
193  }
194 
195  f_dderiv_t<Real> adjointHessian_uo_uo( const V& un, const V& z, const V& l ) {
196  return bind( &Con::applyAdjointHessian_uo_uo, &con_, ph::_1, cref(l), ph::_2,
197  ph::_3, cref(un), cref(z), ts_ );
198  }
199 
200  f_dderiv_t<Real> adjointHessian_uo_z( const V& un, const V& z, const V& l ) {
201  return bind( &Con::applyAdjointHessian_uo_z, &con_, ph::_1, cref(l), ph::_2,
202  ph::_3, cref(un), cref(z), ts_ );
203  }
204 
205  //----------------------------------------------------------------------------
206 
207  f_dderiv_t<Real> adjointHessian_z_un( const V& uo, const V& un, const V& l ) {
208  return bind( &Con::applyAdjointHessian_z_un, &con_, ph::_1, cref(l), ph::_2,
209  cref(uo), cref(un), ph::_3, ts_ );
210  }
211 
212  f_dderiv_t<Real> adjointHessian_z_uo( const V& uo, const V& un, const V& l ) {
213  return bind( &Con::applyAdjointHessian_z_uo, &con_, ph::_1, cref(l), ph::_2,
214  cref(uo), cref(un), ph::_3, ts_ );
215  }
216 
217  f_dderiv_t<Real> adjointHessian_z_z( const V& uo, const V& un, const V& l ) {
218  return bind( &Con::applyAdjointHessian_z_z, &con_, ph::_1, cref(l), ph::_2,
219  cref(uo), cref(un), ph::_3, ts_ );
220  }
221 
222 }; // class DynamicConstraint_CheckInterface
223 
224 } // namespace details
225 
226 using details::DynamicConstraint_CheckInterface;
227 
228 template<typename Real>
229 DynamicConstraint_CheckInterface<Real> make_check( DynamicConstraint<Real>& con ) {
230  return DynamicConstraint_CheckInterface<Real>(con);
231 }
232 
233 template<typename Real>
234 DynamicConstraint_CheckInterface<Real> make_check( DynamicConstraint<Real>& con,
235  TimeStamp<Real>& timeStamp ) {
236  return DynamicConstraint_CheckInterface<Real>(con,timeStamp);
237 }
238 
239 } // namespace ROL
240 
241 
242 #endif // ROL_DYNAMICCONSTRAINT_CHECKINTERFACE_HPP
243 
244 
f_dderiv_t< Real > adjointJacobian_un_z(const V &uo, const V &un)
f_dderiv_t< Real > adjointJacobian_un(const V &uo, const V &z)
Defines the time-dependent constraint operator interface for simulation-based optimization.
f_dderiv_t< Real > adjointJacobian_uo(const V &un, const V &z)
virtual void update(const Vector< Real > &u, const Vector< Real > &z, bool flag=true, int iter=-1) override
f_dderiv_t< Real > adjointHessian_uo_z(const V &un, const V &z, const V &l)
f_dderiv_t< Real > adjointJacobian_z_un(const V &uo, const V &z)
f_dderiv_t< Real > adjointHessian_un_uo(const V &uo, const V &z, const V &l)
f_dderiv_t< Real > adjointHessian_un_un(const V &uo, const V &z, const V &l)
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
f_dderiv_t< Real > inverseAdjointJacobian_un(const V &uo, const V &z)
f_dderiv_t< Real > adjointJacobian_un_uo(const V &un, const V &z)
f_dderiv_t< Real > adjointJacobian_uo_z(const V &uo, const V &un)
f_dderiv_t< Real > adjointHessian_z_z(const V &uo, const V &un, const V &l)
f_dderiv_t< Real > inverseJacobian_un(const V &uo, const V &z)
f_dderiv_t< Real > adjointJacobian_z(const V &uo, const V &un)
f_dderiv_t< Real > adjointHessian_uo_uo(const V &un, const V &z, const V &l)
f_dderiv_t< Real > adjointJacobian_uo_un(const V &uo, const V &z)
virtual void solve(Vector< Real > &c, Vector< Real > &u, const Vector< Real > &z) override
f_dderiv_t< Real > adjointHessian_un_z(const V &uo, const V &z, const V &l)
void value(ROL::Vector< Real > &c, const ROL::Vector< Real > &sol, const Real &mu)
f_dderiv_t< Real > adjointJacobian_uo_uo(const V &un, const V &z)
f_dderiv_t< Real > adjointHessian_uo_un(const V &un, const V &z, const V &l)
f_dderiv_t< Real > adjointHessian_z_uo(const V &uo, const V &un, const V &l)
f_dderiv_t< Real > adjointJacobian_z_uo(const V &un, const V &z)
f_dderiv_t< Real > adjointJacobian_z_z(const V &uo, const V &un)
f_dderiv_t< Real > adjointJacobian_un_un(const V &uo, const V &z)
f_dderiv_t< Real > adjointHessian_z_un(const V &uo, const V &un, const V &l)
DynamicConstraint_CheckInterface< Real > make_check(DynamicConstraint< Real > &con)