summaryrefslogtreecommitdiff
path: root/build/Bonmin/include/coin/ThirdParty/nlp.h
blob: 67d00c4056600f47cd99cd269634e660197c42e5 (plain)
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
/****************************************************************
Copyright (C) 1997-1998, 2001 Lucent Technologies
All Rights Reserved

Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.

LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/

#ifndef NLP_H_included
#define NLP_H_included

#ifndef ASL_included
#include "asl.h"
#endif

typedef struct argpair argpair;
typedef struct cde cde;
typedef struct cexp cexp;
typedef struct cexp1 cexp1;
typedef struct de de;
typedef union  ei ei;
typedef struct expr expr;
typedef struct expr_f expr_f;
typedef struct expr_h expr_h;
typedef struct expr_if expr_if;
typedef struct expr_v expr_v;
typedef struct expr_va expr_va;
typedef struct funnel funnel;
typedef struct list list;

typedef real efunc ANSI((expr * A_ASL));

#define r_ops     r_ops_ASL
#define obj1val   obj1val_ASL
#define obj1grd   obj1grd_ASL
#define con1val   con1val_ASL
#define jac1val   jac1val_ASL
#define con1ival  con1ival_ASL
#define con1grd   con1grd_ASL
#define lcon1val  lcon1val_ASL
#define x1known   x1known_ASL

 union
ei {
	expr	*e;
	expr	**ep;
	expr_if	*eif;
	expr_n	*en;
	int	i;
	plterm	*p;
	de	*d;
	real	*rp;
	derp	*D;
	cexp	*ce;
	};

 struct
expr {
	efunc *op;
	int a;
	real dL;
	ei L, R;
	real dR;
	};

 struct
expr_v {
	efunc *op;
	int a;
	real v;
	};

 struct
expr_if {
	efunc *op;
	int a;
	expr *e, *T, *F;
	derp *D, *dT, *dF, *d0;
	ei Tv, Fv;
	expr_if *next, *next2;
	};

 struct
expr_va {
	efunc *op;
	int a;
	ei L, R;
	expr_va *next, *next2;
	derp *d0;
	};

 struct
cde {
	expr	*e;
	derp	*d;
	int	zaplen;
	};

 struct
de {
	expr *e;
	derp *d;
	ei dv;
	};

 struct
list {
	list	*next;
	ei	item;
	};

 struct
cexp1 {
	expr	*e;
	int	nlin;
	linpart	*L;
	};

 struct
cexp {
	expr	*e;
	int	nlin;
	linpart	*L;
	funnel	*funneled;
	list	*cref;
	ei	z;
	int	zlen;
	derp	*d;
	int	*vref;
	};

 struct
funnel {
	funnel	*next;
	cexp	*ce;
	derp	*fulld;
	cplist	*cl;
	cde	fcde;
	};

 struct
argpair {
	expr	*e;
	union {
		char	**s;
		real	*v;
		} u;
	};

 struct
expr_f {
	efunc *op;
	int	a;
	func_info *fi;
	arglist	*al;
	argpair	*ap, *ape, *sap, *sape;
	expr	*args[1];
	};

 struct
expr_h {
	efunc *op;
	int	a;
	char	sym[1];
	};

 typedef struct
Edag1info {
	cde	*con_de_;	/* constraint deriv. and expr. info */
	cde	*lcon_de_;	/* logical constraints */
	cde	*obj_de_;	/* objective  deriv. and expr. info */
	expr_v	*var_e_;	/* variable values (and related items) */

			/* stuff for "defined" variables */
	funnel	*f_b_;
	funnel	*f_c_;
	funnel	*f_o_;
	expr_v	*var_ex_,
		*var_ex1_;
	cexp	*cexps_;
	cexp1	*cexps1_;
	efunc	**r_ops_;
	char	*c_class;	/* class of each constraint: */
				/* 0 = constant */
				/* 1 = linear */
				/* 2 = quadratic */
				/* 3 = general nonlinear */
	char	*o_class;	/* class of each objective */
	char	*v_class;	/* class of each defined variable */
	int	c_class_max;	/* max of c_class values */
	int	o_class_max;	/* max of o_class values */
				/* The above are only computed if requested */
				/* by the ASL_find_c_class and */
				/* ASL_find_o_class bits of the flags arg */
				/* to pfgh_read() and pfg_read() */
	} Edag1info;

 typedef struct
ASL_fg {
	Edagpars  p;
	Edaginfo  i;
	Edag1info I;
	} ASL_fg;

#ifdef __cplusplus
 extern "C" {
#endif
 extern efunc *r_ops_ASL[];
 extern void com1eval_ASL ANSI((ASL_fg*, int, int));
 extern void comeval_ASL ANSI((ASL_fg*, int, int));
 extern void funnelset_ASL ANSI((ASL_fg*, funnel *));
 extern real obj1val ANSI((ASL*, int nobj, real *X, fint *nerror));
 extern void obj1grd ANSI((ASL*, int nobj, real *X, real *G, fint *nerror));
 extern void con1val ANSI((ASL*, real *X, real *F, fint *nerror));
 extern void jac1val ANSI((ASL*, real *X, real *JAC, fint *nerror));
 extern real con1ival ANSI((ASL*,int nc, real *X, fint *ne));
 extern void con1grd  ANSI((ASL*, int nc, real *X, real *G, fint *nerror));
 extern int  lcon1val ANSI((ASL*,int nc, real *X, fint *ne));
 extern int x0_check_ASL ANSI((ASL_fg*, real *));
 extern void x1known ANSI((ASL*, real*, fint*));
#ifdef __cplusplus
	}
#endif

#define comeval(a,b) comeval_ASL((ASL_fg*)asl,a,b)
#define com1eval(a,b) com1eval_ASL((ASL_fg*)asl,a,b)
#define funnelset(a) funnelset_ASL((ASL_fg*)asl,a)

#define cexps	asl->I.cexps_
#define cexps1	asl->I.cexps1_
#define con_de	asl->I.con_de_
#define f_b	asl->I.f_b_
#define f_c	asl->I.f_c_
#define f_o	asl->I.f_o_
#define lcon_de	asl->I.lcon_de_
#define obj_de	asl->I.obj_de_
#define var_e	asl->I.var_e_
#define var_ex	asl->I.var_ex_
#define var_ex1	asl->I.var_ex1_

#undef f_OPNUM
#define f_OPNUM (efunc*)f_OPNUM_ASL

#endif /* NLP_H_included */