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