-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhook.h
58 lines (43 loc) · 1.43 KB
/
hook.h
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
#include "Python.h"
#include "IpStdCInterface.h"
#include <stdio.h>
#include "numpy/arrayobject.h" /* NumPy header */
#ifndef PY_IPOPT_HOOK
#define PY_IPOPT_HOOK
Bool eval_f(Index n, Number* x, Bool new_x,
Number* obj_value, UserDataPtr user_data);
Bool eval_grad_f(Index n, Number* x, Bool new_x,
Number* grad_f, UserDataPtr user_data);
Bool eval_g(Index n, Number* x, Bool new_x,
Index m, Number* g, UserDataPtr user_data);
Bool eval_jac_g(Index n, Number *x, Bool new_x,
Index m, Index nele_jac,
Index *iRow, Index *jCol, Number *values,
UserDataPtr user_data);
Bool eval_h(Index n, Number *x, Bool new_x, Number obj_factor,
Index m, Number *lambda, Bool new_lambda,
Index nele_hess, Index *iRow, Index *jCol,
Number *values, UserDataPtr user_data);
typedef struct {
PyObject *eval_f_python;
PyObject *eval_grad_f_python;
PyObject *eval_g_python;
PyObject *eval_jac_g_python;
PyObject *eval_h_python;
PyObject *apply_new_python;
PyObject* userdata;
} DispatchData;
// DispatchData myowndata;
// static IpoptProblem nlp = NULL; /* IpoptProblem */
#ifdef __GNUC__
__attribute__ ((format (printf, 1, 2)))
#endif
void logger(const char* fmt, ...);
typedef struct {
PyObject_HEAD
IpoptProblem nlp;
DispatchData* data;
Index n,m;
} problem;
void save_python_exception(void);
#endif