1 // NOLINT(legal/copyright)
2
3 // SYMBOL "nlpsol_prob"
4 template<typename T1>
5 struct casadi_nlpsol_prob {
6 casadi_int nx, ng, np;
7 };
8 // C-REPLACE "casadi_nlpsol_prob<T1>" "struct casadi_nlpsol_prob"
9
10 // SYMBOL "nlpsol_data"
11 template<typename T1>
12 struct casadi_nlpsol_data {
13 // Problem structure
14 const casadi_nlpsol_prob<T1>* prob;
15 // Variable bounds
16 T1 *lbz, *ubz;
17 // Parameter values
18 const T1 *p;
19 // Current primal solution
20 T1 *z;
21 // Current dual solution
22 T1 *lam, *lam_p;
23 // Outputs
24 T1 f;
25 };
26 // C-REPLACE "casadi_nlpsol_data<T1>" "struct casadi_nlpsol_data"
27
28 // SYMBOL "nlpsol_work"
29 template<typename T1>
casadi_nlpsol_work(const casadi_nlpsol_prob<T1> * p,casadi_int * sz_iw,casadi_int * sz_w)30 void casadi_nlpsol_work(const casadi_nlpsol_prob<T1>* p, casadi_int* sz_iw, casadi_int* sz_w) {
31 // Reset sz_w, sz_iw
32 *sz_w = *sz_iw = 0;
33 *sz_w += p->nx + p->ng; // z
34 *sz_w += p->nx + p->ng; // lbz
35 *sz_w += p->nx + p->ng; // ubz
36 *sz_w += p->nx + p->ng; // lam
37 *sz_w += p->np; // lam_p
38 }
39
40
41 // SYMBOL "nlpsol_init"
42 template<typename T1>
casadi_nlpsol_init(casadi_nlpsol_data<T1> * d,casadi_int ** iw,T1 ** w)43 void casadi_nlpsol_init(casadi_nlpsol_data<T1>* d, casadi_int** iw, T1** w) {
44 // Local variables
45 casadi_int nx, ng, np;
46 const casadi_nlpsol_prob<T1>* p = d->prob;
47 nx = p->nx;
48 ng = p->ng;
49 np = p->np;
50 // Get matrix number of nonzeros
51 d->z = *w; *w += nx + ng;
52 d->lbz = *w; *w += nx + ng;
53 d->ubz = *w; *w += nx + ng;
54 d->lam = *w; *w += nx + ng;
55 d->lam_p = *w; *w += np;
56 }
57