1 /**************************************************************** 2 Copyright (C) 1997-1998, 2001 Lucent Technologies 3 All Rights Reserved 4 5 Permission to use, copy, modify, and distribute this software and 6 its documentation for any purpose and without fee is hereby 7 granted, provided that the above copyright notice appear in all 8 copies and that both that the copyright notice and this 9 permission notice and warranty disclaimer appear in supporting 10 documentation, and that the name of Lucent or any of its entities 11 not be used in advertising or publicity pertaining to 12 distribution of the software without specific, written prior 13 permission. 14 15 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 16 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 17 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY 18 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 20 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 21 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 22 THIS SOFTWARE. 23 ****************************************************************/ 24 25 #ifndef NLP_H_included 26 #define NLP_H_included 27 28 #ifndef ASL_included 29 #include "asl.h" 30 #endif 31 32 typedef struct argpair argpair; 33 typedef struct cde cde; 34 typedef struct cexp cexp; 35 typedef struct cexp1 cexp1; 36 typedef struct de de; 37 typedef union ei ei; 38 typedef struct expr expr; 39 typedef struct expr_f expr_f; 40 typedef struct expr_h expr_h; 41 typedef struct expr_if expr_if; 42 typedef struct expr_v expr_v; 43 typedef struct expr_va expr_va; 44 typedef struct funnel funnel; 45 typedef struct list list; 46 47 typedef real efunc ANSI((expr * A_ASL)); 48 49 #define r_ops r_ops_ASL 50 #define obj1val obj1val_ASL 51 #define obj1grd obj1grd_ASL 52 #define con1val con1val_ASL 53 #define jac1val jac1val_ASL 54 #define con1ival con1ival_ASL 55 #define con1grd con1grd_ASL 56 #define lcon1val lcon1val_ASL 57 #define x1known x1known_ASL 58 59 union 60 ei { 61 expr *e; 62 expr **ep; 63 expr_if *eif; 64 expr_n *en; 65 int i; 66 plterm *p; 67 de *d; 68 real *rp; 69 derp *D; 70 cexp *ce; 71 }; 72 73 struct 74 expr { 75 efunc *op; 76 int a; 77 real dL; 78 ei L, R; 79 real dR; 80 }; 81 82 struct 83 expr_v { 84 efunc *op; 85 int a; 86 real v; 87 }; 88 89 struct 90 expr_if { 91 efunc *op; 92 int a; 93 expr *e, *T, *F; 94 derp *D, *dT, *dF, *d0; 95 ei Tv, Fv; 96 expr_if *next, *next2; 97 }; 98 99 struct 100 expr_va { 101 efunc *op; 102 int a; 103 ei L, R; 104 expr_va *next, *next2; 105 derp *d0; 106 }; 107 108 struct 109 cde { 110 expr *e; 111 derp *d; 112 int zaplen; 113 }; 114 115 struct 116 de { 117 expr *e; 118 derp *d; 119 ei dv; 120 }; 121 122 struct 123 list { 124 list *next; 125 ei item; 126 }; 127 128 struct 129 cexp1 { 130 expr *e; 131 int nlin; 132 linpart *L; 133 }; 134 135 struct 136 cexp { 137 expr *e; 138 int nlin; 139 linpart *L; 140 funnel *funneled; 141 list *cref; 142 ei z; 143 int zlen; 144 derp *d; 145 int *vref; 146 }; 147 148 struct 149 funnel { 150 funnel *next; 151 cexp *ce; 152 derp *fulld; 153 cplist *cl; 154 cde fcde; 155 }; 156 157 struct 158 argpair { 159 expr *e; 160 union { 161 char **s; 162 real *v; 163 } u; 164 }; 165 166 struct 167 expr_f { 168 efunc *op; 169 int a; 170 func_info *fi; 171 arglist *al; 172 argpair *ap, *ape, *sap, *sape; 173 expr *args[1]; 174 }; 175 176 struct 177 expr_h { 178 efunc *op; 179 int a; 180 char sym[1]; 181 }; 182 183 typedef struct 184 Edag1info { 185 cde *con_de_; /* constraint deriv. and expr. info */ 186 cde *lcon_de_; /* logical constraints */ 187 cde *obj_de_; /* objective deriv. and expr. info */ 188 expr_v *var_e_; /* variable values (and related items) */ 189 190 /* stuff for "defined" variables */ 191 funnel *f_b_; 192 funnel *f_c_; 193 funnel *f_o_; 194 expr_v *var_ex_, 195 *var_ex1_; 196 cexp *cexps_; 197 cexp1 *cexps1_; 198 efunc **r_ops_; 199 char *c_class; /* class of each constraint: */ 200 /* 0 = constant */ 201 /* 1 = linear */ 202 /* 2 = quadratic */ 203 /* 3 = general nonlinear */ 204 char *o_class; /* class of each objective */ 205 char *v_class; /* class of each defined variable */ 206 int c_class_max; /* max of c_class values */ 207 int o_class_max; /* max of o_class values */ 208 /* The above are only computed if requested */ 209 /* by the ASL_find_c_class and */ 210 /* ASL_find_o_class bits of the flags arg */ 211 /* to pfgh_read() and pfg_read() */ 212 } Edag1info; 213 214 typedef struct 215 ASL_fg { 216 Edagpars p; 217 Edaginfo i; 218 Edag1info I; 219 } ASL_fg; 220 221 #ifdef __cplusplus 222 extern "C" { 223 #endif 224 extern efunc *r_ops_ASL[]; 225 extern void com1eval_ASL ANSI((ASL_fg*, int, int)); 226 extern void comeval_ASL ANSI((ASL_fg*, int, int)); 227 extern void funnelset_ASL ANSI((ASL_fg*, funnel *)); 228 extern real obj1val ANSI((ASL*, int nobj, real *X, fint *nerror)); 229 extern void obj1grd ANSI((ASL*, int nobj, real *X, real *G, fint *nerror)); 230 extern void con1val ANSI((ASL*, real *X, real *F, fint *nerror)); 231 extern void jac1val ANSI((ASL*, real *X, real *JAC, fint *nerror)); 232 extern real con1ival ANSI((ASL*,int nc, real *X, fint *ne)); 233 extern void con1grd ANSI((ASL*, int nc, real *X, real *G, fint *nerror)); 234 extern int lcon1val ANSI((ASL*,int nc, real *X, fint *ne)); 235 extern int x0_check_ASL ANSI((ASL_fg*, real *)); 236 extern void x1known ANSI((ASL*, real*, fint*)); 237 #ifdef __cplusplus 238 } 239 #endif 240 241 #define comeval(a,b) comeval_ASL((ASL_fg*)asl,a,b) 242 #define com1eval(a,b) com1eval_ASL((ASL_fg*)asl,a,b) 243 #define funnelset(a) funnelset_ASL((ASL_fg*)asl,a) 244 245 #define cexps asl->I.cexps_ 246 #define cexps1 asl->I.cexps1_ 247 #define con_de asl->I.con_de_ 248 #define f_b asl->I.f_b_ 249 #define f_c asl->I.f_c_ 250 #define f_o asl->I.f_o_ 251 #define lcon_de asl->I.lcon_de_ 252 #define obj_de asl->I.obj_de_ 253 #define var_e asl->I.var_e_ 254 #define var_ex asl->I.var_ex_ 255 #define var_ex1 asl->I.var_ex1_ 256 257 #undef f_OPNUM 258 #define f_OPNUM (efunc*)f_OPNUM_ASL 259 260 #endif /* NLP_H_included */ 261