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