00001 /* 00002 This file is a portion of the OsiDylp LP distribution. 00003 00004 Copyright (C) 2005 Lou Hafer 00005 00006 School of Computing Science 00007 Simon Fraser University 00008 Burnaby, B.C., V5A 1S6, Canada 00009 lou@cs.sfu.ca 00010 00011 This program is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the Free 00013 Software Foundation; either version 2 of the License, or (at your option) 00014 any later version. 00015 00016 This program is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00019 more details. 00020 00021 You should have received a copy of the GNU General Public License along 00022 with this program; if not, write to the Free Software Foundation, Inc., 00023 51 Franklin St., Fifth Floor, Boston, MA 02110-1301 USA 00024 */ 00025 00026 #ifndef _CONSYS_H 00027 #define _CONSYS_H 00028 00029 /* 00030 @(#)consys.h 4.4 11/11/04 00031 svn/cvs: $Id: consys.h 71 2006-06-09 04:21:15Z andreasw $ 00032 00033 This header file contains declarations for a constraint system data 00034 structure, tailored for LP-based branch-and-cut MILP algorithms (more 00035 generally, for any situation where dynamic change in the number of rows 00036 and/or columns is expected). The constraint system allows for arbitrary 00037 additions and deletions. Additional space is allocated as needed; there are 00038 no a priori limits. Allocated space is never reduced, however, short of 00039 destroying the constraint system. 00040 00041 The coefficient matrix is implemented as a sparse structure, linked by row 00042 and by column. Access to the rows and columns of the coefficient matrix is 00043 via utility routines. 00044 00045 To provide O(1) cost for row and column addition and deletion, while 00046 maintaining a dense index set, the hole left by deleting a row or column 00047 is filled by moving the last row or column to occupy the vacant index slot. 00048 00049 The client can 'attach' row and column vectors to the constraint system; 00050 more precisely, vectors and multiple pointers to those vectors. The 00051 vectors will be dynamically resized and pointers updated whenever rows 00052 or columns are added to the constraint system. Entries in attached vectors 00053 are automatically reordered when a row or column is moved to fill the hole 00054 left by a deletion. 00055 00056 The user is expected to work directly with any attached vectors; there are 00057 no special access routines. 00058 00059 Because rows and columns can move, clients must be careful when they keep 00060 records of row or column indices, and update these records as necessary. 00061 00062 A special set of attached vectors are referred to as associated vectors. 00063 These are distinguished only by having pointers allocated in the constraint 00064 system header structure. 00065 00066 NOTE: The package assumes that variables and constraints are indexed from 00067 1; this makes error checking a lot more reliable, particularly for 00068 errors of omission (whoops, forgot to set that index ... ). Vectors 00069 intended for expanded rows or columns must be sized accordingly. 00070 (I.e., if vector is to hold k values, the actual allocated space 00071 is k+1 entries, with vector[0] unused.) consys will do this 00072 automatically when asked to allocate space. Clients must remember 00073 this when allocating space for vectors that they will attach to a 00074 constraint system. 00075 00076 NOTE: The constraint system is prepared to deal with both finite (most 00077 often DBL_MAX) and infinite (IEEE) infinity in the upper and lower 00078 bounds vectors for variables (vlb, vub). Explicit checks are 00079 necessary to maintain the value of a finite infinity when scaling the 00080 constraint system. The value of infinity must be supplied as a 00081 parameter to create_consys(). It's not a good idea to have infinity 00082 popping up elsewhere, but IEEE infinity should work (because no 00083 explicit checks are required for mathematical correctness). 00084 00085 NOTE: At the infinitesimal end, any coefficient with absolute value less 00086 than 1.0e-20 will be dropped. Currently this is hardwired (see 00087 consys_create). It may change if there's a need. 00088 */ 00089 00090 #include "vector.h" 00091 00092 00093 00094 /* 00095 Constraint coefficient matrix 00096 00097 This is a sparse-matrix data structure, linked by row and column. 00098 00099 Note that rows and columns are << not >> sorted in index order. Insertions 00100 and deletions are done adjacent to the headers, for efficiency. 00101 */ 00102 /* 00103 Coefficients 00104 00105 Field Description 00106 ----- ----------- 00107 rowhdr The row header for this coefficient. 00108 colhdr The column header for this coefficient. 00109 val The value of this coefficient. 00110 rownxt The next coefficient in this row. 00111 colnxt The next coefficient in this column. 00112 */ 00113 00114 typedef struct coeff_struct_tag 00115 { struct rowhdr_struct_tag *rowhdr ; 00116 struct colhdr_struct_tag *colhdr ; 00117 double val ; 00118 struct coeff_struct_tag *rownxt ; 00119 struct coeff_struct_tag *colnxt ; } coeff_struct ; 00120 00121 /* 00122 Column headers 00123 00124 Field Description 00125 ----- ----------- 00126 ndx The index of this column. 00127 len The number of coefficients in the column. 00128 nme The name of the variable associated with the column. 00129 coeffs The coefficients of the column. 00130 */ 00131 00132 typedef struct colhdr_struct_tag 00133 { int ndx ; 00134 int len ; 00135 const char *nme ; 00136 coeff_struct *coeffs ; } colhdr_struct ; 00137 00138 /* 00139 Row headers 00140 00141 Field Description 00142 ----- ----------- 00143 ndx The index of this row. 00144 len The number of coefficients in the row. 00145 nme The name of the variable associated with the row. 00146 coeffs The coefficients of the row. 00147 */ 00148 00149 typedef struct rowhdr_struct_tag 00150 { int ndx ; 00151 int len ; 00152 const char *nme ; 00153 coeff_struct *coeffs ; } rowhdr_struct ; 00154 00155 /* 00156 Coefficient matrix header 00157 00158 Field Definition 00159 ----- --------- 00160 coeffcnt The number of coefficients in the matrix. 00161 cols Array of pointers to column headers. 00162 rows Array of pointers to row headers. 00163 */ 00164 00165 typedef struct 00166 { int coeffcnt ; 00167 colhdr_struct **cols ; 00168 rowhdr_struct **rows ; } conmtx_struct ; 00169 00170 00171 00172 /* 00173 Attached Vectors: 00174 00175 As mentioned at the top, attached vectors are automatically resized whenever 00176 the constraint system is resized, and reorderd to track the movement of rows 00177 and columns due to deletions. 00178 00179 A particular subset of attached vectors are designated as associated 00180 vectors; a system has at most one of each type of associated vector. 00181 Their only distinguishing characteristic is that they occupy the dedicated 00182 pointers in the constraint system header: 00183 * objective function 00184 * variable type <3> 00185 * variable upper & lower bounds 00186 * right-hand-side (a.k.a. rhs or b) and rhsl (a.k.a. rhslow or blow) <1> 00187 * constraint type 00188 * upper & lower bounds for constraint left-hand-sides <2> 00189 * row and column scaling vectors (more accurately, the diagonal elements 00190 of row and column scaling matrices) 00191 00192 <1> rhsl is created when range constraints (blow <= ax <= b) are present 00193 in the constraint system. 00194 <2> These are calculated using the upper and lower bounds on the variables 00195 in the constraint, and are used in arc consistency calculations. See 00196 further explanation below. 00197 <3> Arguably the variable type vector only needs to cover the architectural 00198 variables, but it'd be a pain to distinguish a resize involving the 00199 architectural columns from a resize involving the logical columns. 00200 Easier to waste a little space. 00201 00202 The flags given below are used in attached vector headers to indicate 00203 how a vector should be handled, and in the consys_struct.parts field to 00204 indicate which components of the constraint system are present. Their 00205 most important function is to specify whether a vector is a row vector 00206 or a column vector. Beyond that, they serve as weak consistency and type 00207 checks. 00208 00209 Notes: 00210 * MTX, ROWHDR, and COLHDR cannot be allocated/deallocated, but having 00211 codes for them makes the interface to some of the utility routines a 00212 bit more uniform. 00213 * COL and ROW should be used for generic column and row vectors, 00214 respectively. 00215 * VUB is initialised to +infinity. 00216 * RSCALE and CSCALE are initialised to 1.0 00217 * VTYP and CTYP are tied to the vartyp_enum and contyp_enum types. 00218 */ 00219 00220 #define CONSYS_MTX ((flags) 1<<0) 00221 #define CONSYS_ROW ((flags) 1<<1) 00222 #define CONSYS_COL ((flags) 1<<2) 00223 #define CONSYS_OBJ ((flags) 1<<3) 00224 #define CONSYS_VUB ((flags) 1<<4) 00225 #define CONSYS_VLB ((flags) 1<<5) 00226 #define CONSYS_RHS ((flags) 1<<6) 00227 #define CONSYS_CUB ((flags) 1<<7) 00228 #define CONSYS_CLB ((flags) 1<<8) 00229 #define CONSYS_RHSLOW ((flags) 1<<9) 00230 #define CONSYS_VTYP ((flags) 1<<10) 00231 #define CONSYS_CTYP ((flags) 1<<11) 00232 #define CONSYS_COLHDR ((flags) 1<<12) 00233 #define CONSYS_ROWHDR ((flags) 1<<13) 00234 #define CONSYS_RSCALE ((flags) 1<<14) 00235 #define CONSYS_CSCALE ((flags) 1<<15) 00236 00237 /* 00238 Macros to identify row and column vectors. 00239 */ 00240 #define CONSYS_ROWVEC \ 00241 (CONSYS_OBJ|CONSYS_VUB|CONSYS_VLB|CONSYS_VTYP|CONSYS_CSCALE| \ 00242 CONSYS_COLHDR|CONSYS_ROW) 00243 00244 #define CONSYS_COLVEC \ 00245 (CONSYS_RHS|CONSYS_RHSLOW|CONSYS_CUB|CONSYS_CLB|CONSYS_CTYP|CONSYS_RSCALE| \ 00246 CONSYS_ROWHDR|CONSYS_COL) 00247 00248 /* 00249 A macro to check for a valid vector type. 00250 */ 00251 00252 #define VALID_ATTVTYPE(zz_vectype_zz) \ 00253 (zz_vectype_zz == CONSYS_OBJ || \ 00254 zz_vectype_zz == CONSYS_VUB || zz_vectype_zz == CONSYS_VLB || \ 00255 zz_vectype_zz == CONSYS_RHS || zz_vectype_zz == CONSYS_RHSLOW || \ 00256 zz_vectype_zz == CONSYS_CUB || zz_vectype_zz == CONSYS_CUB || \ 00257 zz_vectype_zz == CONSYS_VTYP || zz_vectype_zz == CONSYS_CTYP || \ 00258 zz_vectype_zz == CONSYS_RSCALE || zz_vectype_zz == CONSYS_CSCALE || \ 00259 zz_vectype_zz == CONSYS_ROW || zz_vectype_zz == CONSYS_COL) 00260 00261 00262 /* 00263 Attached vector header 00264 00265 This structure is used in the list of attached vectors that should be 00266 checked and resized with the constraint system. 00267 00268 Field Definition 00269 ----- ---------- 00270 nxt List link. 00271 what The type of vector (coded with the flag values for 00272 attached and associated vectors) 00273 elsze The size of an element in the vector. 00274 vec The address of the vector. 00275 pveclst A list of addresses which hold pointers to vec. If vec is 00276 moved as a result of a resize, these are rewritten. 00277 */ 00278 00279 typedef struct attvhdr_struct_tag { struct attvhdr_struct_tag *nxt ; 00280 flags what ; 00281 int elsze ; 00282 void *vec ; 00283 lnk_struct *pveclst ; } attvhdr_struct ; 00284 00285 /* 00286 Constraint bounds 00287 00288 Constraint bounds are upper and lower bounds on the value of the 00289 left-hand-side of a constraint, calculated using the upper and lower bounds 00290 on variables. In the case where all variables have finite bounds, the 00291 constraint bound will also be finite, and things are straightforward. But 00292 there's a complication --- we'll want to be able to efficiently handle the 00293 case where all variables have finite bounds except one, x<t>. In this case 00294 we can calculate a finite bound for the free variable, using the bounds on 00295 the other variables. Bottom line is we need a structure that keeps count of 00296 the number of infinities, as well as the finite portion of the bound. See 00297 consistency.c for more about the mechanics of particular cases. 00298 00299 The interpretation of an entry is as follows: 00300 -varcnt <= inf < 0 inf is the negative of the index of the single 00301 remaining variable contributing an infinity; bnd is 00302 the finite lhs bound calculated from the other 00303 variables of the constraint 00304 inf >= 0 inf is the number of variables contributing infinity 00305 to the bound; bnd is the value of the finite portion 00306 of the lhs bound. If inf == 0, the lhs bound is finite. 00307 00308 inf < -varcnt and inf = 1 are invalid. A value which exceeds the number of 00309 variables in the constraint is also bogus. 00310 00311 This encoding means that it's impossible to distinguish +inf and -inf just 00312 by looking at the bound. But, in the case of constraint bounds, this hasn't 00313 been a problem in practice. Lower bounds go to -inf, and upper bounds go to 00314 +inf, and context has been sufficient. 00315 00316 The revs field is used to keep track of the number of times the bound has 00317 been revised. See milp.h:mipopts_struct for the recalculation frequency. 00318 */ 00319 00320 typedef struct { int revs ; 00321 int inf ; 00322 double bnd ; } conbnd_struct ; 00323 00324 00325 00326 /* 00327 Constraint type codes 00328 00329 These codes have their origin in the MPS input standard. 00330 00331 contypINV invalid 00332 contypNB non-binding constraint <1> 00333 contypGE >= inequality 00334 contypEQ equality 00335 contypLE <= inequality 00336 contypRNG 'range' constraint, lb <= ax <= ub (a sort of shorthand for 00337 a >= and a <= inequality) 00338 00339 <1> Non-binding constraints are a bit odd. They are used in two ways. 00340 The first non-binding constraint in the MPS file is, by convention, 00341 the objective function. The other use for non-binding constraints is 00342 in rows of type Dx (x one of N, E, G, or L), which specify linear 00343 combinations of constraints. 00344 <2> Following OSL (a good lead to follow when they're going where I want to 00345 go :-), bonsai doesn't accept Dx rows, and throws away all but the 00346 first non-binding constraint, which it keeps only if it needs it for 00347 the objective function. 00348 */ 00349 00350 typedef enum { contypINV = 0, contypNB, 00351 contypGE, contypEQ, contypLE, contypRNG } contyp_enum ; 00352 00353 #define VALID_CONTYPE(zz_ctyp_zz) \ 00354 (zz_ctyp_zz == contypGE || zz_ctyp_zz == contypEQ || \ 00355 zz_ctyp_zz == contypLE || zz_ctyp_zz == contypRNG) 00356 00357 /* 00358 Variable type codes 00359 00360 vartypINV invalid 00361 vartypCON continuous variable 00362 vartypINT general integer variable 00363 vartypBIN binary variable 00364 */ 00365 00366 typedef enum { vartypINV = 0, vartypCON, 00367 vartypINT, vartypBIN } vartyp_enum ; 00368 00369 #define VALID_VARTYPE(zz_vtyp_zz) \ 00370 (zz_vtyp_zz == vartypCON || \ 00371 zz_vtyp_zz == vartypINT || \ 00372 zz_vtyp_zz == vartypBIN) 00373 00374 #define INT_VARTYPE(zz_vtyp_zz) \ 00375 (zz_vtyp_zz == vartypINT || \ 00376 zz_vtyp_zz == vartypBIN) 00377 00378 /* 00379 Behavioural options 00380 00381 These codes are used as flags in the opts field of the constraint system 00382 header. 00383 00384 CONSYS_LVARS Set to indicate that logical variables are present and should 00385 be automatically maintained during constraint system 00386 manipulations. 00387 CONSYS_WRNZERO Set to indicate that a warning should be issued when the 00388 constraint system utility routines encounter a zero-length 00389 column or row. Also causes a warning during row/column 00390 creation and basis initialisation if an explicit zero 00391 coefficient is encountered. 00392 CONSYS_WRNATT Set to indicate that a warning should be issued when a 00393 duplicate attach request is encountered (i.e., both the 00394 vector and the pointer to the vector are already on the 00395 attvecs list). 00396 CONSYS_FININF `Finite infinity' --- the client is indulging in the common 00397 trick of using a large finite value (most often, DBL_MAX) as 00398 infinity. 00399 CONSYS_CORRUPT The constraint system is corrupt --- an error has occurred 00400 during construction or modification that caused an operation 00401 to abort. Currently set only for errors that occur outside of 00402 debug and paranoia (you're supposed to look at the error 00403 messages for paranoia and debug). 00404 */ 00405 00406 #define CONSYS_LVARS ((flags) 1<<0) 00407 #define CONSYS_WRNZERO ((flags) 1<<1) 00408 #define CONSYS_WRNATT ((flags) 1<<2) 00409 #define CONSYS_FININF ((flags) 1<<3) 00410 #define CONSYS_CORRUPT ((flags) 1<<4) 00411 00412 /* 00413 Constraint system header 00414 00415 The top-level 'handle' for the structure. 00416 00417 Field Definition 00418 ----- --------- 00419 nme The name assigned to this constraint system. 00420 parts Flags indicating which components of the constraint system are 00421 supposed to be present. 00422 opts Flags indicating various behavioural options. 00423 inf The value of infinity. 00424 tiny The value of the infinitesimal. 00425 varcnt The total number of variables (and the column dimension). 00426 archvcnt The number of architectural variables. The number of continuous 00427 architectural variables is archvcnt-(intvcnt+binvcnt). 00428 logvcnt The number of logical variables. 00429 intvcnt The number of general integer variables. 00430 binvcnt The number of binary variables. 00431 maxcollen The number of coefficients in the largest column. 00432 maxcolndx The index of the largest column. 00433 concnt The total number of constraints (and the row dimension). 00434 archccnt The number of architectural constraints. 00435 cutccnt The number of cut constraints. 00436 maxrowlen The number of coefficients in the largest row. 00437 maxrowndx The index of the largest row. 00438 colsze The allocated column capacity for the constraint system. 00439 rowsze The allocated row capacity for the constraint system. 00440 mtx The constraint matrix header. 00441 00442 The vectors rowscale and colscale are valid only after execution of one 00443 of the scaling routines consys_geomscale, consys_equiscale, or 00444 consys_applyscale. The fields maxaij and minaij are valid only after 00445 execution of consys_evalsys or any of the scaling routines. 00446 00447 maxaij max{i,j} |a<ij>| (valid only after scaling) 00448 minaij min{i,j, a<ij> != 0} |a<ij>| (valid only after scaling) 00449 rowscale The row scaling vector. 00450 colscale The column scaling vector. 00451 00452 objnme The name of the objective function. 00453 objndx Index of the objective function, if it's installed as a 00454 constraint cx - x<z> = 0. 00455 xzndx Index of the variable x<z>. 00456 obj The objective function. 00457 vtyp The type of variable. 00458 vub The upper bounds for variables. 00459 vlb The lower bounds for variables. 00460 rhs The right-hand-side vector. 00461 rhslow blow for range constraints of form blow <= ax <= b. 00462 ctyp The type of constraint (contyp_enum). 00463 cub The upper bounds for constraint left-hand-sides. 00464 clb The lower bounds for constraint left-hand sides. 00465 attvecs The list of attached vectors. 00466 00467 NOTE the distinction between dimension and size -- the allocated capacity 00468 of the constraint system is [rowsze x colsze], while the actual size 00469 of the constraint system is [concnt x varcnt]. 00470 */ 00471 00472 typedef struct 00473 { const char *nme ; 00474 flags parts ; 00475 flags opts ; 00476 double inf ; 00477 double tiny ; 00478 int varcnt ; 00479 int archvcnt ; 00480 int logvcnt ; 00481 int intvcnt ; 00482 int binvcnt ; 00483 int maxcollen ; 00484 int maxcolndx ; 00485 int concnt ; 00486 int archccnt ; 00487 int cutccnt ; 00488 int maxrowlen ; 00489 int maxrowndx ; 00490 int colsze ; 00491 int rowsze ; 00492 conmtx_struct mtx ; 00493 double maxaij ; 00494 double minaij ; 00495 double *rowscale ; 00496 double *colscale ; 00497 const char *objnme ; 00498 int objndx ; 00499 int xzndx ; 00500 double *obj ; 00501 vartyp_enum *vtyp ; 00502 double *vub ; 00503 double *vlb ; 00504 double *rhs ; 00505 double *rhslow ; 00506 contyp_enum *ctyp ; 00507 conbnd_struct *cub ; 00508 conbnd_struct *clb ; 00509 attvhdr_struct *attvecs ; } consys_struct ; 00510 00511 00512 00513 /* 00514 consys_utils.c 00515 */ 00516 00517 extern consys_struct *consys_create(const char *nme, flags parts, flags opts, 00518 int concnt, int varcnt, double infinity) ; 00519 extern bool consys_dupsys(consys_struct *src, consys_struct **dst, 00520 flags dstvecs) ; 00521 extern void consys_free (consys_struct *consys) ; 00522 extern bool consys_realloc(consys_struct *consys, char rowcol, int incr), 00523 consys_attach(consys_struct *consys, flags what, int elsze, 00524 void **pvec), 00525 consys_update(consys_struct *consys, void *oldvec, void *newvec), 00526 consys_detach(consys_struct *consys, void **pvec, bool all) ; 00527 00528 extern bool consys_addcol_pk(consys_struct *consys, 00529 vartyp_enum vartyp, pkvec_struct *pkcol, 00530 double obj, double vlb, double vub), 00531 consys_addcol_ex(consys_struct *consys, vartyp_enum vartyp, 00532 const char **nme, double *excol, 00533 double obj, double vlb, double vub), 00534 consys_addrow_pk(consys_struct *consys, char rowclass, 00535 contyp_enum contyp, pkvec_struct *pkrow, 00536 double rhs, double rhslow, 00537 conbnd_struct *cub, conbnd_struct *clb), 00538 consys_getcol_pk(consys_struct *consys, int colndx, 00539 pkvec_struct **pkvec), 00540 consys_getcol_ex(consys_struct *consys, int colndx, double **vec), 00541 consys_getrow_pk(consys_struct *consys, int rowndx, 00542 pkvec_struct **pkvec), 00543 consys_getrow_ex(consys_struct *consys, int rowndx, double **vec), 00544 consys_delcol(consys_struct *consys, int colndx), 00545 consys_delrow(consys_struct *consys, int rowndx), 00546 consys_delrow_stable(consys_struct *consys, int rowndx) ; 00547 00548 extern bool consys_setcoeff(consys_struct *consys, 00549 int rowndx, int colndx, double val) ; 00550 extern double consys_getcoeff(consys_struct *consys, int rowndx, int colndx) ; 00551 00552 extern bool consys_logicals(consys_struct *consys) ; 00553 00554 /* 00555 consys_mathutils.c 00556 */ 00557 00558 extern int consys_gcdrow(consys_struct *consys, int rowndx) ; 00559 00560 extern double consys_dotcol(consys_struct *consys, int colndx, double *vec), 00561 consys_dotrow(consys_struct *consys, int rowndx, double *vec) ; 00562 extern double consys_1normrow(consys_struct *consys, int rowndx), 00563 consys_ssqrow(consys_struct *consys, int rowndx), 00564 consys_2normrow(consys_struct *consys, int rowndx), 00565 consys_infnormrow(consys_struct *consys, int rowndx), 00566 consys_1normcol(consys_struct *consys, int rowndx), 00567 consys_ssqcol(consys_struct *consys, int rowndx), 00568 consys_2normcol(consys_struct *consys, int rowndx), 00569 consys_infnormcol(consys_struct *consys, int rowndx) ; 00570 00571 extern bool consys_mulrow(consys_struct *consys, int rowndx, double scalar) ; 00572 extern bool consys_divrow(consys_struct *consys, int rowndx, double scalar) ; 00573 00574 extern bool consys_accumcol(consys_struct *consys, int colndx, double *vec) ; 00575 extern bool consys_mulaccumcol(consys_struct *consys, int colndx, 00576 double scalar, double *vec) ; 00577 00578 /* 00579 consys_scaling.c 00580 */ 00581 00582 extern double consys_evalsys(consys_struct *consys) ; 00583 extern bool consys_geomscale(consys_struct *consys, 00584 double **rowscale, double **colscale), 00585 consys_equiscale(consys_struct *consys, 00586 double **rowscale, double **colscale), 00587 consys_applyscale(consys_struct *consys, 00588 double *rowscale, double *colscale) ; 00589 00590 /* 00591 consys_io.c 00592 */ 00593 00594 extern const char *consys_prtvartyp(vartyp_enum vartyp), 00595 *consys_prtcontyp(contyp_enum contyp) ; 00596 extern char *consys_assocnme(consys_struct *consys, flags which), 00597 *consys_conbndnme(char bndlett, int cndx, conbnd_struct *bnd), 00598 *consys_conbndval(conbnd_struct *bnd) ; 00599 00600 # ifndef DYLP_NDEBUG 00601 00602 #include "dylib_io.h" 00603 #include "dylib_std.h" 00604 00605 extern void consys_prtcon(ioid chn, bool echo, 00606 consys_struct *consys, int i, const char *pfx) ; 00607 # endif 00608 00609 /* 00610 consys_nme returns a string containing the name of the specified constraint 00611 or variable. If the client supplies a buffer, that buffer is used to return 00612 the name. If a buffer isn't supplied, a little care is required. 00613 * If consys_nme can find a pointer to the name stored in the constraint 00614 matrix (i.e., in the row or column header) it will return the stored 00615 pointer. Successive calls will not interfere with one another. 00616 * If consys_nme has to build the name, it will use an internal buffer. 00617 Successive calls will reuse this buffer as required (overwriting the 00618 previous name). 00619 00620 Names have to be built in two cases: 00621 * A fully prefixed name is requested (a prefix of 'consys->nme.' is 00622 added to the variable or constraint name). 00623 * The name of a logical variable is requested and logicals aren't enabled 00624 in the constraint system. 00625 00626 A buffer of size CONSYS_MAXBUFLEN is guaranteed to be adequate. 00627 */ 00628 00629 #define CONSYS_MAXBUFLEN 32 00630 extern const char *consys_nme(consys_struct *consys, 00631 char cv, int ndx, bool pfx, char *clientbuf) ; 00632 00633 00634 #endif /* _CONSYS_H */