forked from acados/acados
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvention_about_external_functions.txt
310 lines (195 loc) · 7.57 KB
/
convention_about_external_functions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
This file contains the description of all external functions interfaced to acados.
!!! Please keep it updated when developing new features !!!
/************************************************
* ocp_nlp_cost_external
************************************************/
// complete gradient and hessian of cost, computed externally
external function: ext_cost
inputs:
0) [u; x] size: nu+nx type: COLMAJ
outputs:
0) [grad_u; grad_x] size: nu+nx type: COLMAJ
1) [hess_uu, hess_ux; hess_xu; hess_xx] size: (nu+nx)*(nu+nx) type: COLMAJ
/************************************************
* ocp_nlp_cost_nls
************************************************/
// function and jacobian_transposed of residuals of nonlinear least-squares
external function: nls_jac
inputs:
0) [u; x] size: nu+nx type: BLASFEO_DVEC
outputs:
0) [fun] size: ny type: BLASFEO_DVEC
1) [jac_u'; jac_x'] size: (nu+nx)*(ny) type: BLASFEO_DMAT
// exact hessian of nonlinear least-squares, computed using the numerical values in fun for the residuals
external function: nls_hess
inputs:
0) [u; x] size: nu+nx type: BLASFEO_DVEC
1) [fun] size: ny type: BLASFEO_DVEC
outputs:
0) [hess_uu, hess_ux; hess_xu; hess_xx] size: (nu+nx)*(nu+nx) type: BLASFEO_DMAT
/************************************************
* ocp_nlp_constraints
************************************************/
// function and jacobian_transposed of nonlinear constraints
external function: h
inputs:
0) [u; x] size: nu+nx type: BLASFEO_DVEC
outputs:
0) [fun] size: nh type: BLASFEO_DVEC_ARGS
1) [jac_u'; jac_x'] size: (nu+nx)*nh type: BLASFEO_DMAT_ARGS
/************************************************
* sim_erk_integrator
************************************************/
// function of explicit ode model
external function: expl_ode_fun
inputs:
0) [x] size: nx type: COLMAJ
1) [u] size: nu type: COLMAJ
outputs:
0) [fun] size: nx type: COLMAJ
// function and jacobian-times-seeds (forward sensitivities) of explicit ode model, computed using vde model
external function: expl_vde_for
inputs:
0) [x] size: nx type: COLMAJ
1) [Sx] size: nx*nx type: COLMAJ
2) [Su] size: nx*nu type: COLMAJ
3) [u] size: nu type: COLMAJ
outputs:
0) [fun] size: nx type: COLMAJ
1) [jac_x*Sx] size: nx*nx type: COLMAJ
2) [jac_x*Su+jac_u] size: nx*nu type: COLMAJ
// jacobian_transposed-times-vector (adjoint sensitivities) of explicit ode model
external function: expl_ode_adj
0) [x] size: nx type: COLMAJ
1) [lam] size: nx type: COLMAJ
2) [u] size: nu type: COLMAJ
outputs:
0) [jac_x'*lam; jac_u'*lam] size: nx+nu type: COLMAJ
// hessian of explicit ode model, computed using vde model
external function: expl_vde_hess
0) [x] size: nx type: COLMAJ
1) [Sx] size: nx*nx type: COLMAJ
2) [Su] size: nx*nu type: COLMAJ
3) [lam] size: nx type: COLMAJ
4) [u] size: nu type: COLMAJ
outputs:
0) [jac_x'*lam; jac_u'*lam] size: nx+nu type: COLMAJ
1) [hess_xx, hess_xu; hess_ux, hess_uu] size: (nx+nu)*(nx+nu) type: COLMAJ
/************************************************
* sim_lifted_irk_integrator
************************************************/
// function and jacobian of explicit ode model
external function: expl_ode_jac
inputs:
0) [x] size: nx type: COLMAJ
1) [u] size: nu type: COLMAJ
outputs:
0) [fun] size: nx type: COLMAJ
1) [jac] size: nx*ns type: COLMAJ
// function and jacobian-times-seeds (forward sensitivities) of explicit ode model, computed using vde model
external function: expl_vde_for
inputs:
0) [x] size: nx type: COLMAJ
1) [Sx] size: nx*nx type: COLMAJ
2) [Su] size: nx*nu type: COLMAJ
3) [u] size: nu type: COLMAJ
outputs:
0) [fun] size: nx type: COLMAJ
1) [jac_x*Sx] size: nx*nx type: COLMAJ
2) [jac_x*Su+jac_u] size: nx*nu type: COLMAJ
/************************************************
* sim_irk_integrator
************************************************/
// function of implicit ode model
external function: impl_ode_fun
inputs:
0) [x] size: nx type: BLASFEO_DVEC
1) [K] size: nx type: BLASFEO_DVEC_ARGS
2) [u] size: nu type: COLMAJ
3) [z] size: nz type: BLASFEO_DVEC_ARGS
outputs:
0) [fun] size: nx type: BLASFEO_DVEC_ARGS
// function and jacobians of implicit ode model
external function: impl_ode_fun_jac_x_xdot
inputs:
0) [x] size: nx type: BLASFEO_DVEC
1) [K] size: nx type: BLASFEO_DVEC_ARGS
2) [u] size: nu type: COLMAJ
3) [z] size: nz type: BLASFEO_DVEC_ARGS
outputs:
0) [fun] size: nx type: BLASFEO_DVEC_ARGS
1) [jac_x] size: nx*nx type: BLASFEO_DMAT
2) [jac_xdot] size: nx*nx type: BLASFEO_DMAT
// jacobians of implicit ode model
external function: impl_ode_jac_x_xdot_u
inputs:
0) [x] size: nx type: BLASFEO_DVEC
1) [K] size: nx type: BLASFEO_DVEC_ARGS
2) [u] size: nu type: COLMAJ
3) [z] size: nz type: BLASFEO_DVEC_ARGS
outputs:
0) [jac_x] size: nx*nx type: BLASFEO_DMAT
1) [jac_xdot] size: nx*nx type: BLASFEO_DMAT
2) [jac_u] size: nx*nu type: BLASFEO_DMAT
// hessian function of implicit ode model
external function: impl_ode_hess
inputs:
0) [x] size: nx type: BLASFEO_DVEC
1) [K] size: nx type: BLASFEO_DVEC_ARGS
2) [u] size: nu type: COLMAJ
3) [z] size: nz type: BLASFEO_DVEC_ARGS
4) [lam] size: nx+nz type: BLASFEO_DVEC_ARGS
5) [dxkzu_w0] size: (2*nx+nz+nu, nx+nu) type: BLASFEO_DMAT_ARGS
outputs:
0) [f_hess] size: (nx+nu, nx+nu) type: BLASFEO_DMAT
/************************************************
* sim_new_lifted_irk_integrator
************************************************/
// function of implicit ode model
external function: impl_ode_fun
inputs:
0) [x] size: nx type: BLASFEO_DVEC
1) [K] size: nx type: BLASFEO_DVEC_ARGS
2) [u] size: nu type: COLMAJ
outputs:
0) [fun] size: nx type: BLASFEO_DVEC_ARGS
// function of implicit ode model + jacobians of implicit ode model
external function: impl_ode_fun_jac_x_xdot_u
inputs:
0) [x] size: nx type: BLASFEO_DVEC
1) [K] size: nx type: BLASFEO_DVEC_ARGS
2) [u] size: nu type: COLMAJ
outputs:
0) [fun] size: nx type: BLASFEO_DVEC_ARGS
1) [jac_x] size: nx*nx type: BLASFEO_DMAT
2) [jac_xdot] size: nx*nx type: BLASFEO_DMAT
3) [jac_u] size: nx*nu type: BLASFEO_DMAT
/************************************************
* sim_gnsf
************************************************/
/* nonlinearity function phi */
external functions: phi_fun, phi_fun_jac_y, phi_jac_y_uhat
inputs:
0) [y] size: ny type: BLASFEO_DVEC_ARGS
1) [uhat] size: nuhat type: BLASFEO_DVEC
// phi_fun
outputs:
0) [fun] size: n_out type: BLASFEO_DVEC_ARGS
// phi_fun_jac_y
outputs:
0) [fun] size: n_out type: BLASFEO_DVEC_ARGS
1) [jac_y] size: n_out*ny type: BLASFEO_DMAT_ARGS
// phi_jac_y_uhat
outputs:
0) [jac_y] size: n_out*ny type: BLASFEO_DMAT_ARGS
1) [jac_uhat] size: n_out*nuhat type: BLASFEO_DMAT_ARGS
/* linear output function f_lo */
external function: f_lo_fun_jac_x1_x1dot_u_z
inputs:
0) [x1] size: nx1 type: BLASFEO_DVEC_ARGS
1) [x1dot] size: nx1 type: BLASFEO_DVEC_ARGS
2) [z] size: nz type: BLASFEO_DVEC_ARGS
3) [u] size: nu type: BLASFEO_DVEC
outputs:
0) [fun] size: nx2 type: BLASFEO_DVEC_ARGS
1) [jac_x1_x1dot_u_z] size: nx2*(2*nx1+nu+nz) type: BLASFEO_DMAT_ARGS