QSopt_ex.h

Go to the documentation of this file.
00001 /* ========================================================================== */
00002 #ifndef __QSopt_ex__
00003 #define __QSopt_ex__
00004 /* config.h.  Generated from config.h.in by configure.  */
00005 /* config.h.in.  Generated from configure.ac by autoheader.  */
00006 /* Compilation-time debug level */
00007 #ifndef DEBUG
00008 #define DEBUG 1
00009 #endif
00010 
00011 /* Define to one if yiu want long double support (if present in the system) */
00012 #ifndef ENABLE_LONG_DOUBLE
00013 #define ENABLE_LONG_DOUBLE 1
00014 #endif
00015 
00016 /* Define to 1 if you have the <assert.h> header file. */
00017 #ifndef HAVE_ASSERT_H
00018 #define HAVE_ASSERT_H 1
00019 #endif
00020 
00021 /* Define to 1 if you have the <bzlib.h> header file. */
00022 #ifndef HAVE_BZLIB_H
00023 #define HAVE_BZLIB_H 1
00024 #endif
00025 
00026 /* Define to 1 if you have the `clock' function. */
00027 #ifndef HAVE_CLOCK
00028 #define HAVE_CLOCK 1
00029 #endif
00030 
00031 
00032 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
00033 #ifndef HAVE_DOPRNT
00034 /* #undef HAVE_DOPRNT */
00035 #endif
00036 
00037 /* Define to 1 if you have the <EGlib.h> header file. */
00038 #ifndef HAVE_EGLIB_H
00039 #define HAVE_EGLIB_H 1
00040 #endif
00041 
00042 /* Define to 1 if you have the <errno.h> header file. */
00043 #ifndef HAVE_ERRNO_H
00044 #define HAVE_ERRNO_H 1
00045 #endif
00046 
00047 /* Define to 1 if you have the <fcntl.h> header file. */
00048 #ifndef HAVE_FCNTL_H
00049 #define HAVE_FCNTL_H 1
00050 #endif
00051 
00052 /* Define to 1 if you have the <float.h> header file. */
00053 #ifndef HAVE_FLOAT_H
00054 #define HAVE_FLOAT_H 1
00055 #endif
00056 
00057 /* Define to 1 if you have the `floor' function. */
00058 #ifndef HAVE_FLOOR
00059 #define HAVE_FLOOR 1
00060 #endif
00061 
00062 /* Define to 1 if you have the `getrusage' function. */
00063 #ifndef HAVE_GETRUSAGE
00064 #define HAVE_GETRUSAGE 1
00065 #endif
00066 
00067 /* Define to 1 if you have the <gmp.h> header file. */
00068 #ifndef HAVE_GMP_H
00069 #define HAVE_GMP_H 1
00070 #endif
00071 
00072 /* Define to 1 if you have the <inttypes.h> header file. */
00073 #ifndef HAVE_INTTYPES_H
00074 #define HAVE_INTTYPES_H 1
00075 #endif
00076 /* Define if you have libgmp */
00077 #ifndef HAVE_LIBGMP
00078 #define HAVE_LIBGMP 1
00079 #endif
00080 
00081 /* Define to 1 if you have the `m' library (-lm). */
00082 #ifndef HAVE_LIBM
00083 #define HAVE_LIBM 1
00084 #endif
00085 
00086 /* Define to 1 if you have the `nsl' library (-lnsl). */
00087 #ifndef HAVE_LIBNSL
00088 /* #undef HAVE_LIBNSL */
00089 #endif
00090 
00091 /* Define to 1 if you have the `pthread' library (-lpthread). */
00092 #ifndef HAVE_LIBPTHREAD
00093 #define HAVE_LIBPTHREAD 1
00094 #endif
00095 
00096 /* Define to 1 if you have the `resolv' library (-lresolv). */
00097 #ifndef HAVE_LIBRESOLV
00098 #define HAVE_LIBRESOLV 1
00099 #endif
00100 
00101 /* Define to 1 if you have the `z' library (-lz). */
00102 #ifndef HAVE_LIBZ
00103 #define HAVE_LIBZ 1
00104 #endif
00105 
00106 /* Define to 1 if you have the <limits.h> header file. */
00107 #ifndef HAVE_LIMITS_H
00108 #define HAVE_LIMITS_H 1
00109 #endif
00110 
00111 /* Define to 1 if the system has the type `long double'. */
00112 #ifndef HAVE_LONG_DOUBLE
00113 #define HAVE_LONG_DOUBLE 1
00114 #endif
00115 
00116 /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
00117    to 0 otherwise. */
00118 #ifndef HAVE_MALLOC
00119 #define HAVE_MALLOC 1
00120 #endif
00121 
00122 /* Define to 1 if you have the <malloc.h> header file. */
00123 #ifndef HAVE_MALLOC_H
00124 #define HAVE_MALLOC_H 1
00125 #endif
00126 
00127 /* Define to 1 if you have the <math.h> header file. */
00128 #ifndef HAVE_MATH_H
00129 #define HAVE_MATH_H 1
00130 #endif
00131 
00132 /* Define to 1 if you have the <memory.h> header file. */
00133 #ifndef HAVE_MEMORY_H
00134 #define HAVE_MEMORY_H 1
00135 #endif
00136 
00137 /* Define to 1 if you have the `memset' function. */
00138 #ifndef HAVE_MEMSET
00139 #define HAVE_MEMSET 1
00140 #endif
00141 
00142 /* Define to 1 if you have the <netdb.h> header file. */
00143 #ifndef HAVE_NETDB_H
00144 #define HAVE_NETDB_H 1
00145 #endif
00146 
00147 /* Define to 1 if you have the <netinet/in.h> header file. */
00148 #ifndef HAVE_NETINET_IN_H
00149 #define HAVE_NETINET_IN_H 1
00150 #endif
00151 
00152 /* Define to 1 if you have the `pow' function. */
00153 #ifndef HAVE_POW
00154 #define HAVE_POW 1
00155 #endif
00156 
00157 /* Define to 1 if your system has a GNU libc compatible `realloc' function,
00158    and to 0 otherwise. */
00159 #ifndef HAVE_REALLOC
00160 #define HAVE_REALLOC 1
00161 #endif
00162 
00163 /* Define to 1 if you have the <setjmp.h> header file. */
00164 #ifndef HAVE_SETJMP_H
00165 #define HAVE_SETJMP_H 1
00166 #endif
00167 
00168 /* Define to 1 if you have the `sigaction' function. */
00169 #ifndef HAVE_SIGACTION
00170 #define HAVE_SIGACTION 1
00171 #endif
00172 
00173 /* Define to 1 if you have the `signal' function. */
00174 #ifndef HAVE_SIGNAL
00175 #define HAVE_SIGNAL 1
00176 #endif
00177 
00178 /* Define to 1 if you have the <signal.h> header file. */
00179 #ifndef HAVE_SIGNAL_H
00180 #define HAVE_SIGNAL_H 1
00181 #endif
00182 
00183 /* Define to 1 if you have the `sleep' function. */
00184 #ifndef HAVE_SLEEP
00185 #define HAVE_SLEEP 1
00186 #endif
00187 
00188 /* Define to one if you want software-based 128-bit floating point numbers */
00189 #ifndef HAVE_SOFTFLOAT
00190 #define HAVE_SOFTFLOAT 1
00191 #endif
00192 
00193 /* Define to 1 if you have the `sqrt' function. */
00194 #ifndef HAVE_SQRT
00195 #define HAVE_SQRT 1
00196 #endif
00197 
00198 /* Define to 1 if you have the <stdarg.h> header file. */
00199 #ifndef HAVE_STDARG_H
00200 #define HAVE_STDARG_H 1
00201 #endif
00202 
00203 /* Define to 1 if you have the <stddef.h> header file. */
00204 #ifndef HAVE_STDDEF_H
00205 #define HAVE_STDDEF_H 1
00206 #endif
00207 
00208 /* Define to 1 if you have the <stdint.h> header file. */
00209 #ifndef HAVE_STDINT_H
00210 #define HAVE_STDINT_H 1
00211 #endif
00212 
00213 /* Define to 1 if you have the <stdio.h> header file. */
00214 #ifndef HAVE_STDIO_H
00215 #define HAVE_STDIO_H 1
00216 #endif
00217 
00218 /* Define to 1 if you have the <stdlib.h> header file. */
00219 #ifndef HAVE_STDLIB_H
00220 #define HAVE_STDLIB_H 1
00221 #endif
00222 
00223 /* Define to 1 if you have the `strdup' function. */
00224 #ifndef HAVE_STRDUP
00225 #define HAVE_STRDUP 1
00226 #endif
00227 
00228 /* Define to 1 if you have the `strerror' function. */
00229 #ifndef HAVE_STRERROR
00230 #define HAVE_STRERROR 1
00231 #endif
00232 
00233 /* Define to 1 if you have the <strings.h> header file. */
00234 #ifndef HAVE_STRINGS_H
00235 #define HAVE_STRINGS_H 1
00236 #endif
00237 
00238 /* Define to 1 if you have the <string.h> header file. */
00239 #ifndef HAVE_STRING_H
00240 #define HAVE_STRING_H 1
00241 #endif
00242 
00243 /* Define to 1 if you have the <sys/param.h> header file. */
00244 #ifndef HAVE_SYS_PARAM_H
00245 #define HAVE_SYS_PARAM_H 1
00246 #endif
00247 
00248 /* Define to 1 if you have the <sys/resource.h> header file. */
00249 #ifndef HAVE_SYS_RESOURCE_H
00250 #define HAVE_SYS_RESOURCE_H 1
00251 #endif
00252 
00253 /* Define to 1 if you have the <sys/socket.h> header file. */
00254 #ifndef HAVE_SYS_SOCKET_H
00255 #define HAVE_SYS_SOCKET_H 1
00256 #endif
00257 
00258 /* Define to 1 if you have the <sys/stat.h> header file. */
00259 #ifndef HAVE_SYS_STAT_H
00260 #define HAVE_SYS_STAT_H 1
00261 #endif
00262 
00263 /* Define to 1 if you have the <sys/times.h> header file. */
00264 #ifndef HAVE_SYS_TIMES_H
00265 #define HAVE_SYS_TIMES_H 1
00266 #endif
00267 
00268 /* Define to 1 if you have the <sys/time.h> header file. */
00269 #ifndef HAVE_SYS_TIME_H
00270 #define HAVE_SYS_TIME_H 1
00271 #endif
00272 
00273 /* Define to 1 if you have the <sys/types.h> header file. */
00274 #ifndef HAVE_SYS_TYPES_H
00275 #define HAVE_SYS_TYPES_H 1
00276 #endif
00277 
00278 /* Define to 1 if you have the <sys/utsname.h> header file. */
00279 #ifndef HAVE_SYS_UTSNAME_H
00280 #define HAVE_SYS_UTSNAME_H 1
00281 #endif
00282 
00283 /* Define to 1 if you have the `times' function. */
00284 #ifndef HAVE_TIMES
00285 #define HAVE_TIMES 1
00286 #endif
00287 
00288 /* Define to 1 if you have the <time.h> header file. */
00289 #ifndef HAVE_TIME_H
00290 #define HAVE_TIME_H 1
00291 #endif
00292 
00293 /* Define to 1 if typeof works with your compiler. */
00294 #ifndef HAVE_TYPEOF
00295 #define HAVE_TYPEOF 1
00296 #endif
00297 
00298 /* Define to 1 if you have the <unistd.h> header file. */
00299 #ifndef HAVE_UNISTD_H
00300 #define HAVE_UNISTD_H 1
00301 #endif
00302 
00303 /* Define to 1 if you have the `vprintf' function. */
00304 #ifndef HAVE_VPRINTF
00305 #define HAVE_VPRINTF 1
00306 #endif
00307 
00308 /* Define to 1 if you have the <zlib.h> header file. */
00309 #ifndef HAVE_ZLIB_H
00310 #define HAVE_ZLIB_H 1
00311 #endif
00312 
00313 /* Define to the address where bug reports for this package should be sent. */
00314 #ifndef PACKAGE_BUGREPORT
00315 #define PACKAGE_BUGREPORT "daespino@gmail.com"
00316 #endif
00317 
00318 /* Define to the full name of this package. */
00319 #ifndef PACKAGE_NAME
00320 #define PACKAGE_NAME "QSopt_ex"
00321 #endif
00322 
00323 /* Define to the full name and version of this package. */
00324 #ifndef PACKAGE_STRING
00325 #define PACKAGE_STRING "QSopt_ex 2.5.10"
00326 #endif
00327 
00328 /* Define to the one symbol short name of this package. */
00329 #ifndef PACKAGE_TARNAME
00330 #define PACKAGE_TARNAME "-qsopt_ex-"
00331 #endif
00332 
00333 /* Define to the version of this package. */
00334 #ifndef PACKAGE_VERSION
00335 #define PACKAGE_VERSION "2.5.10"
00336 #endif
00337 
00338 /* Define as the return type of signal handlers (`int' or `void'). */
00339 #ifndef RETSIGTYPE
00340 #define RETSIGTYPE void
00341 #endif
00342 
00343 /* Define to 1 if you have the ANSI C header files. */
00344 #ifndef STDC_HEADERS
00345 #define STDC_HEADERS 1
00346 #endif
00347 
00348 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
00349 #ifndef TIME_WITH_SYS_TIME
00350 #define TIME_WITH_SYS_TIME 1
00351 #endif
00352 
00353 /* Compilation-time verbose level */
00354 #ifndef VERBOSE_LEVEL
00355 #define VERBOSE_LEVEL 100
00356 #endif
00357 
00358 /* Define to 1 if on AIX 3.
00359    System headers sometimes define this.
00360    We just want to avoid a redefinition error message.  */
00361 #ifndef _ALL_SOURCE
00362 # define _ALL_SOURCE 1
00363 #endif
00364 
00365 /* Enable GNU extensions on systems that have them.  */
00366 #ifndef _GNU_SOURCE
00367 # define _GNU_SOURCE 1
00368 #endif
00369 
00370 /* Define to 1 if on MINIX. */
00371 #ifndef _MINIX
00372 /* #undef _MINIX */
00373 #endif
00374 
00375 /* Define to 2 if the system does not provide POSIX.1 features except with
00376    this defined. */
00377 #ifndef _POSIX_1_SOURCE
00378 /* #undef _POSIX_1_SOURCE */
00379 #endif
00380 
00381 /* Define to 1 if you need to in order for `stat' and other things to work. */
00382 #ifndef _POSIX_SOURCE
00383 /* #undef _POSIX_SOURCE */
00384 #endif
00385 
00386 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
00387    <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
00388    #define below would cause a syntax error. */
00389 #ifndef _UINT32_T
00390 /* #undef _UINT32_T */
00391 #endif
00392 
00393 /* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
00394    <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
00395    #define below would cause a syntax error. */
00396 #ifndef _UINT64_T
00397 /* #undef _UINT64_T */
00398 #endif
00399 
00400 /* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
00401    <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
00402    #define below would cause a syntax error. */
00403 #ifndef _UINT8_T
00404 /* #undef _UINT8_T */
00405 #endif
00406 
00407 /* Required for correct definition of functions like exp2 */
00408 #ifndef _XOPEN_SOURCE
00409 #define _XOPEN_SOURCE 600
00410 #endif
00411 
00412 /* Enable extensions on Solaris.  */
00413 #ifndef __EXTENSIONS__
00414 # define __EXTENSIONS__ 1
00415 #endif
00416 #ifndef _POSIX_PTHREAD_SEMANTICS
00417 # define _POSIX_PTHREAD_SEMANTICS 1
00418 #endif
00419 #ifndef _TANDEM_SOURCE
00420 # define _TANDEM_SOURCE 1
00421 #endif
00422 
00423 /* Define to empty if `const' does not conform to ANSI C. */
00424 #ifndef const
00425 /* #undef const */
00426 #endif
00427 
00428 /* Define to `__inline__' or `__inline' if that's what the C compiler
00429    calls it, or to nothing if 'inline' is not supported under any name.  */
00430 #ifndef __cplusplus
00431 #ifndef inline
00432 /* #undef inline */
00433 #endif
00434 #endif
00435 
00436 /* Define to the type of a signed integer type of width exactly 16 bits if
00437    such a type exists and the standard includes do not define it. */
00438 #ifndef int16_t
00439 /* #undef int16_t */
00440 #endif
00441 
00442 /* Define to the type of a signed integer type of width exactly 32 bits if
00443    such a type exists and the standard includes do not define it. */
00444 #ifndef int32_t
00445 /* #undef int32_t */
00446 #endif
00447 
00448 /* Define to the type of a signed integer type of width exactly 64 bits if
00449    such a type exists and the standard includes do not define it. */
00450 #ifndef int64_t
00451 /* #undef int64_t */
00452 #endif
00453 
00454 /* Define to the type of a signed integer type of width exactly 8 bits if such
00455    a type exists and the standard includes do not define it. */
00456 #ifndef int8_t
00457 /* #undef int8_t */
00458 #endif
00459 
00460 /* Define to rpl_malloc if the replacement function should be used. */
00461 #ifndef malloc
00462 /* #undef malloc */
00463 #endif
00464 
00465 /* Define to `int' if <sys/types.h> does not define. */
00466 #ifndef pid_t
00467 /* #undef pid_t */
00468 #endif
00469 
00470 /* Define to rpl_realloc if the replacement function should be used. */
00471 #ifndef realloc
00472 /* #undef realloc */
00473 #endif
00474 
00475 /* Define to equivalent of C99 restrict keyword, or to nothing if this is not
00476    supported. Do not define if restrict is supported directly. */
00477 #ifndef restrict
00478 #define restrict __restrict
00479 #endif
00480 
00481 /* Define to `unsigned int' if <sys/types.h> does not define. */
00482 #ifndef size_t
00483 /* #undef size_t */
00484 #endif
00485 
00486 /* Define to `int' if <sys/types.h> does not define. */
00487 #ifndef ssize_t
00488 /* #undef ssize_t */
00489 #endif
00490 
00491 /* Define to __typeof__ if your compiler spells it that way. */
00492 #ifndef typeof
00493 /* #undef typeof */
00494 #endif
00495 
00496 /* Define to the type of an unsigned integer type of width exactly 16 bits if
00497    such a type exists and the standard includes do not define it. */
00498 #ifndef uint16_t
00499 /* #undef uint16_t */
00500 #endif
00501 
00502 /* Define to the type of an unsigned integer type of width exactly 32 bits if
00503    such a type exists and the standard includes do not define it. */
00504 #ifndef uint32_t
00505 /* #undef uint32_t */
00506 #endif
00507 
00508 /* Define to the type of an unsigned integer type of width exactly 64 bits if
00509    such a type exists and the standard includes do not define it. */
00510 #ifndef uint64_t
00511 /* #undef uint64_t */
00512 #endif
00513 
00514 /* Define to the type of an unsigned integer type of width exactly 8 bits if
00515    such a type exists and the standard includes do not define it. */
00516 #ifndef uint8_t
00517 /* #undef uint8_t */
00518 #endif
00519 
00520 /* Define to empty if the keyword `volatile' does not work. Warning: valid
00521    code using `volatile' can become incorrect without. Disable with care. */
00522 #ifndef volatile
00523 /* #undef volatile */
00524 #endif
00525 /****************************************************************************/
00526 /*                                                                          */
00527 /*  This file is part of QSopt_ex.                                          */
00528 /*                                                                          */
00529 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00530 /*  and Daniel Espinoza                                                     */
00531 /*                                                                          */
00532 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00533 /*  copyright in QSopt.                                                     */
00534 /*                                                                          */
00535 /*  This code may be used under the terms of the GNU General Public License */
00536 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00537 /*                                                                          */
00538 /*  Alternatively, use is granted for research purposes only.               */
00539 /*                                                                          */
00540 /*  It is your choice of which of these two licenses you are operating      */
00541 /*  under.                                                                  */
00542 /*                                                                          */
00543 /*  We make no guarantees about the correctness or usefulness of this code. */
00544 /*                                                                          */
00545 /****************************************************************************/
00546 #ifndef __BASICDEFS__
00547 #define __BASICDEFS__
00548 
00549 /* storage type */
00550 #define DENSE          0
00551 #define SPARSE         1
00552 
00553 /* type of vector */
00554 #define ROW_SOLVE      1
00555 #define COLUMN_SOLVE   2
00556 
00557 /* direction of change in non-basic var */
00558 #define VINCREASE      1
00559 #define VDECREASE      2
00560 
00561 /* status of variables */
00562 #define STAT_BASIC     1
00563 #define STAT_UPPER     2
00564 #define STAT_LOWER     3
00565 #define STAT_ZERO      4
00566 
00567 #define BOUND_LOWER    1
00568 #define BOUND_UPPER    2
00569 
00570 /* type of variables */
00571 #define VARTIFICIAL    1
00572 #define VFIXED         2
00573 #define VFREE          4
00574 #define VUPPER         8
00575 #define VLOWER         16
00576 #define VBOUNDED       32
00577 
00578 /* class of variables */
00579 #define CLASS_STRUCT   0
00580 #define CLASS_LOGICAL  1
00581 
00582 /* algo */
00583 #define PRIMAL_SIMPLEX 1
00584 #define DUAL_SIMPLEX   2
00585 #define PRIMAL_OR_DUAL 3
00586 
00587 /* phase */
00588 #define PRIMAL_PHASEI  1
00589 #define PRIMAL_PHASEII 2
00590 #define DUAL_PHASEI    3
00591 #define DUAL_PHASEII   4
00592 
00593 /* number of phases */
00594 #define PHASEI         1
00595 #define PHASEII        2
00596 
00597 /* type of pricing (all vars or some) */
00598 #define COMPLETE_PRICING   1
00599 #define PARTIAL_PRICING    2
00600 #define MULTI_PART_PRICING 3
00601 
00602 /* default pricing */
00603 
00604 #define QS_DEFAULT_PRICE_PI  QS_PRICE_PSTEEP
00605 #define QS_DEFAULT_PRICE_PII QS_PRICE_PSTEEP
00606 #define QS_DEFAULT_PRICE_DI  QS_PRICE_DSTEEP
00607 #define QS_DEFAULT_PRICE_DII QS_PRICE_DSTEEP
00608 
00609 /* lp sol status */
00610 #define ILL_LP_SOLVED            1
00611 #define ILL_LP_UNSOLVED          2
00612 #define ILL_MAX_ITER             3
00613 #define ILL_MAX_TIME             4
00614 #define ILL_BND_REACHED          5
00615 #define ILL_PPHASEI_ERROR        6
00616 #define ILL_PPHASEII_ERROR       7
00617 #define ILL_DPHASEI_ERROR        8
00618 #define ILL_DPHASEII_ERROR       9
00619 #define ILL_LP_ABORTED          10
00620 
00621 /* basis status */
00622 #define OPTIMAL                  1
00623 #define NONOPTIMAL               2
00624 #define PRIMAL_FEASIBLE          3
00625 #define PRIMAL_INFEASIBLE        4
00626 #define PRIMAL_UNBOUNDED         5
00627 #define DUAL_FEASIBLE            7
00628 #define DUAL_INFEASIBLE          8
00629 #define DUAL_UNBOUNDED           9
00630 
00631 /* type of ratio test */
00632 #define RATIOTEST_NORMAL 1
00633 #define RATIOTEST_HARRIS 2
00634 
00635 /* control parameters */
00636 #define PARAM_PRATIOTESTS        10
00637 #define PARAM_DRATIOTESTS        20
00638 #define PARAM_PRIMAL_REFACTORGAP 50
00639 #define PARAM_PRIMAL_RESOLVEGAP  25
00640 #define PARAM_DUAL_REFACTORGAP   100
00641 #define PARAM_DUAL_RESOLVEGAP    25
00642 #define PARAM_MAX_NOSOLVE        500
00643 #define PARAM_MAX_NOPROG         300
00644 #define PARAM_NOPROG_FACTOR      15
00645 
00646 /* numerical parameters */
00647 #define PARAM_BSHIFT             10
00648 #define PARAM_CSHIFT             10
00649 
00650 /* general constants */
00651 #define PARAM_HEAP_UTRIGGER      10
00652 #define PARAM_HEAP_RATIO         4.0
00653 
00654 /* errors */
00655 #define E_GENERAL_ERROR          1
00656 #define E_INV_LINSOLVE_OPTION    2
00657 #define E_NO_MEMORY              3
00658 #define E_INVALID_OPTION         4
00659 #define E_NULL_ARGUMENT          5
00660 #define E_SIMPLEX_ERROR          6
00661 #define E_BASIS_SINGULAR         7
00662 
00663 #ifndef __QS_BASIS__
00664 #define __QS_BASIS__
00665 typedef struct qsbasis
00666 {
00667   int nstruct;
00668   int nrows;
00669   char *cstat;
00670   char *rstat;
00671 }
00672 QSbasis;
00673 #endif
00674 
00675 typedef struct itcnt_t
00676 {
00677   int pI_iter;
00678   int pII_iter;
00679   int dI_iter;
00680   int dII_iter;
00681   int tot_iter;
00682 } itcnt_t;
00683 
00684 #ifndef QS_DEFINITIONS
00685 #define QS_DEFINITIONS
00686 #define QS_MIN       (1)
00687 #define QS_MAX       (-1)
00688 
00689 /****************************************************************************/
00690 /*                                                                          */
00691 /*                 PARAMETERS THAT CAN BE SET BY setparam                   */
00692 /*                                                                          */
00693 /****************************************************************************/
00694 
00695 
00696 #define QS_PARAM_PRIMAL_PRICING    0
00697 #define QS_PARAM_DUAL_PRICING      2
00698 #define QS_PARAM_SIMPLEX_DISPLAY   4
00699 #define QS_PARAM_SIMPLEX_MAX_ITERATIONS 5
00700 #define QS_PARAM_SIMPLEX_MAX_TIME  6
00701 #define QS_PARAM_SIMPLEX_SCALING   7
00702 #define QS_PARAM_OBJULIM           8
00703 #define QS_PARAM_OBJLLIM           9
00704 
00705 
00706 /****************************************************************************/
00707 /*                                                                          */
00708 /*                     VALUES FOR PRICING PARAMETERS                        */
00709 /*                                                                          */
00710 /****************************************************************************/
00711 
00712 #define QS_PRICE_PDANTZIG 1
00713 #define QS_PRICE_PDEVEX 2
00714 #define QS_PRICE_PSTEEP 3
00715 #define QS_PRICE_PMULTPARTIAL 4
00716 
00717 #define QS_PRICE_DDANTZIG 6
00718 #define QS_PRICE_DSTEEP 7
00719 #define QS_PRICE_DMULTPARTIAL 8
00720 #define QS_PRICE_DDEVEX 9
00721 
00722 
00723 /****************************************************************************/
00724 /*                                                                          */
00725 /*                         VALUES FOR BASIS STATUS                          */
00726 /*                                                                          */
00727 /****************************************************************************/
00728 
00729 
00730 #define QS_COL_BSTAT_LOWER     '0'
00731 #define QS_COL_BSTAT_BASIC     '1'
00732 #define QS_COL_BSTAT_UPPER     '2'
00733 #define QS_COL_BSTAT_FREE      '3'
00734 
00735 #define QS_ROW_BSTAT_LOWER     '0'
00736 #define QS_ROW_BSTAT_BASIC     '1'
00737 #define QS_ROW_BSTAT_UPPER     '2'
00738 
00739 
00740 /****************************************************************************/
00741 /*                                                                          */
00742 /*         Return Status for dbl_QSopt_primal, dbl_QSopt_dual, dbl_QSget_status         */
00743 /*                                                                          */
00744 /****************************************************************************/
00745 
00746 #define QS_LP_OPTIMAL           1
00747 #define QS_LP_INFEASIBLE        2
00748 #define QS_LP_UNBOUNDED         3
00749 #define QS_LP_ITER_LIMIT        4
00750 #define QS_LP_TIME_LIMIT        5
00751 #define QS_LP_UNSOLVED          6
00752 #define QS_LP_ABORTED   7
00753 #define QS_LP_NUMERR            8
00754 #define QS_LP_OBJ_LIMIT         9
00755 #define QS_LP_MODIFIED        100
00756 #define QS_LP_CHANGE_PREC     1024
00757 #endif
00758 
00759 
00760 
00761 /** @brief If set to one, them we allow to re-start the simplex algorithm due to
00762  * numerical issues */
00763 #define DO_NUMER 0
00764 /** @brief If set to one, then we allow to re-start simplex due to singular
00765  * basis */
00766 #define DO_SINGULAR 0
00767 
00768 /** @brief Factor for wich we change tolerances each time we have to resume
00769  * simplex */
00770 #define SIMPLEX_FACTOR 5U
00771 #define DENSE_PI 0
00772 #define DENSE_PIIPI 0
00773 #define DENSE_NORM 0
00774 #define SIMPLEX_DEBUG 0
00775 
00776 
00777 /* possible values of nextstep */
00778 #define SIMPLEX_CONTINUE   1
00779 #define SIMPLEX_TERMINATE  2
00780 #define SIMPLEX_RESUME     3
00781 
00782 /* reason for resuming simplex */
00783 #define SIMPLEX_RESUME_SING     1
00784 #define SIMPLEX_RESUME_UNSHIFT  2
00785 #define SIMPLEX_RESUME_NUMER    3
00786 
00787 /* values for newphase */
00788 #define SIMPLEX_PHASE_RECOMP  1
00789 #define SIMPLEX_PHASE_NEW     2
00790 
00791 #define SIMPLEX_PIVOTINROW 1
00792 #define SIMPLEX_PIVOTINCOL 2
00793 #define SIMPLEX_MAX_RESTART 4
00794 #define SIMPLEX_MAX_PIVOT_FAIL 300
00795 
00796 
00797 #define FALSE 0
00798 #define TRUE  1
00799 #define QS_FACTOR_MAX_K        1
00800 #define QS_FACTOR_P            2
00801 #define QS_FACTOR_ETAMAX       3
00802 #define QS_FACTOR_FZERO_TOL    4
00803 #define QS_FACTOR_SZERO_TOL    5
00804 #define QS_FACTOR_PARTIAL_TOL  6
00805 #define QS_FACTOR_UR_SPACE_MUL 7
00806 #define QS_FACTOR_UC_SPACE_MUL 8
00807 #define QS_FACTOR_LC_SPACE_MUL 9
00808 #define QS_FACTOR_LR_SPACE_MUL 10
00809 #define QS_FACTOR_ER_SPACE_MUL 11
00810 #define QS_FACTOR_GROW_MUL     12
00811 #define QS_FACTOR_MAXMULT      13
00812 #define QS_FACTOR_MINMULT      14
00813 #define QS_FACTOR_UPDMAXMULT   15
00814 #define QS_FACTOR_DENSE_FRACT  16
00815 #define QS_FACTOR_DENSE_MIN    17
00816 #define E_CHECK_FAILED 6
00817 #define E_NO_PIVOT 7
00818 #define E_FACTOR_BLOWUP 8
00819 #define E_UPDATE_NOSPACE 9
00820 #define E_UPDATE_SINGULAR_ROW 10
00821 #define E_UPDATE_SINGULAR_COL 11
00822 #define E_SING_NO_DATA 12
00823 #define E_SINGULAR_INTERNAL 13
00824 #define SPARSE_FACTOR 0.05
00825 #define CNT_YNZ           1     /* nz in entering columns */
00826 #define CNT_ZNZ           2     /* nz in ith row of B^{-1}, ie z_i */
00827 #define CNT_ZANZ          3     /* nz in ith row of B^{-1}, ie z_i */
00828 #define CNT_PINZ          4     /* nz in phase II pi (solve) */
00829 #define CNT_P1PINZ        5     /* nz in phase I pi (solve) */
00830 #define CNT_UPNZ          6     /* nz in ftran_updates */
00831 #define CNT_PPHASE1ITER   7     /* primal phase I iterations */
00832 #define CNT_PPHASE2ITER   8
00833 #define CNT_DPHASE1ITER   9     /* dual phase I iterations */
00834 #define CNT_DPHASE2ITER   10
00835 #define CNT_PIPIV         11
00836 #define CNT_PIIPIV        12
00837 #define CNT_DIPIV         13
00838 #define CNT_DIIPIV        14
00839 #define CNT_YRAVG         15
00840 #define CNT_ZARAVG        16
00841 
00842 #define ROW_PIVOT         0
00843 #define COL_PIVOT         1
00844 
00845 #define ILL_LP_OPTIMAL           1
00846 #define ILL_LP_NONOPTIMAL        2
00847 #define ILL_LP_PRIMAL_FEASIBLE   3
00848 #define ILL_LP_PRIMAL_INFEASIBLE 4
00849 #define ILL_LP_PRIMAL_UNBOUNDED  5
00850 #define ILL_LP_DUAL_FEASIBLE     6
00851 #define ILL_LP_DUAL_INFEASIBLE   7
00852 #define ILL_LP_DUAL_UNBOUNDED    8
00853 
00854 typedef enum
00855 { ILL_MPS_NAME, ILL_MPS_OBJSENSE, ILL_MPS_OBJNAME,
00856   ILL_MPS_ROWS, ILL_MPS_COLS, ILL_MPS_RHS, ILL_MPS_RANGES,
00857   ILL_MPS_BOUNDS, ILL_MPS_REFROW, ILL_MPS_ENDATA,
00858   ILL_MPS_NONE
00859 }
00860 ILLmps_section;
00861 
00862 #define ILL_MPS_N_SECTIONS ILL_MPS_NONE
00863 
00864 /*define as > 0 if heap is to be used */
00865 #define USEHEAP 1
00866 
00867 /*result of pricing */
00868 #define PRICE_OPTIMAL 1
00869 #define PRICE_NONOPTIMAL  2
00870 
00871 /*type of pricing */
00872 #define ROW_PRICING 1
00873 #define COL_PRICING 2
00874 
00875 
00876 /****************************************************************************
00877  * error collection
00878  */
00879 #define QS_DATA_ERROR     0
00880 #define QS_DATA_WARN      1
00881 #define QS_MPS_FORMAT_ERROR   2
00882 #define QS_MPS_FORMAT_WARN    3
00883 #define QS_LP_FORMAT_ERROR    4
00884 #define QS_LP_FORMAT_WARN   5
00885 #define QS_INPUT_NERROR        8
00886 
00887 /* defs for phase I ratio test */
00888 #define BBOUND    1
00889 #define BATOLOWER 2
00890 #define BATOUPPER 3
00891 #define BBTOLOWER 4
00892 #define BBTOUPPER 5
00893 #define BSKIP     6
00894 
00895 /* result of ratio test */
00896 #define RATIO_UNBOUNDED 1
00897 #define RATIO_NOBCHANGE 2
00898 #define RATIO_BCHANGE   3
00899 #define RATIO_FAILED    4
00900 #define RATIO_NEGATIVE  5
00901 
00902 /* warning level */
00903 #define QSE_WLVL 10000
00904 
00905 
00906 
00907 
00908 
00909 
00910 #endif
00911 /****************************************************************************/
00912 /*                                                                          */
00913 /*  This file is part of QSopt_ex.                                          */
00914 /*                                                                          */
00915 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00916 /*  and Daniel Espinoza                                                     */
00917 /*                                                                          */
00918 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00919 /*  copyright in QSopt.                                                     */
00920 /*                                                                          */
00921 /*  This code may be used under the terms of the GNU General Public License */
00922 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00923 /*                                                                          */
00924 /*  Alternatively, use is granted for research purposes only.               */
00925 /*                                                                          */
00926 /*  It is your choice of which of these two licenses you are operating      */
00927 /*  under.                                                                  */
00928 /*                                                                          */
00929 /*  We make no guarantees about the correctness or usefulness of this code. */
00930 /*                                                                          */
00931 /****************************************************************************/
00932 
00933 #ifndef __URANDOM_H__
00934 #define __URANDOM_H__
00935 /****************************************************************************/
00936 /*                                                                          */
00937 /*                             urandom.c                                    */
00938 /*                                                                          */
00939 /****************************************************************************/
00940 
00941 /* since urandom's generator does everything modulo ILL_PRANDMAX, if two
00942  * seeds are congruent mod x and x|ILL_PRANDMAX, then the resulting numbers
00943  * will be congruent mod x.  One example was if ILL_PRANDMAX = 1000000000 and
00944  * urandom is used to generate a point set from a 1000x1000 grid, seeds
00945  * congruent mod 1000 generate the same point set.
00946  *
00947  * For this reason, we use 1000000007 (a prime)
00948  */
00949 #define ILL_PRANDMAX 1000000007
00950 
00951 typedef struct ILLrandstate
00952 {
00953   int a;
00954   int b;
00955   int arr[55];
00956 }
00957 ILLrandstate;
00958 
00959 
00960 void ILLutil_sprand (
00961   int seed,
00962   ILLrandstate * r);
00963 
00964 int ILLutil_lprand (
00965   ILLrandstate * r);
00966 
00967 
00968 
00969 #endif
00970 /****************************************************************************/
00971 /*                                                                          */
00972 /*  This file is part of QSopt_ex.                                          */
00973 /*                                                                          */
00974 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00975 /*  and Daniel Espinoza                                                     */
00976 /*                                                                          */
00977 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00978 /*  copyright in QSopt.                                                     */
00979 /*                                                                          */
00980 /*  This code may be used under the terms of the GNU General Public License */
00981 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00982 /*                                                                          */
00983 /*  Alternatively, use is granted for research purposes only.               */
00984 /*                                                                          */
00985 /*  It is your choice of which of these two licenses you are operating      */
00986 /*  under.                                                                  */
00987 /*                                                                          */
00988 /*  We make no guarantees about the correctness or usefulness of this code. */
00989 /*                                                                          */
00990 /****************************************************************************/
00991 
00992 /* RCSINFO $Id: symtab.h,v 1.2 2003/11/05 16:47:22 meven Exp $ */
00993 #ifndef ILL_SYMTAB_H
00994 #define ILL_SYMTAB_H
00995 
00996 /* we allow 256KB of buffer space i.e. 2^17*/
00997 #define ILL_namebufsize 0x20000U
00998 
00999 typedef struct ILLsymbolent
01000 {
01001   int symbol;
01002   int index;
01003   int next;
01004 }
01005 ILLsymbolent;
01006 
01007 typedef struct ILLsymboltab
01008 {
01009   int *hashtable;
01010   ILLsymbolent *nametable;
01011   char *namelist;
01012   int tablesize;
01013   int strsize;
01014   int hashspace;
01015   int name_space;
01016   int strspace;
01017   int freedchars;
01018   int the_hash;
01019   int the_index;
01020   int the_prev_index;
01021   int index_ok;
01022 }
01023 ILLsymboltab;
01024 
01025 /* 
01026  * hashtable[stringhash(entry) % hashspace] either NO_INDEX or some hash number
01027  * nametable[hash number] = { next:    another index for nametable 
01028  *                            symbol:  index into namelist where string resides
01029  *                          }
01030  * tablesize:  number of entries   (tablesize <= name_space)
01031  * name_space:  length of nametable and indexlist
01032  * hashspace:  length of hashtable   nextprime(name_space)
01033  * strsize:    number of chars used in namelist 
01034  * strspace:   length of namelist
01035  * indexlist:  LP col/row indices for the table entries
01036  * indexlist_ok:  1 if column indices in indexlist are up-to-date, 0 otherwise
01037  *
01038  * Deletion of entries affects their ordering in symboltab->nametable. 
01039  * Strings may move around within symboltab->namelist. 
01040  */
01041 
01042 
01043 #define ILL_SYM_NOINDEX (-1)
01044 extern void ILLsymboltab_init (
01045   ILLsymboltab * h),
01046   ILLsymboltab_free (
01047   ILLsymboltab * h),
01048   ILLsymboltab_size (
01049   const ILLsymboltab * h,
01050   int *p_size),
01051   ILLsymboltab_prt (
01052   FILE * fd,
01053   ILLsymboltab * h);
01054 
01055 extern int ILLsymboltab_create (
01056   ILLsymboltab * h,
01057   int init_size),
01058   ILLsymboltab_copy (
01059   ILLsymboltab * src,
01060   ILLsymboltab * dst),
01061   ILLsymboltab_register (
01062   ILLsymboltab * h,
01063   const char *s,
01064   int itemindex,
01065   int *p_index,
01066   int *p_existed),
01067   ILLsymboltab_lookup (
01068   ILLsymboltab * h,
01069   const char *s,
01070   int *p_index),
01071   ILLsymboltab_index_ok (
01072   ILLsymboltab * h),
01073   ILLsymboltab_index_reset (
01074   ILLsymboltab * h,
01075   int icount,
01076   char **names),
01077   ILLsymboltab_getindex (
01078   ILLsymboltab * h,
01079   const char *name,
01080   int *hindex),
01081   ILLsymboltab_contains (
01082   ILLsymboltab * h,
01083   const char *s),
01084   ILLsymboltab_delete (
01085   ILLsymboltab * h,
01086   const char *s),
01087   ILLsymboltab_uname (
01088   ILLsymboltab * h,
01089   char name[ILL_namebufsize],
01090   const char *try_prefix1,
01091   const char *try_prefix2);
01092 
01093 extern void ILLsymboltab_unique_name (
01094   ILLsymboltab * tab,
01095   int i,
01096   const char *pref,
01097   char uname[ILL_namebufsize]);
01098 
01099 extern const char *ILLsymboltab_get (
01100   const ILLsymboltab * tab,
01101   int i);
01102 extern int ILLsymboltab_rename (
01103   ILLsymboltab * h,
01104   int i,
01105   const char *new_name);
01106 
01107 #endif /* __SYMTAB_H */
01108 /****************************************************************************/
01109 /*                                                                          */
01110 /*  This file is part of QSopt_ex.                                          */
01111 /*                                                                          */
01112 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01113 /*  and Daniel Espinoza                                                     */
01114 /*                                                                          */
01115 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01116 /*  copyright in QSopt.                                                     */
01117 /*                                                                          */
01118 /*  This code may be used under the terms of the GNU General Public License */
01119 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01120 /*                                                                          */
01121 /*  Alternatively, use is granted for research purposes only.               */
01122 /*                                                                          */
01123 /*  It is your choice of which of these two licenses you are operating      */
01124 /*  under.                                                                  */
01125 /*                                                                          */
01126 /*  We make no guarantees about the correctness or usefulness of this code. */
01127 /*                                                                          */
01128 /****************************************************************************/
01129 
01130 /* $RCSfile: reporter.h,v $ $Revision: 1.2 $ $Date: 2003/11/05 16:57:39 $ */
01131 #ifndef REPORTER_FILE
01132 #define REPORTER_FILE
01133 
01134 typedef int (
01135   *qsreport_string_fct) (
01136   void *dest,
01137   const char *s);
01138 
01139 typedef struct qsstring_reporter
01140 {
01141   qsreport_string_fct report_fct;
01142   void *dest;
01143 }
01144 qsstring_reporter;
01145 
01146 extern int ILL_fprintf (
01147   void *dest,
01148   const char *s);
01149 
01150 void ILLstring_reporter_init (
01151   qsstring_reporter * reporter,
01152   qsreport_string_fct fct,
01153   void *dest);
01154 
01155 void ILLstring_reporter_copy (
01156   qsstring_reporter * dest,
01157   qsstring_reporter * src);
01158 
01159 #define ILLstring_report(s, reporter)  \
01160   ((reporter)->report_fct((reporter)->dest, s) < 0)
01161                    /* used from with ILL fct to report progress */
01162 
01163 /* REPORTER_FILE */
01164 #endif
01165 /****************************************************************************/
01166 /*                                                                          */
01167 /*  This file is part of QSopt_ex.                                          */
01168 /*                                                                          */
01169 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01170 /*  and Daniel Espinoza                                                     */
01171 /*                                                                          */
01172 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01173 /*  copyright in QSopt.                                                     */
01174 /*                                                                          */
01175 /*  This code may be used under the terms of the GNU General Public License */
01176 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01177 /*                                                                          */
01178 /*  Alternatively, use is granted for research purposes only.               */
01179 /*                                                                          */
01180 /*  It is your choice of which of these two licenses you are operating      */
01181 /*  under.                                                                  */
01182 /*                                                                          */
01183 /*  We make no guarantees about the correctness or usefulness of this code. */
01184 /*                                                                          */
01185 /****************************************************************************/
01186 
01187 #ifndef __ALLOCRUS_H__
01188 #define __ALLOCRUS_H__
01189 /****************************************************************************/
01190 /*                                                                          */
01191 /*                             allocrus.c                                   */
01192 /*                                                                          */
01193 /****************************************************************************/
01194 
01195 /****************************************************************************/
01196 /*                                                                          */
01197 /*                   MEMORY ALLOCATION MACROS                               */
01198 /*                                                                          */
01199 /*                           TSP CODE                                       */
01200 /*                                                                          */
01201 /*                                                                          */
01202 /*  Written by:  Applegate, Bixby, Chvatal, and Cook                        */
01203 /*  Date: February 24, 1995 (cofeb24)                                       */
01204 /*  see allocrus.c                                                          */
01205 /*                                                                          */
01206 /****************************************************************************/
01207 
01208 extern int ILLTRACE_MALLOC;
01209 
01210 #ifndef USEDMALLOC
01211 #define ILL_UTIL_SAFE_MALLOC(nnum,type,varname)                             \
01212     (((ILLTRACE_MALLOC) ? printf("%s.%d: %s: ILL_UTIL_SAFE_MALLOC: %s = %d * %s\n", __FILE__, __LINE__, __DEV_FUNCTION__, #varname, nnum, #type) : 0), \
01213      (type *) ILLutil_allocrus (((size_t) (nnum)) * sizeof (type)))
01214 #else
01215 #define ILL_UTIL_SAFE_MALLOC(nnum,type,varname)                             \
01216     (((ILLTRACE_MALLOC) ? printf("%s.%d: %s: ILL_UTIL_SAFE_MALLOC: %s = %d * %s\n", __FILE__, __LINE__, __DEV_FUNCTION__, #varname, nnum, #type) : 0), \
01217      (type *) malloc (((size_t) (nnum)) * sizeof (type)))
01218 #endif
01219 
01220 #define ILL_IFFREE(object,type) {                                           \
01221     if ((object)) {                                                        \
01222        ILLutil_freerus ((void *) (object));                                 \
01223        object = (type *) NULL;                                             \
01224     }}
01225 
01226 #define ILL_PTRWORLD_ALLOC_ROUTINE(type, ptr_alloc_r, ptr_bulkalloc_r)        \
01227                                                                              \
01228 static int ptr_bulkalloc_r (ILLptrworld *world, int nalloc)                   \
01229 {                                                                            \
01230     ILLbigchunkptr *bp;                                                       \
01231     int i;                                                                   \
01232     int count = ILL_BIGCHUNK / sizeof ( type );                               \
01233     type *p;                                                                 \
01234                                                                              \
01235     while (nalloc > 0) {                                                     \
01236         bp = ILLutil_bigchunkalloc ();                                        \
01237         if (bp == (ILLbigchunkptr *) NULL) {                                  \
01238             fprintf (stderr, "ptr alloc failed\n");                          \
01239             return 1;                                                        \
01240         }                                                                    \
01241         bp->next = world->chunklist ;                                        \
01242         world->chunklist = bp;                                               \
01243                                                                              \
01244         p = ( type * ) bp->this_one;                                         \
01245         for (i=count-2; i>=0; i--) {                                         \
01246             p[i].next = &p[i+1];                                             \
01247         }                                                                    \
01248         p[count - 1].next = (type *) world->freelist;                        \
01249         world->freelist = (void *) p;                                        \
01250         nalloc -= count;                                                     \
01251     }                                                                        \
01252     return 0;                                                                \
01253 }                                                                            \
01254                                                                              \
01255 static type *ptr_alloc_r (ILLptrworld *world)                                 \
01256 {                                                                            \
01257     type *p;                                                                 \
01258                                                                              \
01259     if (world->freelist == (void *) NULL) {                                  \
01260         if (ptr_bulkalloc_r (world, 1)) {                                    \
01261             fprintf (stderr, "ptr alloc failed\n");                          \
01262             return ( type * ) NULL;                                          \
01263         }                                                                    \
01264     }                                                                        \
01265     p = (type *) world->freelist ;                                           \
01266     world->freelist = (void *) p->next;                                      \
01267                                                                              \
01268     return p;                                                                \
01269 }
01270 
01271 #define ILL_PTRWORLD_FREE_ROUTINE(type, ptr_free_r)                           \
01272                                                                              \
01273 static void ptr_free_r (ILLptrworld *world, type *p)                          \
01274 {                                                                            \
01275     p->next = (type *) world->freelist ;                                     \
01276     world->freelist = (void *) p;                                            \
01277 }
01278 
01279 #define ILL_PTRWORLD_LISTADD_ROUTINE(type, entrytype, ptr_listadd_r, ptr_alloc_r) \
01280                                                                              \
01281 static int ptr_listadd_r (type **list, entrytype x, ILLptrworld *world)       \
01282 {                                                                            \
01283     if (list != (type **) NULL) {                                            \
01284         type *p = ptr_alloc_r (world);                                       \
01285                                                                              \
01286         if (p == (type *) NULL) {                                            \
01287             fprintf (stderr, "ptr list add failed\n");                       \
01288             return 1;                                                        \
01289         }                                                                    \
01290         p->this = x;                                                         \
01291         p->next = *list;                                                     \
01292         *list = p;                                                           \
01293     }                                                                        \
01294     return 0;                                                                \
01295 }
01296 
01297 #define ILL_PTRWORLD_LISTFREE_ROUTINE(type, ptr_listfree_r, ptr_free_r)       \
01298                                                                              \
01299 static void ptr_listfree_r (ILLptrworld *world, type *p)                      \
01300 {                                                                            \
01301     type *next;                                                              \
01302                                                                              \
01303     while (p != (type *) NULL) {                                             \
01304         next = p->next;                                                      \
01305         ptr_free_r (world, p);                                               \
01306         p = next;                                                            \
01307     }                                                                        \
01308 }
01309 
01310 #define ILL_PTRWORLD_LEAKS_ROUTINE(type, ptr_leaks_r, field, fieldtype)       \
01311                                                                              \
01312 static int ptr_leaks_r (ILLptrworld *world, int *total, int *onlist)          \
01313 {                                                                            \
01314     int count = ILL_BIGCHUNK / sizeof ( type );                               \
01315     int duplicates = 0;                                                      \
01316     type * p;                                                                \
01317     ILLbigchunkptr *bp;                                                       \
01318                                                                              \
01319     *total = 0;                                                              \
01320     *onlist = 0;                                                             \
01321                                                                              \
01322     for (bp = world->chunklist ; bp; bp = bp->next)                          \
01323         (*total) += count;                                                   \
01324                                                                              \
01325     for (p = (type *) world->freelist ; p; p = p->next) {                    \
01326         (*onlist)++;                                                         \
01327         p-> field = ( fieldtype ) 0;                                         \
01328     }                                                                        \
01329     for (p = (type *) world->freelist ; p; p = p->next) {                    \
01330         if ((unsigned long) p-> field == (unsigned long) (size_t) 1)                           \
01331             duplicates++;                                                    \
01332         else                                                                 \
01333             p-> field = ( fieldtype ) (size_t) 1;                            \
01334     }                                                                        \
01335     if (duplicates) {                                                        \
01336         fprintf (stderr, "WARNING: %d duplicates on ptr free list \n",       \
01337                  duplicates);                                                \
01338     }                                                                        \
01339     return *total - *onlist;                                                 \
01340 }
01341 
01342 #define ILL_PTRWORLD_ROUTINES(type, ptr_alloc_r, ptr_bulkalloc_r, ptr_free_r) \
01343 ILL_PTRWORLD_ALLOC_ROUTINE (type, ptr_alloc_r, ptr_bulkalloc_r)               \
01344 ILL_PTRWORLD_FREE_ROUTINE (type, ptr_free_r)
01345 
01346 #define ILL_PTRWORLD_LIST_ROUTINES(type, entrytype, ptr_alloc_r, ptr_bulkalloc_r, ptr_free_r, ptr_listadd_r, ptr_listfree_r) \
01347 ILL_PTRWORLD_ROUTINES (type, ptr_alloc_r, ptr_bulkalloc_r, ptr_free_r)        \
01348 ILL_PTRWORLD_LISTADD_ROUTINE (type, entrytype, ptr_listadd_r, ptr_alloc_r)    \
01349 ILL_PTRWORLD_LISTFREE_ROUTINE (type, ptr_listfree_r, ptr_free_r)
01350 
01351 #define ILL_BIGCHUNK ((int) ((1<<16) - sizeof (ILLbigchunkptr) - 16))
01352 
01353 struct ILLbigchunk;
01354 
01355 typedef struct ILLbigchunkptr
01356 {
01357   void *this_one;
01358   struct ILLbigchunk *this_chunk;
01359   struct ILLbigchunkptr *next;
01360 }
01361 ILLbigchunkptr;
01362 
01363 
01364 typedef struct ILLptrworld
01365 {
01366   int refcount;
01367   void *freelist;
01368   ILLbigchunkptr *chunklist;
01369 }
01370 ILLptrworld;
01371 
01372 
01373 
01374 void *ILLutil_allocrus (
01375   size_t size),
01376  *ILLutil_reallocrus (
01377   void *ptr,
01378   size_t size),
01379   ILLutil_freerus (
01380   void *p),
01381   ILLutil_bigchunkfree (
01382   ILLbigchunkptr * bp),
01383   ILLptrworld_init (
01384   ILLptrworld * world),
01385   ILLptrworld_add (
01386   ILLptrworld * world),
01387   ILLptrworld_delete (
01388   ILLptrworld * world);
01389 
01390 int ILLutil_reallocrus_scale (
01391   void **pptr,
01392   int *pnnum,
01393   int count,
01394   double scale,
01395   size_t size),
01396   ILLutil_reallocrus_count (
01397   void **pptr,
01398   int count,
01399   size_t size);
01400 
01401 ILLbigchunkptr *ILLutil_bigchunkalloc (
01402   void);
01403 
01404 
01405 
01406 #endif
01407 /****************************************************************************/
01408 /*                                                                          */
01409 /*  This file is part of QSopt_ex.                                          */
01410 /*                                                                          */
01411 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01412 /*  and Daniel Espinoza                                                     */
01413 /*                                                                          */
01414 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01415 /*  copyright in QSopt.                                                     */
01416 /*                                                                          */
01417 /*  This code may be used under the terms of the GNU General Public License */
01418 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01419 /*                                                                          */
01420 /*  Alternatively, use is granted for research purposes only.               */
01421 /*                                                                          */
01422 /*  It is your choice of which of these two licenses you are operating      */
01423 /*  under.                                                                  */
01424 /*                                                                          */
01425 /*  We make no guarantees about the correctness or usefulness of this code. */
01426 /*                                                                          */
01427 /****************************************************************************/
01428 
01429 #ifndef __BGETOPT_H__
01430 #define __BGETOPT_H__
01431 
01432 /****************************************************************************/
01433 /*                                                                          */
01434 /*                             bgetopt.c                                    */
01435 /*                                                                          */
01436 /****************************************************************************/
01437 int ILLutil_bix_getopt (
01438   int argc,
01439   char **argv,
01440   const char *def,
01441   int *p_optind,
01442   char **p_optarg);
01443 
01444 
01445 #define ILL_BIX_GETOPT_UNKNOWN -3038
01446 
01447 
01448 
01449 #endif
01450 /****************************************************************************/
01451 /*                                                                          */
01452 /*  This file is part of QSopt_ex.                                          */
01453 /*                                                                          */
01454 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01455 /*  and Daniel Espinoza                                                     */
01456 /*                                                                          */
01457 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01458 /*  copyright in QSopt.                                                     */
01459 /*                                                                          */
01460 /*  This code may be used under the terms of the GNU General Public License */
01461 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01462 /*                                                                          */
01463 /*  Alternatively, use is granted for research purposes only.               */
01464 /*                                                                          */
01465 /*  It is your choice of which of these two licenses you are operating      */
01466 /*  under.                                                                  */
01467 /*                                                                          */
01468 /*  We make no guarantees about the correctness or usefulness of this code. */
01469 /*                                                                          */
01470 /****************************************************************************/
01471 
01472 #ifndef __ZEIT_H__
01473 #define __ZEIT_H__
01474 /****************************************************************************/
01475 /*                                                                          */
01476 /*                             zeit.c                                       */
01477 /*                                                                          */
01478 /****************************************************************************/
01479 
01480 typedef struct ILLutil_timer
01481 {
01482   double szeit;
01483   double cum_zeit;
01484   char name[40];
01485   int count;
01486 }
01487 ILLutil_timer;
01488 
01489 
01490 double ILLutil_zeit (
01491   void),
01492   ILLutil_real_zeit (
01493   void),
01494   ILLutil_stop_timer (
01495   ILLutil_timer * t,
01496   int printit),
01497   ILLutil_total_timer (
01498   ILLutil_timer * t,
01499   int printit);
01500 
01501 
01502 void ILLutil_init_timer (
01503   ILLutil_timer * t,
01504   const char *name),
01505   ILLutil_start_timer (
01506   ILLutil_timer * t),
01507   ILLutil_suspend_timer (
01508   ILLutil_timer * t),
01509   ILLutil_resume_timer (
01510   ILLutil_timer * t);
01511 
01512 
01513 
01514 #endif
01515 /****************************************************************************/
01516 /*                                                                          */
01517 /*  This file is part of QSopt_ex.                                          */
01518 /*                                                                          */
01519 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01520 /*  and Daniel Espinoza                                                     */
01521 /*                                                                          */
01522 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01523 /*  copyright in QSopt.                                                     */
01524 /*                                                                          */
01525 /*  This code may be used under the terms of the GNU General Public License */
01526 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01527 /*                                                                          */
01528 /*  Alternatively, use is granted for research purposes only.               */
01529 /*                                                                          */
01530 /*  It is your choice of which of these two licenses you are operating      */
01531 /*  under.                                                                  */
01532 /*                                                                          */
01533 /*  We make no guarantees about the correctness or usefulness of this code. */
01534 /*                                                                          */
01535 /****************************************************************************/
01536 
01537 /* RCSINFO $Id: except.h,v 1.3 2003/11/05 17:02:10 meven Exp $ */
01538 #ifndef ILL_except
01539 #define ILL_except
01540 
01541 /* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
01542    which contains the name of the function currently being defined.
01543 #  define __DEV_FUNCTION__     __PRETTY_FUNCTION__
01544    This is broken in G++ before version 2.6.
01545    C9x has a similar variable called __func__, but prefer the GCC one since
01546    it demangles C++ function names.  */
01547 # ifdef __GNUC__
01548 #  if __GNUC__ > 2 || (__GNUC__ == 2 \
01549                        && __GNUC_MINOR__ >= (defined __cplusplus ? 6 : 4))
01550 #   define __DEV_FUNCTION__    __PRETTY_FUNCTION__
01551 #  else
01552 #   define __DEV_FUNCTION__    ((__const char *) 0)
01553 #  endif
01554 # else
01555 #  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
01556 #   define __DEV_FUNCTION__    __func__
01557 #  else
01558 #   define __DEV_FUNCTION__    ((const char *) 0)
01559 #  endif
01560 # endif
01561 
01562 
01563 /* put debugger breakpoint here */
01564 extern void ILL_report (
01565   const char *msg,
01566   const char *fct,
01567   const char *file,
01568   unsigned int line,
01569   int with_source_info);
01570 
01571 /* printed message looks as follows
01572  *
01573  * with_source_info == 0:   <msg> + "\n"
01574  *
01575  * with_source_info == 1:   if (fct != NULL) 
01576  *                              <msg> + " in function <fct>\n";
01577  *                          else 
01578  *                              <msg> + " in file <file> line <line>\n"; 
01579  */
01580 
01581 #define ILL_GENERAL_ERROR -1
01582 #define ILL_NO_MEMORY 2
01583 #define ILL_NULL_PTR  3
01584 
01585 #define ILL_REPORT(msg,with) \
01586     ILL_report(msg, __DEV_FUNCTION__, __FILE__, __LINE__, with)
01587 #ifdef NDEBUG
01588 #define ILL_REPRT(msg) \
01589     ILL_report(msg, __DEV_FUNCTION__, __FILE__, __LINE__, 0)
01590 #else
01591 #define ILL_REPRT(msg) \
01592     ILL_report(msg, __DEV_FUNCTION__, __FILE__, __LINE__, 1)
01593 #endif
01594 
01595 #define ILL_RESULT(expr, msg) \
01596 {               \
01597   if (TRACE > 0) { ILL_RETURN(expr, msg); } \
01598     return expr; \
01599 }
01600 
01601 #define ILL_RETURN_PTR(ptr, msg) \
01602     { void *ILL_RETURN_p = ptr; \
01603       if (ILL_RETURN_p == NULL) {  \
01604         if (TRACE > 0) ILL_REPRT(msg); \
01605       } \
01606       return ILL_RETURN_p;  \
01607     }
01608 
01609 #ifdef NDEBUG
01610 #define ILL_RETURN(expr, msg)           \
01611 {                   \
01612   if (expr != 0) {          \
01613       if (TRACE > 0) ILL_REPRT(msg); \
01614     }                 \
01615     return expr;            \
01616 }
01617 
01618 #else
01619 #define ILL_RETURN(expr, msg)           \
01620   {                 \
01621     if (expr != 0) {                \
01622       ILL_REPRT(msg);             \
01623     }                               \
01624     ILL_IFTRACE("%s: returning %d\n", __DEV_FUNCTION__, expr); \
01625     return expr;          \
01626   }
01627 #endif
01628 
01629 #define ILL_CHECKnull(expr, msg) \
01630     { if ((expr) == NULL)  {  \
01631          ILL_REPRT(msg); \
01632          rval = ILL_NULL_PTR; \
01633          goto CLEANUP;  \
01634       } }
01635 
01636 #define ILL_FAILtrue(expr, msg) \
01637     { if (expr)  {  \
01638          ILL_REPRT(msg); \
01639          rval = ILL_GENERAL_ERROR; \
01640          goto CLEANUP;  \
01641       } }
01642 
01643 #define ILL_FAILtrue_no_rval(expr, msg) \
01644     { if (expr)  {  \
01645          ILL_REPRT(msg); \
01646          goto CLEANUP;  \
01647       } }
01648 
01649 
01650 #define ILL_FAILfalse(expr, msg)  ILL_FAILtrue(!(expr), msg)
01651 #define ILL_FAILfalse_no_rval(expr, msg)  ILL_FAILtrue_no_rval(!(expr), msg)
01652 
01653 #define ILL_ERROR(rval, msg)      {                 \
01654                   fprintf(stderr, "%s\n", msg); \
01655                   rval = 1; goto CLEANUP;     \
01656                   }
01657 #define ILL_CLEANUP_IF(rval)      { if ((rval) != 0) { goto CLEANUP; } }
01658 #define ILL_CLEANUP               goto CLEANUP
01659 
01660 #define ILL_SAFE_MALLOC(lhs, n, type) \
01661     { lhs = ILL_UTIL_SAFE_MALLOC(n, type, lhs); \
01662       if (lhs == NULL)  {  \
01663          ILL_REPRT("Out of memory"); \
01664          rval = ILL_NO_MEMORY; \
01665          goto CLEANUP;  \
01666       }}
01667 
01668 #define ILL_SAFE_MALLOC_no_rval(lhs, n, type) \
01669     { lhs = ILL_UTIL_SAFE_MALLOC(n, type, lhs); \
01670       if (lhs == NULL)  {  \
01671          ILL_REPRT("Out of memory"); \
01672          goto CLEANUP;  \
01673       }}
01674 
01675 
01676 #define ILL_NEW(ptr, type) ILL_SAFE_MALLOC(ptr, 1, type)
01677 #define ILL_NEW_no_rval(ptr, type) ILL_SAFE_MALLOC_no_rval(ptr, 1, type)
01678 
01679 /* we define debugging verbosity for singular basis */
01680 extern int __QS_SB_VERB;
01681 #endif
01682 /* Taken from EGlib 10-09-26 */
01683 /* EGlib "Efficient General Library" provides some basic structures and
01684  * algorithms commons in many optimization algorithms.
01685  *
01686  * Copyright (C) 2005 Daniel Espinoza and Marcos Goycoolea.
01687  * 
01688  * This library is free software; you can redistribute it and/or modify it
01689  * under the terms of the GNU Lesser General Public License as published by the
01690  * Free Software Foundation; either version 2.1 of the License, or (at your
01691  * option) any later version.
01692  *
01693  * This library is distributed in the hope that it will be useful, but 
01694  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
01695  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
01696  * License for more details.
01697  *
01698  * You should have received a copy of the GNU Lesser General Public License
01699  * along with this library; if not, write to the Free Software Foundation,
01700  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
01701  * */
01702 /* ========================================================================= */
01703 /** Main Configuration for the library, as debug levels and so on
01704  * 
01705  * @par History:
01706  * - 2010-09-26
01707  *            - Addapted for QSopt_ex
01708  * - 2010-08-13
01709  *            - Add suport for autoconf and configure for header and feature
01710  *            selection
01711  * - 2006-01-27
01712  *          - Handle some problems with stdint.h in SUN
01713  * - 2005-08-17
01714  *          - Set memory aligment to 8 bits
01715  * - 2003-06-02
01716  *          - First Implementation
01717  * @version 1.1.1 
01718  * */
01719 /* ========================================================================= */
01720 #ifndef __QS_CONFIG_H__
01721 #define __QS_CONFIG_H__
01722 #ifdef HAVE_STDIO_H
01723 # include <stdio.h>
01724 #endif
01725 #ifdef HAVE_SYS_SOCKET_H
01726 # include <sys/socket.h>
01727 #endif
01728 #ifdef HAVE_SYS_TYPES_H
01729 # include <sys/types.h>
01730 #endif
01731 #ifdef HAVE_SYS_STAT_H
01732 # include <sys/stat.h>
01733 #endif
01734 #ifdef STDC_HEADERS
01735 # include <stdlib.h>
01736 # include <stddef.h>
01737 #else
01738 # ifdef HAVE_STDLIB_H
01739 # include <stdlib.h>
01740 # endif
01741 #endif
01742 #ifdef HAVE_STRING_H
01743 # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
01744 # include <memory.h>
01745 # endif
01746 # include <string.h>
01747 #endif
01748 #ifdef HAVE_STRINGS_H
01749 # include <strings.h>
01750 #endif
01751 #ifdef HAVE_INTTYPES_H
01752 # include <inttypes.h>
01753 #endif
01754 #ifdef HAVE_STDINT_H
01755 # include <stdint.h>
01756 #endif
01757 #ifdef HAVE_UNISTD_H
01758 # include <unistd.h>
01759 #endif
01760 #ifdef HAVE_ERRNO_H
01761 # include <errno.h>
01762 #endif
01763 #ifdef HAVE_LIMITS_H
01764 # include <limits.h>
01765 #endif
01766 #ifdef HAVE_MATH_H
01767 # include <math.h>
01768 #endif
01769 #ifdef HAVE_FLOAT_H
01770 # include <float.h>
01771 #endif
01772 #ifdef HAVE_GETOPT_H
01773 # include <getopt.h>
01774 #endif
01775 #ifdef HAVE_NETINET_IN_H
01776 # include <netinet/in.h>
01777 #endif
01778 #ifdef HAVE_NETINET_TCP_H
01779 # include <netinet/tcp.h>
01780 #endif
01781 #ifdef HAVE_NETDB_H
01782 # include <netdb.h>
01783 #endif
01784 #ifdef HAVE_FCNTL_H
01785 # include <fcntl.h>
01786 #endif
01787 #ifdef HAVE_SYS_RESOURCE_H
01788 # include <sys/resource.h>
01789 #endif
01790 #ifdef HAVE_SYS_PARAM_H
01791 # include <sys/param.h>
01792 #endif
01793 #ifdef TIME_WITH_SYS_TIME
01794 # include <sys/time.h>
01795 # include <time.h>
01796 #else
01797 # ifdef HAVE_SYS_TIME_H
01798 # include <sys/time.h>
01799 # else
01800 # include <time.h>
01801 # endif
01802 #endif
01803 #ifdef HAVE_SYS_TIMES_H
01804 # include <sys/times.h>
01805 #endif
01806 #ifdef HAVE_STDARG_H
01807 # include <stdarg.h>
01808 #endif
01809 #ifdef HAVE_SYS_UTSNAME_H
01810 # include <sys/utsname.h>
01811 #endif
01812 #ifdef HAVE_SIGNAL_H
01813 # include <signal.h>
01814 #endif
01815 #ifdef HAVE_SETJMP_H
01816 # include <setjmp.h>
01817 #endif
01818 /* ========================================================================= */
01819 /** @brief if no gmp support, we do not include gmp.h, if on the otherhand, we
01820  * have libgmp, we MUST have gmp.h */
01821 #ifdef HAVE_LIBGMP
01822 # if HAVE_LIBGMP
01823 #  ifdef HAVE_GMP_H
01824 #   include <gmp.h>
01825 #  else
01826 #   error Must have gmp.h for compiling QSopt_ex
01827 #  endif
01828 # else
01829 #  error Must have gmp.h for compiling QSopt_ex
01830 # endif
01831 # else
01832 #  error Must have gmp.h for compiling QSopt_ex
01833 #endif
01834 /* ========================================================================= */
01835 /** @brief assert Debug options definitions, by defoult set on */
01836 #ifndef DEBUG
01837 #warning you should define DEBUG, assuming it to be 1
01838 #define DEBUG 1
01839 #endif
01840 
01841 /* ========================================================================= */
01842 /** @brief assert Verbose options definition, by default set on */
01843 #ifndef VERBOSE_LEVEL
01844 #warning you should define VERBOSE_LEVEL, assuming it to be 1
01845 #define VERBOSE_LEVEL 1
01846 #endif
01847 /* ========================================================================= */
01848 #ifdef HAVE_EGLIB_H
01849 # if HAVE_EGLIB_H
01850 #  include "EGlib.h"
01851 # else
01852 #  error You must have EGlib.h for compilation
01853 # endif
01854 #else
01855 #  error You must have EGlib.h for compilation
01856 #endif
01857 /* ========================================================================= */
01858 /** @brief define version function name */
01859 void QSopt_ex_version(void);
01860 #endif
01861 /****************************************************************************/
01862 /*                                                                          */
01863 /*  This file is part of QSopt_ex.                                          */
01864 /*                                                                          */
01865 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01866 /*  and Daniel Espinoza                                                     */
01867 /*                                                                          */
01868 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01869 /*  copyright in QSopt.                                                     */
01870 /*                                                                          */
01871 /*  This code may be used under the terms of the GNU General Public License */
01872 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01873 /*                                                                          */
01874 /*  Alternatively, use is granted for research purposes only.               */
01875 /*                                                                          */
01876 /*  It is your choice of which of these two licenses you are operating      */
01877 /*  under.                                                                  */
01878 /*                                                                          */
01879 /*  We make no guarantees about the correctness or usefulness of this code. */
01880 /*                                                                          */
01881 /****************************************************************************/
01882 
01883 /*  $RCSfile: dbl_qstruct.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
01884 #ifndef dbl___QS_QSTRUCT_H
01885 #define dbl___QS_QSTRUCT_H
01886 
01887 typedef struct dbl_qsdata
01888 {
01889   struct dbl_ILLlpdata *qslp;
01890   struct dbl_lpinfo *lp;
01891   struct dbl_price_info *pricing;
01892   struct dbl_ILLlp_basis *basis;
01893   struct dbl_ILLlp_cache *cache;
01894   char *name;
01895   int qstatus;                  /* QS_LP_UNSOLVED or an opt status  */
01896   int factorok;                 /* set to 0 if factorization is old */
01897   int simplex_display;          /* 0 off, 1 on */
01898   int simplex_scaling;          /* 0 off, 1 on */
01899   itcnt_t itcnt;
01900   double uobjlim;
01901   double lobjlim;
01902 }
01903 dbl_QSdata;
01904 
01905 #endif /* dbl___QS_QSTRUCT_H */
01906 /****************************************************************************/
01907 /*                                                                          */
01908 /*  This file is part of QSopt_ex.                                          */
01909 /*                                                                          */
01910 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01911 /*  and Daniel Espinoza                                                     */
01912 /*                                                                          */
01913 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01914 /*  copyright in QSopt.                                                     */
01915 /*                                                                          */
01916 /*  This code may be used under the terms of the GNU General Public License */
01917 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01918 /*                                                                          */
01919 /*  Alternatively, use is granted for research purposes only.               */
01920 /*                                                                          */
01921 /*  It is your choice of which of these two licenses you are operating      */
01922 /*  under.                                                                  */
01923 /*                                                                          */
01924 /*  We make no guarantees about the correctness or usefulness of this code. */
01925 /*                                                                          */
01926 /****************************************************************************/
01927 
01928 /* RCSINFO $Id: dbl_editor.h,v 1.2 2003/11/05 16:57:39 meven Exp $ */
01929 #ifndef dbl_EDITOR_H
01930 #define dbl_EDITOR_H
01931 
01932 extern void dbl_ILLeditor_init (
01933   void);
01934 extern void dbl_ILLeditor (
01935   dbl_QSdata * p);
01936 extern int dbl_ILLeditor_solve (
01937   dbl_QSdata * p,
01938   int salgo);
01939 
01940 #endif
01941 /****************************************************************************/
01942 /*                                                                          */
01943 /*  This file is part of QSopt_ex.                                          */
01944 /*                                                                          */
01945 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
01946 /*  and Daniel Espinoza                                                     */
01947 /*                                                                          */
01948 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
01949 /*  copyright in QSopt.                                                     */
01950 /*                                                                          */
01951 /*  This code may be used under the terms of the GNU General Public License */
01952 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
01953 /*                                                                          */
01954 /*  Alternatively, use is granted for research purposes only.               */
01955 /*                                                                          */
01956 /*  It is your choice of which of these two licenses you are operating      */
01957 /*  under.                                                                  */
01958 /*                                                                          */
01959 /*  We make no guarantees about the correctness or usefulness of this code. */
01960 /*                                                                          */
01961 /****************************************************************************/
01962 
01963 /* RCSINFO $Id: dbl_dstruct.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
01964 /****************************************************************************/
01965 /*                                                                          */
01966 /*                           dbl_svector.h                                      */
01967 /*                                                                          */
01968 /****************************************************************************/
01969 
01970 #ifndef dbl___SVECTOR_H
01971 #define dbl___SVECTOR_H
01972 
01973 typedef struct dbl_svector
01974 {
01975   int nzcnt;
01976   int *indx;
01977   int size;
01978   double *coef;
01979 }
01980 dbl_svector;
01981 
01982 void dbl_ILLsvector_init (
01983   dbl_svector * s),
01984   dbl_ILLsvector_free (
01985   dbl_svector * s);
01986 
01987 int dbl_ILLsvector_alloc (
01988   dbl_svector * s,
01989   int nzcnt),
01990   dbl_ILLsvector_copy (
01991   const dbl_svector * s_in,
01992   dbl_svector * s_out);
01993 
01994 #endif /* dbl___SVECTOR_H */
01995 
01996 /****************************************************************************/
01997 /*                                                                          */
01998 /*                           dbl_heap.h                                         */
01999 /*                                                                          */
02000 /****************************************************************************/
02001 
02002 #ifndef dbl___HEAP_H
02003 #define dbl___HEAP_H
02004 
02005 typedef struct
02006 {
02007   int *entry;
02008   int *loc;
02009   double *key;
02010   int hexist;
02011   int maxsize;
02012   int size;
02013 }
02014 dbl_heap;
02015 
02016 void dbl_ILLheap_insert (
02017   dbl_heap * const h,
02018   int const ix),
02019   dbl_ILLheap_modify (
02020   dbl_heap * const h,
02021   int const ix),
02022   dbl_ILLheap_delete (
02023   dbl_heap * const h,
02024   int const ix),
02025   dbl_ILLheap_init (
02026   dbl_heap * const h),
02027   dbl_ILLheap_free (
02028   dbl_heap * const h);
02029 
02030 int dbl_ILLheap_findmin (
02031   dbl_heap * const h),
02032   dbl_ILLheap_build (
02033   dbl_heap * const h,
02034   int const nelems,
02035   double * key);
02036 
02037 #endif /* dbl___HEAP_H */
02038 
02039 /****************************************************************************/
02040 /*                                                                          */
02041 /*                         matrix.h                                         */
02042 /*                                                                          */
02043 /****************************************************************************/
02044 
02045 #ifndef dbl___MATRIX_H
02046 #define dbl___MATRIX_H
02047 
02048 typedef struct dbl_ILLmatrix
02049 {
02050   double *matval;           /* The coefficients.                       */
02051   int *matcnt;                  /* Number of coefs in each col.            */
02052   int *matind;                  /* The row indices of the coefs.           */
02053   int *matbeg;                  /* The start of each col.                  */
02054   int matcols;                  /* Number of columns.                      */
02055   int matrows;
02056   int matcolsize;               /* Length of matbeg and matcnt.            */
02057   int matsize;                  /* Length of matind and matval.            */
02058   int matfree;                  /* Free space at end of matind.            */
02059   /* Note: free elements marked by -1 in     */
02060   /* matind; we keep at least 1 free at end. */
02061 }
02062 dbl_ILLmatrix;
02063 
02064 void dbl_ILLmatrix_init (
02065   dbl_ILLmatrix * A);
02066 void dbl_ILLmatrix_free (
02067   dbl_ILLmatrix * A);
02068 void dbl_ILLmatrix_prt (
02069   EGioFile_t * fd,
02070   dbl_ILLmatrix * A);
02071 
02072 #endif /* dbl___MATRIX_H */
02073 /****************************************************************************/
02074 /*                                                                          */
02075 /*  This file is part of QSopt_ex.                                          */
02076 /*                                                                          */
02077 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
02078 /*  and Daniel Espinoza                                                     */
02079 /*                                                                          */
02080 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
02081 /*  copyright in QSopt.                                                     */
02082 /*                                                                          */
02083 /*  This code may be used under the terms of the GNU General Public License */
02084 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
02085 /*                                                                          */
02086 /*  Alternatively, use is granted for research purposes only.               */
02087 /*                                                                          */
02088 /*  It is your choice of which of these two licenses you are operating      */
02089 /*  under.                                                                  */
02090 /*                                                                          */
02091 /*  We make no guarantees about the correctness or usefulness of this code. */
02092 /*                                                                          */
02093 /****************************************************************************/
02094 
02095 /* RCSINFO $Id: dbl_factor.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
02096 #ifndef dbl___QS_FACTOR_H_
02097 #define dbl___QS_FACTOR_H_
02098 
02099 typedef char dbl_QSbool;
02100 
02101 typedef struct dbl_uc_info
02102 {
02103   int cbeg;
02104   int nzcnt;
02105   int next;
02106   int prev;
02107   int delay;
02108 }
02109 dbl_uc_info;
02110 
02111 typedef struct dbl_ur_info
02112 {
02113   double max;
02114   int rbeg;
02115   int nzcnt;
02116   int pivcnt;
02117   int next;
02118   int prev;
02119   int delay;
02120 }
02121 dbl_ur_info;
02122 
02123 typedef struct dbl_lc_info
02124 {
02125   int cbeg;
02126   int nzcnt;
02127   int c;
02128   int crank;
02129   int delay;
02130 }
02131 dbl_lc_info;
02132 
02133 typedef struct dbl_lr_info
02134 {
02135   int rbeg;
02136   int nzcnt;
02137   int r;
02138   int rrank;
02139   int delay;
02140 }
02141 dbl_lr_info;
02142 
02143 typedef struct dbl_er_info
02144 {
02145   int rbeg;
02146   int nzcnt;
02147   int r;
02148 }
02149 dbl_er_info;
02150 
02151 typedef struct dbl_factor_work
02152 {
02153   int max_k;
02154   double fzero_tol;
02155   double szero_tol;
02156   double partial_tol;
02157   double ur_space_mul;
02158   double uc_space_mul;
02159   double lc_space_mul;
02160   double lr_space_mul;
02161   double er_space_mul;
02162   double grow_mul;
02163   int p;
02164   int etamax;
02165   double minmult;
02166   double maxmult;
02167   double updmaxmult;
02168   double dense_fract;
02169   int dense_min;
02170 
02171   double maxelem_orig;
02172   int nzcnt_orig;
02173   double maxelem_factor;
02174   int nzcnt_factor;
02175   double maxelem_cur;
02176   int nzcnt_cur;
02177 
02178   double partial_cur;
02179 
02180   int dim;
02181   int stage;
02182   int nstages;
02183   int etacnt;
02184   double *work_coef;
02185   int *work_indx;
02186   dbl_uc_info *uc_inf;
02187   dbl_ur_info *ur_inf;
02188   dbl_lc_info *lc_inf;
02189   dbl_lr_info *lr_inf;
02190   dbl_er_info *er_inf;
02191   int *ucindx;                  /* row index for column data */
02192   int *ucrind;                  /* index of column in row data */
02193   double *uccoef;           /* coefficient for column data */
02194   int *urindx;                  /* col index for row data */
02195   int *urcind;                  /* index of row in column data */
02196   double *urcoef;           /* coefficient for row data */
02197   int *lcindx;                  /* row index for L data */
02198   double *lccoef;           /* coefficient for L row data */
02199   int *lrindx;                  /* col index for L data */
02200   double *lrcoef;           /* coefficient for L col data */
02201   int *erindx;                  /* col index for eta data */
02202   double *ercoef;           /* coefficient for eta data */
02203   int *rperm;
02204   int *rrank;
02205   int *cperm;
02206   int *crank;
02207   dbl_svector xtmp;
02208   int ur_freebeg;
02209   int ur_space;
02210   int uc_freebeg;
02211   int uc_space;
02212   int lc_freebeg;
02213   int lc_space;
02214   int lr_freebeg;
02215   int lr_space;
02216   int er_freebeg;
02217   int er_space;
02218 
02219   int *p_nsing;
02220   int **p_singr;
02221   int **p_singc;
02222 
02223   double *dmat;
02224   int drows;
02225   int dcols;
02226   int dense_base;
02227 }
02228 dbl_factor_work;
02229 
02230 void dbl_ILLfactor_init_factor_work (
02231   dbl_factor_work * f),
02232   dbl_ILLfactor_free_factor_work (
02233   dbl_factor_work * f),
02234   dbl_ILLfactor_ftran (
02235   dbl_factor_work * f,
02236   dbl_svector * a,
02237   dbl_svector * x),
02238   dbl_ILLfactor_ftran_update (
02239   dbl_factor_work * f,
02240   dbl_svector * a,
02241   dbl_svector * upd,
02242   dbl_svector * x),
02243   dbl_ILLfactor_btran (
02244   dbl_factor_work * f,
02245   dbl_svector * a,
02246   dbl_svector * x);
02247 
02248 int dbl_ILLfactor_create_factor_work (
02249   dbl_factor_work * f,
02250   int dim),
02251   dbl_ILLfactor_set_factor_iparam (
02252   dbl_factor_work * f,
02253   int param,
02254   int val),
02255   dbl_ILLfactor_set_factor_dparam (
02256   dbl_factor_work * f,
02257   int param,
02258   double val),
02259   dbl_ILLfactor (
02260   dbl_factor_work * f,
02261   int *basis,
02262   int *cbeg,
02263   int *clen,
02264   int *cindx,
02265   double * ccoef,
02266   int *p_nsing,
02267   int **p_singr,
02268   int **p_singc),
02269   dbl_ILLfactor_update (
02270   dbl_factor_work * f,
02271   dbl_svector * a,
02272   int col,
02273   int *p_refact);
02274 
02275 #endif /* dbl___QS_FACTOR_H_ */
02276 /****************************************************************************/
02277 /*                                                                          */
02278 /*  This file is part of QSopt_ex.                                          */
02279 /*                                                                          */
02280 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
02281 /*  and Daniel Espinoza                                                     */
02282 /*                                                                          */
02283 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
02284 /*  copyright in QSopt.                                                     */
02285 /*                                                                          */
02286 /*  This code may be used under the terms of the GNU General Public License */
02287 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
02288 /*                                                                          */
02289 /*  Alternatively, use is granted for research purposes only.               */
02290 /*                                                                          */
02291 /*  It is your choice of which of these two licenses you are operating      */
02292 /*  under.                                                                  */
02293 /*                                                                          */
02294 /*  We make no guarantees about the correctness or usefulness of this code. */
02295 /*                                                                          */
02296 /****************************************************************************/
02297 
02298 /* RCSINFO $Id: dbl_lpdefs.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
02299 #ifndef dbl___QS_LPDEFS_H
02300 #define dbl___QS_LPDEFS_H
02301 
02302 
02303 /* infinity and negative infinity */
02304 #define dbl_INFTY  dbl_ILL_MAXDOUBLE
02305 #define dbl_NINFTY dbl_ILL_MINDOUBLE
02306 
02307 /* tolerances, these are initialized in dbl_ILLstart, file dbl_lpdata.c */
02308 //#if EGLPNUM_TYPE != DBL_TYPE && EGLPNUM_TYPE != LDBL_TYPE
02309 /* these three constants are defined in dbl_lpdata.c */
02310 extern double dbl_PARAM_IBASIS_RPIVOT;  /*       0.98 */
02311 extern double dbl_PARAM_IBASIS_RTRIANG;/*       0.01 */
02312 extern double dbl_PARAM_MIN_DNORM;      /*      1e-24 */
02313 extern double dbl_PFEAS_TOLER;          /*       1e-6 */
02314 extern double dbl_BD_TOLER;           /*       1e-7 */
02315 extern double dbl_DFEAS_TOLER;          /*       1e-6 */
02316 extern double dbl_PIVOT_TOLER;          /*      1e-10 */
02317 extern double dbl_SZERO_TOLER;          /*      1e-15 */
02318 extern double dbl_PIVZ_TOLER;         /*      1e-12 */
02319 extern double dbl_OBJBND_TOLER;       /*       1e-2 */
02320 extern double dbl_DBNDPIV_TOLER;        /*       1e-3 */
02321 extern double dbl_DBNDPIV_RATIO;        /*       1e-2 */
02322 extern double dbl_ALTPIV_TOLER;       /*       1e-8 */
02323 //extern double DJZERO_TOLER;/*             1e-8 */
02324 extern double dbl_PROGRESS_ZERO;        /*       1e-7 */
02325 extern double dbl_PROGRESS_THRESH;      /*       1e-5 */
02326 extern double dbl_CB_EPS;             /*      0.001 */
02327 extern double dbl_CB_INF_RATIO;       /*       10.0 */
02328 extern double dbl_CB_PRI_RLIMIT;        /*       0.25 */
02329 
02330 /* structure for statistics */
02331 typedef struct
02332 {
02333   int ynz_cnt;                  /* nz in entering columns */
02334   int num_y;
02335   double y_ravg;              /* weighted avg. of current & prior y */
02336   int znz_cnt;                  /* nz in ith row of B^{-1}, ie z_i */
02337   int num_z;
02338   double z_ravg;              /* weighted avg. of current & prior z */
02339   int zanz_cnt;                 /* nz in z^TA */
02340   int num_za;
02341   double za_ravg;           /* weighted avg. of current & prior za */
02342   int pnorm_cnt;                /* nz in columns for primal norms */
02343   int dnorm_cnt;                /* nz in rows for dual norms */
02344   int pinz_cnt;                 /* nz in phase II pi (solve) */
02345   int num_pi;                   /* # of pi solves */
02346   int pi1nz_cnt;                /* nz in phase I pi (solve) */
02347   int num_pi1;                  /* # of phase I pi solves */
02348   int upnz_cnt;                 /* nz in ftran update vector */
02349   int num_up;                   /* # of ftran_updates */
02350   int pupv_cnt;                 /* nz in primal steep updates */
02351   int dupv_cnt;                 /* nz in dual steep updates */
02352 
02353   int start_slacks;             /* # slacks in beginning */
02354   int final_slacks;             /* # slacks in the end */
02355   int start_art;                /* # arts in beginning */
02356   int final_art;                /* # arts in the end */
02357 
02358   int pI_iter;                  /* primal phase I iterations */
02359   int pII_iter;
02360   int dI_iter;                  /* dual phase I iterations */
02361   int dII_iter;
02362   int tot_iter;
02363 
02364   int pivpI[10];                /* sizes of pivots */
02365   int pivpII[10];
02366   int pivdI[10];
02367   int pivdII[10];
02368 }
02369 dbl_count_struct;
02370 
02371 /* structure for tolerances */
02372 typedef struct
02373 {
02374   double pfeas_tol;
02375   double dfeas_tol;
02376   double pivot_tol;
02377   double szero_tol;
02378   double ip_tol;              /* inner primal & dual feas toler */
02379   double id_tol;
02380 }
02381 dbl_tol_struct;
02382 
02383 /* bound information */
02384 typedef struct dbl_bndinfo
02385 {
02386   double pbound;
02387   double cbound;
02388   int btype;
02389   int varnum;
02390   struct dbl_bndinfo *next;
02391 }
02392 dbl_bndinfo;
02393 
02394 /* bound information */
02395 typedef struct dbl_coefinfo
02396 {
02397   double pcoef;
02398   double ccoef;
02399   int varnum;
02400   struct dbl_coefinfo *next;
02401 }
02402 dbl_coefinfo;
02403 
02404 /* feasibility info */
02405 typedef struct dbl_feas_info
02406 {
02407   int pstatus;
02408   int dstatus;
02409   double totinfeas;
02410 }
02411 dbl_feas_info;
02412 
02413 typedef struct dbl_lp_status_info
02414 {
02415   char optimal;
02416   char primal_feasible;
02417   char primal_infeasible;
02418   char primal_unbounded;
02419   char dual_feasible;
02420   char dual_infeasible;
02421   char dual_unbounded;
02422   char padd;
02423 }
02424 dbl_lp_status_info;
02425 
02426 typedef struct dbl_pI_uinfo
02427 {
02428   int tctr;
02429   int i;
02430   int *perm;
02431   int *ix;
02432   int fs;
02433   double piv;
02434   double *t;
02435   double dty;
02436   double c_obj;
02437   double tz;
02438 }
02439 dbl_pI_uinfo;
02440 
02441 extern void dbl_ILLlp_status_info_init (
02442   dbl_lp_status_info * ls);
02443 
02444 /* structure for local lp information
02445  * contains lp obj values - status - dimensions - input data -
02446  * solution vecs - basis info - update vecs - work vecs - bound changes -
02447  * tolerances - time info - statistics 
02448  */
02449 typedef struct dbl_lpinfo
02450 {
02451 
02452   double objval;              /* obj info */
02453   double pobjval;           /* intermediate status info */
02454   double dobjval;
02455   double pinfeas;
02456   double dinfeas;
02457   double objbound;
02458   dbl_lp_status_info probstat;      /* final status */
02459   dbl_lp_status_info basisstat;     /* final status */
02460   int nrows;                    /* input info follows; given in col format */
02461   int ncols;
02462   int *matcnt;
02463   int *matbeg;
02464   int *matind;
02465   double *matval;
02466   int matfree;
02467   int matsize;
02468   double *bz;
02469   double *lz;
02470   double *uz;
02471   double *cz;
02472   int localrows;                /* set to 1 if these are created locally */
02473   int *rowcnt;                  /* row info follows, copy of col info */
02474   int *rowbeg;
02475   int *rowind;
02476   double *rowval;
02477 
02478   double *xbz;                /* output info x, pi, reduced cost */
02479   double *piz;
02480   double *dz;
02481   double *pIxbz;              /* output info (phase I) x, pi, reduced cost */
02482   double *pIpiz;
02483   double *pIdz;
02484 
02485   int final_phase;              /* final phase, inf & unboundedness info */
02486   int infub_ix;
02487 
02488   int basisid;                  /* basis and variable info follows */
02489   int nnbasic;
02490   int *baz;
02491   int *nbaz;
02492   int *vstat;
02493   int *vindex;
02494   int fbasisid;
02495   dbl_factor_work *f;
02496   int *vtype;                   /* internal var info */
02497   char *vclass;                 /* structural or logical */
02498 
02499   dbl_svector zz;                   /* local dbl_ILLfactor_update vectors z, yj, za */
02500   dbl_svector yjz;
02501   dbl_svector zA;
02502   dbl_svector work;                 /* local work vector */
02503   dbl_svector srhs;                 /* local vectors for lin. eq. solves */
02504   dbl_svector ssoln;
02505   int *iwork;                   /* local work vector */
02506   dbl_pI_uinfo upd;                 /* phase I update info */
02507   int *bfeas;                   /* primal and dual infeasibility info */
02508   int *dfeas;
02509 
02510   dbl_tol_struct *tol;              /* tolerances */
02511   dbl_count_struct *cnts;           /* counts */
02512   int nbchange;                 /* # bound shifts */
02513   int ncchange;                 /* # obj coef shifts */
02514   dbl_bndinfo *bchanges;            /* list of bound shifts */
02515   dbl_coefinfo *cchanges;           /* list of coef shifts */
02516   int pIratio;                  /* ratio tests */
02517   int pIIratio;
02518   int dIratio;
02519   int dIIratio;
02520 
02521   int maxiter;
02522   int iterskip;
02523   double maxtime;
02524   double starttime;
02525   struct dbl_ILLlpdata *O;
02526   ILLrandstate rstate;
02527 
02528 }
02529 dbl_lpinfo;
02530 
02531 /* pricing structures */
02532 typedef struct
02533 {
02534   int ninit;
02535   double *norms;
02536   int *refframe;
02537 }
02538 dbl_p_devex_info;
02539 
02540 typedef struct
02541 {
02542   double *norms;
02543 }
02544 dbl_p_steep_info;
02545 
02546 typedef struct
02547 {
02548   int k;
02549   int cgroup;
02550   int ngroups;
02551   int *gstart;
02552   int *gshift;
02553   int *gsize;
02554   int bsize;
02555   int *bucket;
02556   int *perm;
02557   double *infeas;
02558 }
02559 dbl_mpart_info;
02560 
02561 typedef struct
02562 {
02563   int ninit;
02564   double *norms;
02565   int *refframe;
02566 }
02567 dbl_d_devex_info;
02568 
02569 typedef struct
02570 {
02571   double *norms;
02572 }
02573 dbl_d_steep_info;
02574 
02575 /* pricing information */
02576 typedef struct dbl_price_info
02577 {
02578   int p_strategy;
02579   int d_strategy;
02580   int pI_price;
02581   int pII_price;
02582   int dI_price;
02583   int dII_price;
02584   int cur_price;
02585   double *p_scaleinf;
02586   double *d_scaleinf;
02587   dbl_p_devex_info pdinfo;
02588   dbl_p_steep_info psinfo;
02589   dbl_mpart_info pmpinfo;
02590   dbl_d_devex_info ddinfo;
02591   dbl_d_steep_info dsinfo;
02592   dbl_mpart_info dmpinfo;
02593   dbl_heap h;
02594   double htrigger;
02595   int hineff;
02596   char init;
02597 }
02598 dbl_price_info;
02599 
02600 #endif /* dbl___QS_LPDEFS_H */
02601 /****************************************************************************/
02602 /*                                                                          */
02603 /*  This file is part of QSopt_ex.                                          */
02604 /*                                                                          */
02605 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
02606 /*  and Daniel Espinoza                                                     */
02607 /*                                                                          */
02608 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
02609 /*  copyright in QSopt.                                                     */
02610 /*                                                                          */
02611 /*  This code may be used under the terms of the GNU General Public License */
02612 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
02613 /*                                                                          */
02614 /*  Alternatively, use is granted for research purposes only.               */
02615 /*                                                                          */
02616 /*  It is your choice of which of these two licenses you are operating      */
02617 /*  under.                                                                  */
02618 /*                                                                          */
02619 /*  We make no guarantees about the correctness or usefulness of this code. */
02620 /*                                                                          */
02621 /****************************************************************************/
02622 
02623 /* RCSINFO $Id: rdline.h,v 1.2 2003/11/05 16:57:39 meven Exp $ */
02624 #ifndef dbl_LINE_READER_FILE_H
02625 #define dbl_LINE_READER_FILE_H
02626 
02627 
02628 /* #ifdef _WINDOWS */
02629 typedef char *(
02630   *dbl_qsread_line_fct) (
02631   char *s,
02632   int size,
02633   void *src);
02634 
02635 typedef struct dbl_qsline_reader
02636 {
02637   dbl_qsread_line_fct read_line_fct;
02638   void *data_src;
02639   struct dbl_qserror_collector *error_collector;
02640 }
02641 dbl_qsline_reader;
02642 
02643 dbl_qsline_reader *dbl_ILLline_reader_new (
02644   dbl_qsread_line_fct fct,
02645   void *data_src);
02646 void dbl_ILLline_reader_free (
02647   dbl_qsline_reader * reader);
02648 
02649 #define dbl_ILLline_reader_get(s, size, reader)  \
02650   (reader)->read_line_fct(s, size, (reader)->data_src)
02651                    /* used by parsers to retrieve next input line */
02652 /* #else  
02653  *
02654  * typedef FILE dbl_qsline_reader; 
02655  *
02656  * #define dbl_ILLline_reader_new(fct, data) ((FILE*) (data)) 
02657  * #define dbl_ILLline_reader_free(reader)  
02658  * #define dbl_ILLline_reader_get(s, size, reader) fgets(s,size,reader) 
02659  * #endif 
02660  */
02661 
02662 #endif
02663 /****************************************************************************/
02664 /*                                                                          */
02665 /*  This file is part of QSopt_ex.                                          */
02666 /*                                                                          */
02667 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
02668 /*  and Daniel Espinoza                                                     */
02669 /*                                                                          */
02670 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
02671 /*  copyright in QSopt.                                                     */
02672 /*                                                                          */
02673 /*  This code may be used under the terms of the GNU General Public License */
02674 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
02675 /*                                                                          */
02676 /*  Alternatively, use is granted for research purposes only.               */
02677 /*                                                                          */
02678 /*  It is your choice of which of these two licenses you are operating      */
02679 /*  under.                                                                  */
02680 /*                                                                          */
02681 /*  We make no guarantees about the correctness or usefulness of this code. */
02682 /*                                                                          */
02683 /****************************************************************************/
02684 
02685 /* RCSINFO $Id: dbl_lpdata.h,v 1.4 2003/11/05 17:00:56 meven Exp $ */
02686 #ifndef dbl_ILL_LPDATA_H
02687 #define dbl_ILL_LPDATA_H
02688 
02689 
02690 extern double dbl_ILL_MAXDOUBLE;  /*  1e150 */
02691 extern double dbl_ILL_MINDOUBLE;  /* -1e150 */
02692 
02693 #define dbl_ILL_MAXINT    (2147483647)  /* this is equal to 2^31-1 */
02694 #define dbl_ILL_MIN       (1)       /* Must be same as QS_MIN */
02695 #define dbl_ILL_MAX       (-1)      /* Must be same as QS_MAX */
02696 
02697 /*  Setting Alg in Presolve  */
02698 
02699 #define dbl_ILL_PRE_SCALE           1
02700 #define dbl_ILL_PRE_FIXED           2
02701 #define dbl_ILL_PRE_SINGLE_ROW      4
02702 #define dbl_ILL_PRE_FORCING         8
02703 #define dbl_ILL_PRE_SINGLE_COL     16
02704 #define dbl_ILL_PRE_DUPLICATE_ROW  32
02705 #define dbl_ILL_PRE_DUPLICATE_COL  64
02706 #define dbl_ILL_PRE_EMPTY_COL     128
02707 #define dbl_ILL_PRE_ALL (dbl_ILL_PRE_SCALE | dbl_ILL_PRE_FIXED | dbl_ILL_PRE_SINGLE_ROW           \
02708                     dbl_ILL_PRE_FORCING | dbl_ILL_PRE_SINGLE_COL | dbl_ILL_PRE_DUPLICATE_ROW \
02709                    dbl_ILL_PRE_DUPLICATE_COL | dbl_ILL_PRE_EMPTY_COL)
02710 #define dbl_ILL_PRE_SIMPLE (dbl_ILL_PRE_FIXED | dbl_ILL_PRE_EMPTY_COL)
02711 
02712 typedef struct dbl_ILLlpdata
02713 {                               /* Complete LP data filled in by mpsread.  */
02714   int nrows;
02715   int ncols;
02716   int nstruct;                  /* Not including logicals.                 */
02717   int nzcount;
02718   int rowsize;                  /* Length of row arrays.                   */
02719   int colsize;                  /* Length of col arrays.                   */
02720   int structsize;               /* Length of intmarker, structmap,         */
02721   /* colnames                                */
02722   int objsense;
02723   char *sense;                  /* Original sense, not after logicals.     */
02724   double *obj;
02725   double *rhs;
02726   double *rangeval;
02727   double *lower;
02728   double *upper;
02729   dbl_ILLmatrix A;                  /* The coef matrix.                        */
02730   struct dbl_ILLlp_rows *rA;        /* Coef matrix in row form.                */
02731 
02732   char **rownames;
02733   ILLsymboltab rowtab;          /* contains rownames in no particular order */
02734   char *objname;                /* if colname is not NULL it is entered into 
02735                                  * the rowtab, see reader fcts in dbl_lp.c, dbl_mps.c*/
02736 
02737   char **colnames;              /* columns of struct variables */
02738   ILLsymboltab coltab;          /* contains colnames in no particular order */
02739 
02740   char *probname;
02741   char *intmarker;
02742   int *structmap;               /* Indices of structural variables         */
02743   int *rowmap;                  /* Indices of logical and range variables  */
02744   struct dbl_ILLlp_basis *basis;
02745   struct dbl_ILLlp_predata *presolve;
02746   struct dbl_ILLlp_sinfo *sinfo;
02747 
02748    /**************************************************************************/
02749   /* these fields are currently only set by dbl_mps.c reader fcts               */
02750    /**************************************************************************/
02751   dbl_ILLmatrix sos;                /* columns are the sets, rows are the  
02752                                  * problem's structural variables
02753                                  * coefficients are the weights */
02754 
02755   char *sos_type;               /* type of each set */
02756   int *is_sos_mem;              /* for each structural variable contains 
02757                                  *    -1 == not a set member
02758                                  *     i == member of sos set i 
02759                                  *          where 0 <= i < sos.matcols */
02760   char *refrowname;             /* name of reference row */
02761   int refind;                   /* index of reference row 
02762                                  *     -1 if refrow was a free row 
02763                                  *          and weights are found only in the 
02764                                  *          sos matrix 
02765                                  *     index >=0 if refrow is also a lp-row */
02766 
02767    /**************************************************************************
02768     * dbl_QSset_reporter initializes reporter 
02769     **************************************************************************/
02770   qsstring_reporter reporter;   /* used from within ILL fcts 
02771                                  * to report dbl_feedback */
02772 }
02773 dbl_ILLlpdata;
02774 
02775 typedef struct dbl_ILLlp_basis
02776 {
02777   int nstruct;
02778   int nrows;
02779   int rownorms_size;
02780   int colnorms_size;
02781   char *cstat;
02782   char *rstat;
02783   double *rownorms;
02784   double *colnorms;
02785 }
02786 dbl_ILLlp_basis;
02787 
02788 typedef struct dbl_ILLlp_cache
02789 {
02790   int nstruct;
02791   int nrows;
02792   int status;
02793   double val;
02794   double *x;
02795   double *pi;
02796   double *rc;
02797   double *slack;
02798 }
02799 dbl_ILLlp_cache;
02800 
02801 typedef struct dbl_ILLlp_sinfo
02802 {                               /* LP info returned by presolve            */
02803   int ncols;
02804   int nrows;
02805   int nzcount;
02806   int rowsize;
02807   int colsize;
02808   int objsense;
02809 
02810   double *obj;
02811   double *rhs;
02812   double *lower;
02813   double *upper;
02814 
02815   dbl_ILLmatrix A;
02816 
02817   char **colnames;              /* Just for debugging - not updated */
02818 }
02819 dbl_ILLlp_sinfo;
02820 
02821 typedef struct dbl_ILLlp_preline
02822 {
02823   double rhs;
02824   double obj;
02825   double lower;
02826   double upper;
02827   int count;
02828   int *ind;
02829   int row_or_col;               /* 0 is row, 1 is col */
02830   double *val;
02831 }
02832 dbl_ILLlp_preline;
02833 
02834 typedef struct dbl_ILLlp_preop
02835 {
02836   int ptype;
02837   int rowindex;
02838   int colindex;
02839   dbl_ILLlp_preline line;
02840 }
02841 dbl_ILLlp_preop;
02842 
02843 typedef struct dbl_ILLlp_predata
02844 {                               /* Data needed in un-presolve.            */
02845   int opcount;
02846   int opsize;
02847   dbl_ILLlp_preop *oplist;
02848   int r_nrows;
02849   int r_ncols;
02850   int *colmap;
02851   int *rowmap;
02852   double *rowscale;
02853   double *colscale;
02854   double *colfixval;
02855   double *rowfixval;
02856 }
02857 dbl_ILLlp_predata;
02858 
02859 typedef struct dbl_ILLlp_rows
02860 {
02861   int *rowbeg;
02862   int *rowcnt;
02863   int *rowind;
02864   double *rowval;
02865 }
02866 dbl_ILLlp_rows;
02867 
02868 
02869 /****************************************************************************/
02870 /*                                                                          */
02871 /*                             dbl_lpdata.c                                     */
02872 /*                                                                          */
02873 /****************************************************************************/
02874 
02875 struct dbl_qsdata *dbl_ILLread (
02876   dbl_qsline_reader * file,
02877   const char *dbl_fname,
02878   int isMps);
02879 void dbl_ILLstart (
02880   void);              /**< initialize dbl_ILL_MAXDOUBLE and other 
02881 
02882                            constants, this funtion should be callef AFTER 
02883                            EGlpNumStart() */
02884 void dbl_ILLend (
02885   void);            /**< free any internal data asociated with variable 
02886 
02887                          dbl_precision numbers */
02888 void dbl_ILLchange_precision (
02889   void);                        /**< This function re-compute the internal 
02890 
02891                                      variables dbl_precision to the (previously 
02892                                      set) EGLPNUM_PRECISION value (done with 
02893                                      EGlpNumSetPrecision) */
02894 void dbl_ILLlpdata_init (
02895   dbl_ILLlpdata * lp);
02896 void dbl_ILLlpdata_free (
02897   dbl_ILLlpdata * lp);
02898 void dbl_ILLlp_basis_init (
02899   dbl_ILLlp_basis * B);
02900 void dbl_ILLlp_basis_free (
02901   dbl_ILLlp_basis * B);
02902 void dbl_ILLlp_cache_init (
02903   dbl_ILLlp_cache * C);
02904 void dbl_ILLlp_cache_free (
02905   dbl_ILLlp_cache * C);
02906 int dbl_ILLlp_basis_alloc (
02907   dbl_ILLlp_basis * B,
02908   int ncols,
02909   int nrows);
02910 int dbl_ILLlp_cache_alloc (
02911   dbl_ILLlp_cache * C,
02912   int ncols,
02913   int nrows);
02914 
02915 int dbl_ILLlp_rows_init (
02916   dbl_ILLlp_rows * lp_rows,
02917   dbl_ILLlpdata * lp,
02918   int include_logicals);
02919 void dbl_ILLlp_rows_clear (
02920   dbl_ILLlp_rows * lp_rows);
02921 int dbl_ILLprint_report (
02922   dbl_ILLlpdata * lp,
02923   const char *format,
02924   ...);
02925 
02926               /* print to lp->reporter */
02927 
02928 /****************************************************************************/
02929 /*                                                                          */
02930 /*                             dbl_presolve.c                                   */
02931 /*                                                                          */
02932 /****************************************************************************/
02933 
02934 void dbl_ILLlp_sinfo_init (
02935   dbl_ILLlp_sinfo * sinfo),
02936   dbl_ILLlp_sinfo_free (
02937   dbl_ILLlp_sinfo * sinfo),
02938   dbl_ILLlp_predata_init (
02939   dbl_ILLlp_predata * pre),
02940   dbl_ILLlp_predata_free (
02941   dbl_ILLlp_predata * pre);
02942 
02943 int dbl_ILLlp_add_logicals (
02944   dbl_ILLlpdata * lp),
02945   dbl_ILLlp_scale (
02946   dbl_ILLlpdata * lp),
02947   dbl_ILLlp_presolve (
02948   dbl_ILLlpdata * lp,
02949   int pre_types);
02950 
02951 /* ========================================================================= */
02952 /* if non-zero, then internal data has been initialized, and there is some
02953  * memory allocated, if zero, no internal memory has been allocated
02954  * (or it has been freed) */
02955 extern int dbl___QSEX_SETUP;
02956 
02957 #endif /* __ILL_LPDATA_H */
02958 /****************************************************************************/
02959 /*                                                                          */
02960 /*  This file is part of QSopt_ex.                                          */
02961 /*                                                                          */
02962 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
02963 /*  and Daniel Espinoza                                                     */
02964 /*                                                                          */
02965 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
02966 /*  copyright in QSopt.                                                     */
02967 /*                                                                          */
02968 /*  This code may be used under the terms of the GNU General Public License */
02969 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
02970 /*                                                                          */
02971 /*  Alternatively, use is granted for research purposes only.               */
02972 /*                                                                          */
02973 /*  It is your choice of which of these two licenses you are operating      */
02974 /*  under.                                                                  */
02975 /*                                                                          */
02976 /*  We make no guarantees about the correctness or usefulness of this code. */
02977 /*                                                                          */
02978 /****************************************************************************/
02979 
02980 /* RCSINFO $Id: dbl_basis.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
02981 #ifndef dbl___BASIS_H
02982 #define dbl___BASIS_H
02983 
02984 
02985 #if 0
02986 #if EGLPNUM_TYPE != DBL_TYPE && EGLPNUM_TYPE != LDBL_TYPE
02987 extern double dbl_CB_PRI_RLIMIT;  /* = 0.25 */
02988 extern double dbl_CB_INF_RATIO; /* = 10.0 */
02989 extern double dbl_CB_EPS;       /* = 0.001 */
02990 #endif
02991 #endif
02992 
02993 typedef struct dbl_var_data
02994 {
02995   int nartif;
02996   int nslacks;
02997   int nfree;
02998   int nbndone;
02999   int nbounded;
03000   int nfixed;
03001   double cmax;
03002 }
03003 dbl_var_data;
03004 
03005 void dbl_ILLbasis_init_vardata (
03006   dbl_var_data * vd);
03007 void dbl_ILLbasis_clear_vardata (
03008   dbl_var_data * vd);
03009 
03010 int dbl_ILLbasis_build_basisinfo (
03011   dbl_lpinfo * lp),
03012   dbl_ILLbasis_get_initial (
03013   dbl_lpinfo * lp,
03014   int algorithm),
03015   dbl_ILLbasis_get_cinitial (
03016   dbl_lpinfo * lp,
03017   int algorithm),
03018   dbl_ILLbasis_load (
03019   dbl_lpinfo * lp,
03020   dbl_ILLlp_basis * B),
03021   dbl_ILLbasis_tableau_row (
03022   dbl_lpinfo * lp,
03023   int row,
03024   double * brow,
03025   double * trow,
03026   double * rhs,
03027   int strict),
03028   dbl_ILLbasis_factor (
03029   dbl_lpinfo * lp,
03030   int *singular),
03031   dbl_ILLbasis_refactor (
03032   dbl_lpinfo * lp),
03033   dbl_ILLbasis_update (
03034   dbl_lpinfo * lp,
03035   dbl_svector * y,
03036   int lindex,
03037   int *refactor,
03038   int *singular);
03039 
03040 void dbl_ILLbasis_column_solve (
03041   dbl_lpinfo * lp,
03042   dbl_svector * rhs,
03043   dbl_svector * soln),
03044   dbl_ILLbasis_column_solve_update (
03045   dbl_lpinfo * lp,
03046   dbl_svector * rhs,
03047   dbl_svector * upd,
03048   dbl_svector * soln),
03049   dbl_ILLbasis_row_solve (
03050   dbl_lpinfo * lp,
03051   dbl_svector * rhs,
03052   dbl_svector * soln),
03053   dbl_ILLbasis_free_basisinfo (
03054   dbl_lpinfo * lp),
03055   dbl_ILLbasis_free_fbasisinfo (
03056   dbl_lpinfo * lp),
03057   dbl_ILLbasis_init_basisinfo (
03058   dbl_lpinfo * lp);
03059 
03060 #endif /* dbl___BASIS_H */
03061 /****************************************************************************/
03062 /*                                                                          */
03063 /*  This file is part of QSopt_ex.                                          */
03064 /*                                                                          */
03065 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
03066 /*  and Daniel Espinoza                                                     */
03067 /*                                                                          */
03068 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
03069 /*  copyright in QSopt.                                                     */
03070 /*                                                                          */
03071 /*  This code may be used under the terms of the GNU General Public License */
03072 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
03073 /*                                                                          */
03074 /*  Alternatively, use is granted for research purposes only.               */
03075 /*                                                                          */
03076 /*  It is your choice of which of these two licenses you are operating      */
03077 /*  under.                                                                  */
03078 /*                                                                          */
03079 /*  We make no guarantees about the correctness or usefulness of this code. */
03080 /*                                                                          */
03081 /****************************************************************************/
03082 
03083 #ifndef dbl___DHEAPS_I_H__
03084 #define dbl___DHEAPS_I_H__
03085 /****************************************************************************/
03086 /*                                                                          */
03087 /*                             dbl_dheaps_i.c                                   */
03088 /*                                                                          */
03089 /****************************************************************************/
03090 
03091 typedef struct dbl_ILLdheap
03092 {
03093   double *key;
03094   int *entry;
03095   int *loc;
03096   int total_space;
03097   int size;
03098 }
03099 dbl_ILLdheap;
03100 
03101 void dbl_ILLutil_dheap_free (
03102   dbl_ILLdheap * h),
03103   dbl_ILLutil_dheap_delete (
03104   dbl_ILLdheap * h,
03105   int i),
03106   dbl_ILLutil_dheap_changekey (
03107   dbl_ILLdheap * h,
03108   int i,
03109   double * newkey),
03110   dbl_ILLutil_dheap_findmin (
03111   dbl_ILLdheap * h,
03112   int *i),
03113   dbl_ILLutil_dheap_deletemin (
03114   dbl_ILLdheap * h,
03115   int *i);
03116 
03117 int dbl_ILLutil_dheap_init (
03118   dbl_ILLdheap * h,
03119   int k),
03120   dbl_ILLutil_dheap_resize (
03121   dbl_ILLdheap * h,
03122   int newsize),
03123   dbl_ILLutil_dheap_insert (
03124   dbl_ILLdheap * h,
03125   int i);
03126 
03127 
03128 
03129 #endif
03130 /****************************************************************************/
03131 /*                                                                          */
03132 /*  This file is part of QSopt_ex.                                          */
03133 /*                                                                          */
03134 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
03135 /*  and Daniel Espinoza                                                     */
03136 /*                                                                          */
03137 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
03138 /*  copyright in QSopt.                                                     */
03139 /*                                                                          */
03140 /*  This code may be used under the terms of the GNU General Public License */
03141 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
03142 /*                                                                          */
03143 /*  Alternatively, use is granted for research purposes only.               */
03144 /*                                                                          */
03145 /*  It is your choice of which of these two licenses you are operating      */
03146 /*  under.                                                                  */
03147 /*                                                                          */
03148 /*  We make no guarantees about the correctness or usefulness of this code. */
03149 /*                                                                          */
03150 /****************************************************************************/
03151 
03152 /*  $RCSfile: dbl_qsopt.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
03153 #ifndef dbl___QS_QSOPT_H
03154 #define dbl___QS_QSOPT_H
03155 
03156 
03157 #ifdef WIN32
03158 
03159 #ifdef QSLIB_EXPORTS
03160 #define dbl_QSLIB_INTERFACE __declspec(dllexport)
03161 #else
03162 #define dbl_QSLIB_INTERFACE __declspec(dllimport)
03163 #endif
03164 
03165 #else
03166 #define dbl_QSLIB_INTERFACE extern
03167 #endif
03168 
03169 #ifdef WIN32
03170 typedef struct dbl_QSLIB_INTERFACE dbl_qsdata *dbl_QSprob;
03171 typedef struct dbl_QSLIB_INTERFACE qsbasis *dbl_QSbas;
03172 #else
03173 typedef struct dbl_qsdata *dbl_QSprob;
03174 typedef struct qsbasis *dbl_QSbas;
03175 #endif
03176 
03177 /****************************************************************************/
03178 /*                                                                          */
03179 /*                 PARAMETERS TO SPECIFY OBJECTIVE SENSE                    */
03180 /*                                                                          */
03181 /****************************************************************************/
03182 /*
03183 #define QS_LP_PRIMAL_FEASIBLE   11
03184 #define QS_LP_PRIMAL_INFEASIBLE 12
03185 #define QS_LP_PRIMAL_UNBOUNDED  13
03186 #define QS_LP_DUAL_FEASIBLE     14
03187 #define QS_LP_DUAL_INFEASIBLE   15
03188 #define QS_LP_DUAL_UNBOUNDED    16
03189 */
03190 
03191 /****************************************************************************/
03192 /*                                                                          */
03193 /*                      QSopt Library Functions                             */
03194 /*                                                                          */
03195 /****************************************************************************/
03196 #ifdef  __cplusplus
03197 extern "C"
03198 {
03199 #endif
03200 
03201 #ifdef WIN32
03202 /* 
03203  *  in WINDOWS we make 
03204  *     dbl_solver_main/dbl_reader_main part of DLL
03205  */
03206 dbl_QSLIB_INTERFACE int dbl_solver_main ( int argc, char **argv);
03207 dbl_QSLIB_INTERFACE int dbl_reader_main ( int argc, char **argv);
03208 #endif
03209 
03210 dbl_QSLIB_INTERFACE void dbl_QSfree ( void *ptr),
03211     dbl_QSfree_prob ( dbl_QSprob p),
03212     dbl_QSfree_basis ( dbl_QSbas B),
03213     dbl_QSset_precision ( const unsigned prec),/**< set the dbl_precision for floating 
03214                                                  point numbers to the given 
03215                                                  number of bits */
03216     dbl_QSstart ( void),/**< whe we use non native numbers, we need to make 
03217                          some initializations before operating with the
03218                          library */
03219     dbl_QSend ( void);  /**< just to free any internal static data needed by
03220                          the variable dbl_precision numbers */
03221 
03222 dbl_QSLIB_INTERFACE int dbl_QSopt_primal ( dbl_QSprob p, int *status),
03223     dbl_QSopt_dual ( dbl_QSprob p, int *status),
03224     dbl_QSopt_pivotin_col ( dbl_QSprob p, int ccnt, int *clist),
03225     dbl_QSopt_pivotin_row ( dbl_QSprob p, int rcnt, int *rlist),
03226     dbl_QSopt_strongbranch ( dbl_QSprob p, int ncand, int *candidatelist,
03227       double * xlist, double * down_vals, double * up_vals,
03228       int iterations, double objbound),
03229     dbl_QSchange_objsense ( dbl_QSprob p, int newsense),
03230     dbl_QSget_objsense ( dbl_QSprob p, int *newsense),
03231     dbl_QSnew_col ( dbl_QSprob p,const double obj,const double lower,const double upper,
03232       const char *name),
03233     dbl_QSadd_cols ( dbl_QSprob p, int num, int *cmatcnt, int *cmatbeg, int *cmatind,
03234       double * cmatval, double * obj, double * lower,
03235       double * upper, const char **names),
03236     dbl_QSadd_col ( dbl_QSprob p, int cnt, int *cmatind, double * cmatval,
03237       double obj, double lower, double upper, const char *name),
03238     dbl_QSnew_row ( dbl_QSprob p,const double rhs, int sense, const char *name),
03239     dbl_QSadd_ranged_rows ( dbl_QSprob p, int num, int *rmatcnt, int *rmatbeg, 
03240       int *rmatind,const double * rmatval,const double * rhs, char *sense,
03241       const double* range, const char **names),
03242     dbl_QSadd_ranged_row ( dbl_QSprob p, int cnt, int *rmatind,const double * rmatval,
03243       const double * rhs, int sense,const double * range, const char *name),
03244     dbl_QSadd_rows ( dbl_QSprob p, int num, int *rmatcnt, int *rmatbeg, int *rmatind,
03245       const double * rmatval,const double * rhs, char *sense, const char **names),
03246     dbl_QSadd_row ( dbl_QSprob p, int cnt, int *rmatind,const double * rmatval,
03247       const double * rhs, int sense, const char *name),
03248     dbl_QSdelete_rows ( dbl_QSprob p, int num, int *dellist),
03249     dbl_QSdelete_row ( dbl_QSprob p, int rowindex),
03250     dbl_QSdelete_setrows ( dbl_QSprob p, int *flags),
03251     dbl_QSdelete_named_row ( dbl_QSprob p, const char *rowname),
03252     dbl_QSdelete_named_rows_list ( dbl_QSprob p, int num, const char **rownames),
03253     dbl_QSdelete_cols ( dbl_QSprob p, int num, int *dellist),
03254     dbl_QSdelete_col ( dbl_QSprob p, int colindex),
03255     dbl_QSdelete_setcols ( dbl_QSprob p, int *flags),
03256     dbl_QSdelete_named_column ( dbl_QSprob p, const char *colname),
03257     dbl_QSdelete_named_columns_list ( dbl_QSprob p, int num, const char **colnames),
03258     dbl_QSchange_senses ( dbl_QSprob p, int num, int *rowlist, char *sense),
03259     dbl_QSchange_sense ( dbl_QSprob p, int rowindex, int sense),
03260     dbl_QSchange_coef ( dbl_QSprob p, int rowindex, int colindex, double coef),
03261     dbl_QSchange_objcoef ( dbl_QSprob p, int indx, double coef),
03262     dbl_QSchange_rhscoef ( dbl_QSprob p, int indx, double coef),
03263     dbl_QSchange_range(dbl_QSprob p, int rowindex, double range),
03264     dbl_QSchange_bounds ( dbl_QSprob p, int num, int *collist, char *lu, 
03265       const double * bounds),
03266     dbl_QSchange_bound ( dbl_QSprob p, int indx, int lu,const double bound),
03267     dbl_QSload_basis ( dbl_QSprob p, dbl_QSbas B),
03268     dbl_QSread_and_load_basis ( dbl_QSprob p, const char *filename),
03269     dbl_QSload_basis_array ( dbl_QSprob p, char *cstat, char *rstat),
03270     dbl_QSload_basis_and_row_norms_array ( dbl_QSprob p, char *cstat, char *rstat, 
03271       double * rownorms),
03272     dbl_QSget_basis_array ( dbl_QSprob p, char *cstat, char *rstat),
03273     dbl_QSget_basis_and_row_norms_array ( dbl_QSprob p, char *cstat, char *rstat,
03274       double * rownorms),
03275     dbl_QSget_binv_row ( dbl_QSprob p, int indx, double * binvrow),
03276     dbl_QSget_tableau_row ( dbl_QSprob p, int indx, double * tableaurow),
03277     dbl_QSget_basis_order ( dbl_QSprob p, int *basorder), 
03278     dbl_QSget_coef (dbl_QSprob p, int rowindex, int colindex, double*coef),
03279     dbl_QSget_status ( dbl_QSprob p, int *status),
03280     dbl_QSget_solution ( dbl_QSprob p, double * value, double * x,
03281       double * pi, double * slack, double * rc),
03282     dbl_QSget_objval ( dbl_QSprob p, double * value),
03283     dbl_QSget_pi_array ( dbl_QSprob p, double * pi),
03284     dbl_QSget_rc_array ( dbl_QSprob p, double * rc),
03285     dbl_QSget_x_array ( dbl_QSprob p, double * x),
03286     dbl_QSget_slack_array ( dbl_QSprob p, double * slack),
03287     dbl_QSget_infeas_array ( dbl_QSprob p, double * pi),
03288     dbl_QSget_colcount ( dbl_QSprob p),
03289     dbl_QSget_rowcount ( dbl_QSprob p),
03290     dbl_QSget_nzcount ( dbl_QSprob p),
03291     dbl_QSget_obj_list(dbl_QSprob p, int num, int*collist, double*obj),
03292     dbl_QSget_obj ( dbl_QSprob p, double * obj),
03293     dbl_QSget_rhs ( dbl_QSprob p, double * rhs),
03294     dbl_QSget_ranged_rows_list ( dbl_QSprob p, int num, int *rowlist, int **rowcnt,
03295       int **rowbeg, int **rowind, double ** rowval, double ** rhs,
03296       char **sense, double **range, char ***names),
03297     dbl_QSget_ranged_rows ( dbl_QSprob p, int **rowcnt, int **rowbeg, int **rowind,
03298       double ** rowval, double ** rhs, char **sense, 
03299       double ** range, char ***names),
03300     dbl_QSget_senses ( dbl_QSprob p, char*senses),
03301     dbl_QSget_rows_list ( dbl_QSprob p, int num, int *rowlist, int **rowcnt,
03302       int **rowbeg, int **rowind, double ** rowval, double ** rhs,
03303       char **sense, char ***names),
03304     dbl_QSget_rows ( dbl_QSprob p, int **rowcnt, int **rowbeg, int **rowind,
03305       double ** rowval, double ** rhs, char **sense, char ***names),
03306     dbl_QSget_columns_list ( dbl_QSprob p, int num, int *collist, int **colcnt,
03307       int **colbeg, int **colind, double ** colval, double ** obj,
03308       double ** lower, double ** upper, char ***names),
03309     dbl_QSget_columns ( dbl_QSprob p, int **colcnt, int **colbeg, int **colind,
03310       double ** colval, double ** obj, double ** lower,
03311       double ** upper, char ***names),
03312     dbl_QSget_rownames ( dbl_QSprob p, char **rownames),
03313     dbl_QSget_colnames ( dbl_QSprob p, char **colnames),
03314     dbl_QSget_bound ( dbl_QSprob p, int colindex, int lu, double * bound),
03315     dbl_QSget_bounds ( dbl_QSprob p, double * lower, double * upper),
03316     dbl_QSget_bounds_list(dbl_QSprob p, int num, int*collist, double*lb,
03317       double*ub),
03318     dbl_QSget_intflags ( dbl_QSprob p, int *intflags),
03319     dbl_QSget_intcount ( dbl_QSprob p, int *count),
03320     dbl_QSget_column_index ( dbl_QSprob p, const char *name, int *colindex),
03321     dbl_QSget_row_index ( dbl_QSprob p, const char *name, int *rowindex),
03322     dbl_QSget_named_x ( dbl_QSprob p, const char *colname, double * val),
03323     dbl_QSget_named_rc ( dbl_QSprob p, const char *colname, double * val),
03324     dbl_QSget_named_pi ( dbl_QSprob p, const char *rowname, double * val),
03325     dbl_QSget_named_slack ( dbl_QSprob p, const char *rowname, double * val),
03326     dbl_QScompute_row_norms ( dbl_QSprob p),
03327     dbl_QSwrite_prob ( dbl_QSprob p, const char *filename, const char *filetype),
03328     dbl_QSwrite_prob_file ( dbl_QSprob p, FILE * file, const char *filetype),
03329     dbl_QSwrite_basis ( dbl_QSprob p, dbl_QSbas B, const char *filename),
03330     dbl_QStest_row_norms ( dbl_QSprob p),
03331     dbl_QSget_itcnt(dbl_QSprob p, int *pI_iter, int *pII_iter, int *dI_iter,
03332       int *dII_iter, int *tot_iter),
03333     dbl_QSset_param ( dbl_QSprob p, int whichparam, int newvalue),
03334     dbl_QSset_param_EGlpNum ( dbl_QSprob p, int whichparam, double newvalue),
03335     dbl_QSget_param ( dbl_QSprob p, int whichparam, int *value),
03336     dbl_QSget_param_EGlpNum ( dbl_QSprob p, int whichparam, double * value); 
03337 
03338 dbl_QSLIB_INTERFACE char *dbl_QSget_probname ( dbl_QSprob p);
03339 dbl_QSLIB_INTERFACE char *dbl_QSget_objname ( dbl_QSprob p);
03340 dbl_QSLIB_INTERFACE char *dbl_QSversion ( void);
03341 
03342 dbl_QSLIB_INTERFACE dbl_QSprob dbl_QScreate_prob ( const char *name, int objsense),
03343     dbl_QSread_prob ( const char *filename, const char *filetype),
03344     dbl_QSload_prob ( const char *probname, int ncols, int nrows, int *cmatcnt,
03345       int *cmatbeg, int *cmatind, double * cmatval, int objsense,
03346       double * obj, double * rhs, char *sense, double * lower,
03347       double * upper, const char **colnames, const char **rownames),
03348     dbl_QScopy_prob ( dbl_QSprob p, const char *newname);
03349 
03350 dbl_QSLIB_INTERFACE dbl_QSbas dbl_QSget_basis ( dbl_QSprob p),
03351     dbl_QSread_basis ( dbl_QSprob p, const char *filename);
03352 
03353 #ifdef  __cplusplus
03354 }
03355 #endif
03356 
03357 /****************************************************************************
03358  *
03359  * This is the undocumented part of the QSlib interface 
03360  *
03361  ****************************************************************************/
03362 /* 
03363  * functions to facilitate line by line reading from other sources than 
03364  * files from within MPS/LP parsers  
03365  * 
03366  * functions to facilitate the collection of error information instead of 
03367  * having the parsers print messages to stderr
03368  *                              by mps/lp format writers
03369  * 
03370  * a problem's reporter is used by the solver code to provide important 
03371  * dbl_feedback/progress information
03372  */
03373 
03374 #ifdef WIN32
03375 typedef struct dbl_QSLIB_INTERFACE dbl_qsline_reader *dbl_QSline_reader;
03376 typedef struct dbl_QSLIB_INTERFACE dbl_qsformat_error *dbl_QSformat_error;
03377 typedef struct dbl_QSLIB_INTERFACE dbl_qserror_collector *dbl_QSerror_collector;
03378 typedef struct dbl_QSLIB_INTERFACE dbl_qserror_memory *dbl_QSerror_memory;
03379 #else
03380 typedef struct dbl_qsline_reader *dbl_QSline_reader;
03381 typedef struct dbl_qsformat_error *dbl_QSformat_error;
03382 typedef struct dbl_qserror_collector *dbl_QSerror_collector;
03383 typedef struct dbl_qserror_memory *dbl_QSerror_memory;
03384 #endif
03385 
03386 #ifdef  __cplusplus
03387 extern "C"
03388 {
03389 #endif
03390   dbl_QSLIB_INTERFACE const char *dbl_QSformat_error_type_string (
03391   int tp);
03392 
03393   dbl_QSLIB_INTERFACE int dbl_QSerror_get_type (
03394   dbl_QSformat_error error);
03395   dbl_QSLIB_INTERFACE const char *dbl_QSerror_get_desc (
03396   dbl_QSformat_error error);
03397   dbl_QSLIB_INTERFACE int dbl_QSerror_get_line_number (
03398   dbl_QSformat_error error);
03399   dbl_QSLIB_INTERFACE int dbl_QSerror_get_pos (
03400   dbl_QSformat_error error);
03401   dbl_QSLIB_INTERFACE const char *dbl_QSerror_get_line (
03402   dbl_QSformat_error error);
03403   dbl_QSLIB_INTERFACE void dbl_QSerror_print (
03404   FILE * f,
03405   dbl_QSformat_error error);
03406 
03407   dbl_QSLIB_INTERFACE dbl_QSerror_collector dbl_QSerror_collector_new (
03408   void *fct,
03409   void *dest);
03410   dbl_QSLIB_INTERFACE dbl_QSerror_collector dbl_QSerror_memory_collector_new (
03411   dbl_QSerror_memory mem);
03412   dbl_QSLIB_INTERFACE void dbl_QSerror_collector_free (
03413   dbl_QSerror_collector c);
03414 
03415 /****************************************************************************
03416  * line reader 
03417  */
03418   dbl_QSLIB_INTERFACE dbl_QSline_reader dbl_QSline_reader_new (
03419   void *fct,
03420   void *data_src);
03421   /* reader->read_line_fct defaults to fgets */
03422 
03423   dbl_QSLIB_INTERFACE void dbl_QSline_reader_free (
03424   dbl_QSline_reader reader);
03425 
03426   dbl_QSLIB_INTERFACE void dbl_QSline_reader_set_error_collector (
03427   dbl_QSline_reader reader,
03428   dbl_QSerror_collector collector);
03429 
03430   dbl_QSLIB_INTERFACE char *dbl_QSline_reader_get (
03431   dbl_QSline_reader reader,
03432   char *s,
03433   int size);
03434 
03435   dbl_QSLIB_INTERFACE dbl_QSprob dbl_QSget_prob (
03436   dbl_QSline_reader reader,
03437   const char *probname,
03438   const char *filetype);
03439   /* the MPS and LP parsers uses the fct from reader 
03440    * to get to next input line */
03441 
03442 
03443 /****************************************************************************
03444  * error memory 
03445  */
03446   dbl_QSLIB_INTERFACE dbl_QSerror_memory dbl_QSerror_memory_create (
03447   int takeErrorLines);
03448   dbl_QSLIB_INTERFACE void dbl_QSerror_memory_free (
03449   dbl_QSerror_memory mem);
03450 
03451   dbl_QSLIB_INTERFACE int dbl_QSerror_memory_get_nof (
03452   dbl_QSerror_memory mem,
03453   int error_type);
03454   dbl_QSLIB_INTERFACE int dbl_QSerror_memory_get_nerrors (
03455   dbl_QSerror_memory mem);
03456 
03457   dbl_QSLIB_INTERFACE dbl_QSformat_error dbl_QSerror_memory_get_last_error (
03458   dbl_QSerror_memory mem);
03459   dbl_QSLIB_INTERFACE dbl_QSformat_error dbl_QSerror_memory_get_prev_error (
03460   dbl_QSformat_error e);
03461 
03462 /**************************************************************************** 
03463  * reporter for solver dbl_feedback 
03464  */
03465   dbl_QSLIB_INTERFACE void dbl_QSset_reporter (
03466   dbl_QSprob prob,
03467   int iterskip,
03468   void *fct,
03469   void *dest);
03470 
03471   dbl_QSLIB_INTERFACE int dbl_QSreport_prob (
03472   dbl_QSprob p,
03473   const char *filetype,
03474   dbl_QSerror_collector c);
03475 
03476 #ifdef  __cplusplus
03477 }
03478 #endif
03479 #endif                          /* dbl___QS_QSOPT_H */
03480 /****************************************************************************/
03481 /*                                                                          */
03482 /*  This file is part of QSopt_ex.                                          */
03483 /*                                                                          */
03484 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
03485 /*  and Daniel Espinoza                                                     */
03486 /*                                                                          */
03487 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
03488 /*  copyright in QSopt.                                                     */
03489 /*                                                                          */
03490 /*  This code may be used under the terms of the GNU General Public License */
03491 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
03492 /*                                                                          */
03493 /*  Alternatively, use is granted for research purposes only.               */
03494 /*                                                                          */
03495 /*  It is your choice of which of these two licenses you are operating      */
03496 /*  under.                                                                  */
03497 /*                                                                          */
03498 /*  We make no guarantees about the correctness or usefulness of this code. */
03499 /*                                                                          */
03500 /****************************************************************************/
03501 
03502 /* RCSINFO $Id: dbl_format.h,v 1.3 2003/11/05 16:59:48 meven Exp $ */
03503 #ifndef dbl_QS_FORMAT_ERROR_H
03504 #define dbl_QS_FORMAT_ERROR_H
03505 
03506 
03507 /****************************************************************************/
03508 /*
03509    The LP/MPS readers, writers, 
03510        dbl_ILLrawlpdata_to_lpdata, and 
03511    use dbl_ILLformat_error to report problems with their input iff
03512        the line reader used in reading the problem  or 
03513        the  dbl_qserror_collector pointer passed to dbl_ILLwrite_lp_file
03514    is not NULL.
03515 
03516    The QSgui code uses this feature to collect dbl_qsformat_error instances 
03517    which it uses after reading is done to insert error messages into the 
03518    input window. 
03519 */
03520 /****************************************************************************/
03521 
03522 /* 
03523 for error type USE: 
03524           QS_DATA_ERROR     
03525           QS_DATA_WARN      
03526           QS_MPS_FORMAT_ERROR   
03527           QS_MPS_FORMAT_WARN    
03528           QS_LP_FORMAT_ERROR    
03529           QS_LP_FORMAT_WARN   
03530           QS_LP_OBJ_WARN      
03531           QS_GENERIC_ERROR    
03532 */
03533 
03534 typedef struct dbl_qsformat_error
03535 {
03536   char *desc;
03537   char *theLine;
03538   struct dbl_qsformat_error *next;
03539   int type;
03540   int lineNumber;               /* 1 based line counting */
03541   int at;
03542 }
03543 dbl_qsformat_error;
03544 
03545 extern int dbl_ILLformat_error_create (
03546   dbl_qsformat_error * error,
03547   int mode,
03548   const char *desc,
03549   int lineNum,
03550   const char *theLine,
03551   int atPos);
03552 extern void dbl_ILLformat_error_delete (
03553   dbl_qsformat_error * error);
03554 
03555 extern void dbl_ILLformat_error_print (
03556   EGioFile_t * out,
03557   dbl_qsformat_error * e);
03558 
03559 
03560 
03561 /*****************************************************************************
03562  * collecting error messages 
03563  * either with defining own qsad_error_fct and corresponding data structure 
03564  * or by using predefined dbl_ILLadd_error_to_memory fct with dbl_qserror_memory
03565  */
03566 
03567 typedef int (
03568   *dbl_qsadd_error_fct) (
03569   void *dest,
03570   const dbl_qsformat_error * error);
03571 
03572 typedef struct dbl_qserror_collector
03573 {
03574   dbl_qsadd_error_fct add_error;
03575   void *dest;
03576 }
03577 dbl_qserror_collector;
03578 
03579 typedef struct dbl_qserror_memory
03580 {
03581   unsigned int nerror;
03582   dbl_qsformat_error *error_list;
03583   char has_error[QS_INPUT_NERROR];
03584   char hasErrorLines;
03585 }
03586 dbl_qserror_memory;
03587 
03588 
03589 extern dbl_qserror_collector *dbl_ILLerror_collector_new (
03590   dbl_qsadd_error_fct fct,
03591   void *dest);
03592 
03593 dbl_qserror_collector *dbl_ILLerror_memory_collector_new (
03594   dbl_qserror_memory * dest);
03595 
03596 extern void dbl_ILLerror_collector_free (
03597   dbl_qserror_collector * c);
03598 
03599 #define dbl_ILLformat_error(collector, error)  \
03600   ((collector)->add_error((collector)->dest, error))
03601 
03602 
03603 extern int dbl_ILLadd_error_to_memory (
03604   void *dest,
03605   const dbl_qsformat_error * error);
03606 
03607 extern dbl_qserror_memory *dbl_ILLerror_memory_create (
03608   int takeErrorLines);
03609 extern void dbl_ILLerror_memory_free (
03610   dbl_qserror_memory * mem);
03611 
03612 #endif
03613 /****************************************************************************/
03614 /*                                                                          */
03615 /*  This file is part of QSopt_ex.                                          */
03616 /*                                                                          */
03617 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
03618 /*  and Daniel Espinoza                                                     */
03619 /*                                                                          */
03620 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
03621 /*  copyright in QSopt.                                                     */
03622 /*                                                                          */
03623 /*  This code may be used under the terms of the GNU General Public License */
03624 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
03625 /*                                                                          */
03626 /*  Alternatively, use is granted for research purposes only.               */
03627 /*                                                                          */
03628 /*  It is your choice of which of these two licenses you are operating      */
03629 /*  under.                                                                  */
03630 /*                                                                          */
03631 /*  We make no guarantees about the correctness or usefulness of this code. */
03632 /*                                                                          */
03633 /****************************************************************************/
03634 
03635 /*  RCS_INFO = "$RCSfile: dbl_rawlp.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $"; */
03636 #ifndef dbl___ILL_RAWLP_H_
03637 #define dbl___ILL_RAWLP_H_
03638 
03639 /****************************************************************************/
03640 /* DataStructure and Routines                                               */
03641 /*          to deal with raw lp information as read from mps or lp files    */
03642 /*          support scanning of input                                       */
03643 /*          error reporting                                                 */
03644 /****************************************************************************/
03645 
03646 
03647 #define dbl_ILL_ISBLANK(p) \
03648              (((*(p))==' '||(*(p))=='\t'||(*(p))=='\r'||(*(p))=='\f') ? 1 : 0)
03649 
03650 /* 
03651  * we rely on ILLsymboltab property:
03652  *   the ith name added can be retrieved by ILLsymboltab_get(table, i) 
03653  *   as long as we never delete names from the symbol table 
03654  */
03655 typedef struct dbl_rawlpdata
03656 {
03657   char *name;
03658 
03659   char *rhsname;
03660   char *rangesname;
03661   char *boundsname;
03662 
03663   int objsense;                 /* maximize or minimize */
03664   int objindex;                 /* index of objective row */
03665 
03666   int nrows;                    /* number of rows in problem */
03667   ILLsymboltab rowtab;          /* ILLsymboltab_get(rowtab, i) name of ith row */
03668 
03669   int sensesize;                /* size of rowsense */
03670   char *rowsense;               /* rowsense[i] snese of row[i] */
03671 
03672   char *rhsind;                 /* rhsind[i] == 1 we saw an rhs for row[i] */
03673   /* size is nrows */
03674   int rhssize;                  /* size of rhs array */
03675   double *rhs;                /* rhs values for rows; size is nrows */
03676   char *rangesind;              /* ranges[i] == 1 we saw a range def for row[i] */
03677   struct dbl_colptr *ranges;        /* list of range values */
03678 
03679   int ncols;                    /* number of cols in problem */
03680   ILLsymboltab coltab;          /* ILLsymboltab_get(coltab, i) name of ith col */
03681   int colsize;                  /* size of cols array */
03682   struct dbl_colptr **cols;
03683 
03684   char *lbind;                  /* lbind[i] == 1  we saw a lower bound for col[i] */
03685   char *ubind;                  /* ubind[i] == 1  we saw a upper bound for col[i] */
03686   double *lower;              /* lower[i] = lower bound for col[i] */
03687   double *upper;              /* upper[i] = upper bound for col[i] */
03688 
03689   int intsize;                  /* size of intmarker array */
03690   char *intmarker;              /* intmarker[i] == 1  col[i] is an int var */
03691 
03692   /* sos information is tranfered into dbl_ILLmatrix lpdata->sos */
03693   char *refrow;                 /* name of reference row */
03694   int refrowind;                /* index of refrow or -1  */
03695 
03696   int is_sos_size;              /* size of is_sos_member array */
03697   int *is_sos_member;           /* for each col contains either               
03698                                  *     -1 == no sos memeber 
03699                                  *     i  == member of set #i */
03700 
03701   int nsos_member;              /* total number of sos set members */
03702   int sos_weight_size;          /* size of sos_weight array */
03703   double *sos_weight;       /* sos set elem i has weight of sos_weight[i] 
03704                                  * value comes from refrow coeficients */
03705   int sos_col_size;             /* size of sos_col array */
03706   int *sos_col;                 /* sos elem i is column sos_col[i] */
03707 
03708   int nsos;                     /* number of sos sets */
03709   int sos_setsize;              /* size of sosset array */
03710   struct dbl_sosptr *sos_set;       /* type, size, first element of sos sets 
03711                                  * first is index into sos_weight and sos_col 
03712                                  * arrays */
03713   dbl_qserror_collector *error_collector;
03714   ILLptrworld ptrworld;
03715 }
03716 dbl_rawlpdata;
03717 
03718 typedef struct dbl_colptr
03719 {
03720   double coef;
03721   struct dbl_colptr *next;
03722   int this_val;                     /* row index */
03723 }
03724 dbl_colptr;
03725 extern dbl_colptr *dbl_ILLcolptralloc (
03726   ILLptrworld * p);
03727 
03728 typedef struct dbl_sosptr
03729 {
03730   int nelem;                    /* number of set elements */
03731   int first;                    /* index of first set element in sosmemeber */
03732   char type;                    /* set type */
03733 }
03734 dbl_sosptr;
03735 extern const int dbl_ILL_SOS_TYPE1;
03736 extern const int dbl_ILL_SOS_TYPE2;
03737 
03738 extern void dbl_ILLinit_rawlpdata (
03739   dbl_rawlpdata * lp,
03740   dbl_qserror_collector * collector);
03741 extern void dbl_ILLfree_rawlpdata (
03742   dbl_rawlpdata * lp);
03743 extern void dbl_ILLraw_clear_matrix (
03744   dbl_rawlpdata * lp);
03745 
03746 extern const char *dbl_ILLraw_rowname (
03747   dbl_rawlpdata * lp,
03748   int i);
03749 extern const char *dbl_ILLraw_colname (
03750   dbl_rawlpdata * lp,
03751   int i);
03752 
03753 extern int dbl_ILLraw_add_col (
03754   dbl_rawlpdata * lp,
03755   const char *name,
03756   int intmarker);
03757 extern int dbl_ILLraw_add_row (
03758   dbl_rawlpdata * lp,
03759   const char *name,
03760   int sense,
03761   const double rhs);
03762 
03763 extern int dbl_ILLraw_add_col_coef (
03764   dbl_rawlpdata * lp,
03765   int colind,
03766   int rowind,
03767   double coef);
03768 
03769 extern int dbl_ILLraw_init_ranges (
03770   dbl_rawlpdata * lp);
03771 extern int dbl_ILLraw_init_rhs (
03772   dbl_rawlpdata * lp);
03773 
03774 extern int dbl_ILLraw_add_ranges_coef (
03775   dbl_rawlpdata * lp,
03776   int rowind,
03777   double coef);
03778 
03779 
03780 extern int dbl_ILLraw_add_sos (
03781   dbl_rawlpdata * lp,
03782   int sos_type);
03783 
03784                                                 /* add empty set with type */
03785 extern int dbl_ILLraw_add_sos_member (
03786   dbl_rawlpdata * lp,
03787   int colind);
03788 
03789                                                 /* add col to last set */
03790 extern int dbl_ILLraw_is_mem_other_sos (
03791   dbl_rawlpdata * lp,
03792   int colind);
03793 
03794 extern int dbl_ILLraw_set_rhs_name (
03795   dbl_rawlpdata * lp,
03796   const char *name,
03797   int *skip);
03798 extern int dbl_ILLraw_set_bounds_name (
03799   dbl_rawlpdata * lp,
03800   const char *name,
03801   int *skip);
03802 extern int dbl_ILLraw_set_ranges_name (
03803   dbl_rawlpdata * lp,
03804   const char *name,
03805   int *skip);
03806 extern void dbl_ILLprint_rawlpdata (
03807   dbl_rawlpdata * lp);
03808 
03809 extern char *dbl_ILLraw_unique_name (
03810   ILLsymboltab * tab,
03811   char *prefix,
03812   int i);
03813 extern int dbl_ILLraw_fill_in_rownames (
03814   dbl_rawlpdata * lp);
03815 
03816 extern int dbl_ILLraw_init_bounds (
03817   dbl_rawlpdata * lp);
03818 
03819 extern const char *dbl_ILLraw_set_lowerBound (
03820   dbl_rawlpdata * lp,
03821   int i,
03822   double bnd);
03823 extern const char *dbl_ILLraw_set_upperBound (
03824   dbl_rawlpdata * lp,
03825   int i,
03826   double bnd);
03827 extern const char *dbl_ILLraw_set_fixedBound (
03828   dbl_rawlpdata * lp,
03829   int i,
03830   double bnd);
03831 extern const char *dbl_ILLraw_set_binaryBound (
03832   dbl_rawlpdata * lp,
03833   int i);
03834 extern const char *dbl_ILLraw_set_unbound (
03835   dbl_rawlpdata * lp,
03836   int colind);
03837 extern int dbl_ILLraw_fill_in_bounds (
03838   dbl_rawlpdata * lp);
03839 
03840 extern int dbl_ILLraw_first_nondefault_bound (
03841   dbl_ILLlpdata * lp);
03842 extern int dbl_ILLraw_default_lower (
03843   dbl_ILLlpdata * lp,
03844   int i);
03845 extern int dbl_ILLraw_default_upper (
03846   dbl_ILLlpdata * lp,
03847   int i,
03848   int ri);
03849 
03850 extern int dbl_ILLrawlpdata_to_lpdata (
03851   dbl_rawlpdata * raw,
03852   dbl_ILLlpdata * lp);
03853 
03854 extern int dbl_ILLdata_error (
03855   dbl_qserror_collector * collector,
03856   const char *format,
03857   ...);
03858 extern void dbl_ILLdata_warn (
03859   dbl_qserror_collector * collector,
03860   const char *format,
03861   ...);
03862 
03863 #endif
03864 /****************************************************************************/
03865 /*                                                                          */
03866 /*  This file is part of QSopt_ex.                                          */
03867 /*                                                                          */
03868 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
03869 /*  and Daniel Espinoza                                                     */
03870 /*                                                                          */
03871 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
03872 /*  copyright in QSopt.                                                     */
03873 /*                                                                          */
03874 /*  This code may be used under the terms of the GNU General Public License */
03875 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
03876 /*                                                                          */
03877 /*  Alternatively, use is granted for research purposes only.               */
03878 /*                                                                          */
03879 /*  It is your choice of which of these two licenses you are operating      */
03880 /*  under.                                                                  */
03881 /*                                                                          */
03882 /*  We make no guarantees about the correctness or usefulness of this code. */
03883 /*                                                                          */
03884 /****************************************************************************/
03885 
03886 /* RCSINFO $Id: dbl_mps.h,v 1.2 2003/11/05 16:57:39 meven Exp $ */
03887 #ifndef dbl_MPS_H
03888 #define dbl_MPS_H
03889 
03890 
03891 /****************************************************************************/
03892 /*                                                                          */
03893 /*              Routines to support Reading and Writing MPS Files           */
03894 /*                                                                          */
03895 /****************************************************************************/
03896 extern const char *dbl_ILLmps_section_name[ILL_MPS_N_SECTIONS + 2];
03897 
03898 
03899 extern int dbl_ILLread_mps (
03900   dbl_qsline_reader * file,
03901   const char *filename,
03902   dbl_rawlpdata * lp);
03903 
03904 extern int dbl_ILLwrite_mps (
03905   dbl_ILLlpdata * lp,
03906   dbl_qserror_collector * collector);
03907 
03908         /* use lp->reporter for output */
03909 
03910 #endif
03911 /****************************************************************************/
03912 /*                                                                          */
03913 /*  This file is part of QSopt_ex.                                          */
03914 /*                                                                          */
03915 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
03916 /*  and Daniel Espinoza                                                     */
03917 /*                                                                          */
03918 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
03919 /*  copyright in QSopt.                                                     */
03920 /*                                                                          */
03921 /*  This code may be used under the terms of the GNU General Public License */
03922 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
03923 /*                                                                          */
03924 /*  Alternatively, use is granted for research purposes only.               */
03925 /*                                                                          */
03926 /*  It is your choice of which of these two licenses you are operating      */
03927 /*  under.                                                                  */
03928 /*                                                                          */
03929 /*  We make no guarantees about the correctness or usefulness of this code. */
03930 /*                                                                          */
03931 /****************************************************************************/
03932 
03933 /*  $RCSfile: dbl_price.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
03934 #ifndef dbl___PRICE_H
03935 #define dbl___PRICE_H
03936 
03937 
03938 typedef struct dbl_price_res
03939 {
03940   int eindex;
03941   int dir;
03942   int lindex;
03943   int lvstat;
03944   int price_stat;
03945   double dinfeas;
03946   double pinfeas;
03947 }
03948 dbl_price_res;
03949 
03950 int dbl_ILLprice_test_for_heap (
03951   dbl_lpinfo * const lp,
03952   dbl_price_info * const pinf,
03953   int const nkeys,
03954   double * keylist,
03955   int const algo,
03956   int const upd),
03957   dbl_ILLprice_build_heap (
03958   dbl_price_info * const pinf,
03959   int const nkeys,
03960   double * keylist),
03961   dbl_ILLprice_build_pricing_info (
03962   dbl_lpinfo * const lp,
03963   dbl_price_info * const pinf,
03964   int const phase),
03965   dbl_ILLprice_update_pricing_info (
03966   dbl_lpinfo * const lp,
03967   dbl_price_info * const pinf,
03968   int const phase,
03969   dbl_svector * const wz,
03970   int const eindex,
03971   int const lindex,
03972   double y),
03973   dbl_ILLprice_get_price (
03974   dbl_price_info * const p,
03975   int const phase),
03976   dbl_ILLprice_build_mpartial_info (
03977   dbl_lpinfo * const lp,
03978   dbl_price_info * const pinf,
03979   int const pricetype),
03980   dbl_ILLprice_build_pdevex_norms (
03981   dbl_lpinfo * const lp,
03982   dbl_p_devex_info * const pdinfo,
03983   int const reinit),
03984   dbl_ILLprice_update_pdevex_norms (
03985   dbl_lpinfo * const lp,
03986   dbl_p_devex_info * const pdinfo,
03987   int const eindex,
03988   double yl),
03989   dbl_ILLprice_build_psteep_norms (
03990   dbl_lpinfo * const lp,
03991   dbl_p_steep_info * const psinfo),
03992   dbl_ILLprice_build_ddevex_norms (
03993   dbl_lpinfo * const lp,
03994   dbl_d_devex_info * const ddinfo,
03995   int const reinit),
03996   dbl_ILLprice_update_ddevex_norms (
03997   dbl_lpinfo * const lp,
03998   dbl_d_devex_info * const ddinfo,
03999   int const eindex,
04000   double yl),
04001   dbl_ILLprice_build_dsteep_norms (
04002   dbl_lpinfo * const lp,
04003   dbl_d_steep_info * const dsinfo),
04004   dbl_ILLprice_get_dsteep_norms (
04005   dbl_lpinfo * const lp,
04006   int const count,
04007   int *constrowind,
04008   double * const norms),
04009   dbl_ILLprice_get_rownorms (
04010   dbl_lpinfo * const lp,
04011   dbl_price_info * const pinf,
04012   double * const rnorms),
04013   dbl_ILLprice_get_colnorms (
04014   dbl_lpinfo * const lp,
04015   dbl_price_info * const pinf,
04016   double * const cnorms),
04017   dbl_ILLprice_get_newnorms (
04018   dbl_lpinfo * const lp,
04019   int const nelems,
04020   double * const norms,
04021   int *const matcnt,
04022   int *const matbeg,
04023   int *const matind,
04024   double * const matval,
04025   int const option),
04026   dbl_ILLprice_get_new_rownorms (
04027   dbl_lpinfo * const lp,
04028   int const newrows,
04029   double * const rnorms,
04030   int *const rmatcnt,
04031   int *const rmatbeg,
04032   int *const rmatind,
04033   double * const rmatval),
04034   dbl_ILLprice_get_new_colnorms (
04035   dbl_lpinfo * const lp,
04036   int const newrows,
04037   double * const rnorms,
04038   int *const matcnt,
04039   int *const matbeg,
04040   int *const matind,
04041   double * const matval),
04042   dbl_ILLprice_load_rownorms (
04043   dbl_lpinfo * const lp,
04044   double * const rnorms,
04045   dbl_price_info * const pinf),
04046   dbl_ILLprice_load_colnorms (
04047   dbl_lpinfo * const lp,
04048   double * const cnorms,
04049   dbl_price_info * const pinf);
04050 
04051 
04052 void dbl_ILLprice_free_heap (
04053   dbl_price_info * const pinf),
04054   dbl_ILLprice_init_pricing_info (
04055   dbl_price_info * const pinf),
04056   dbl_ILLprice_free_pricing_info (
04057   dbl_price_info * const pinf),
04058   dbl_ILLprice_free_mpartial_info (
04059   dbl_mpart_info * p),
04060   dbl_ILLprice_init_mpartial_price (
04061   dbl_lpinfo * const lp,
04062   dbl_price_info * const pinf,
04063   int const phase,
04064   int const pricetype),
04065   dbl_ILLprice_update_mpartial_price (
04066   dbl_lpinfo * const lp,
04067   dbl_price_info * const pinf,
04068   int const phase,
04069   int const pricetype),
04070   dbl_ILLprice_delete_onempart_price (
04071   /*dbl_lpinfo * const lp,*/
04072   dbl_price_info * const pinf,
04073   int const indx,
04074   int const pricetype),
04075   dbl_ILLprice_mpartial_group (
04076   dbl_lpinfo * const lp,
04077   dbl_mpart_info * const p,
04078   int const phase,
04079   int const g,
04080   int const pricetype),
04081   dbl_ILLprice_column (
04082   dbl_lpinfo * const lp,
04083   int const ix,
04084   int const phase,
04085   dbl_price_res * const pr),
04086   dbl_ILLprice_row (
04087   dbl_lpinfo * const lp,
04088   int const ix,
04089   int const phase,
04090   dbl_price_res * const pr),
04091   dbl_ILLprice_update_psteep_norms (
04092   dbl_lpinfo * lp,
04093   dbl_p_steep_info * psinfo,
04094   dbl_svector * wz,
04095   int eindex,
04096   double yl),
04097   dbl_ILLprice_update_dsteep_norms (
04098   dbl_lpinfo * const lp,
04099   dbl_d_steep_info * const dsinfo,
04100   dbl_svector * const wz,
04101   int const lindex,
04102   double yl),
04103   dbl_ILLprice_compute_dual_inf (
04104   dbl_lpinfo * const lp,
04105   dbl_price_info * const p,
04106   int *const ix,
04107   int const icnt,
04108   int const phase),
04109   dbl_ILLprice_primal (
04110   dbl_lpinfo * const lp,
04111   dbl_price_info * const pinf,
04112   dbl_price_res * const pr,
04113   int const phase),
04114   dbl_ILLprice_compute_primal_inf (
04115   dbl_lpinfo * const lp,
04116   dbl_price_info * const p,
04117   int *const ix,
04118   int const icnt,
04119   int const phase),
04120   dbl_ILLprice_dual (
04121   dbl_lpinfo * const lp,
04122   dbl_price_info * const pinf,
04123   int const phase,
04124   dbl_price_res * const pr);
04125 
04126 void dbl_test_dsteep_norms (
04127   dbl_lpinfo * const lp,
04128   dbl_price_info * const p);
04129 
04130 #endif /* dbl___PRICE_H */
04131 /****************************************************************************/
04132 /*                                                                          */
04133 /*  This file is part of QSopt_ex.                                          */
04134 /*                                                                          */
04135 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04136 /*  and Daniel Espinoza                                                     */
04137 /*                                                                          */
04138 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04139 /*  copyright in QSopt.                                                     */
04140 /*                                                                          */
04141 /*  This code may be used under the terms of the GNU General Public License */
04142 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04143 /*                                                                          */
04144 /*  Alternatively, use is granted for research purposes only.               */
04145 /*                                                                          */
04146 /*  It is your choice of which of these two licenses you are operating      */
04147 /*  under.                                                                  */
04148 /*                                                                          */
04149 /*  We make no guarantees about the correctness or usefulness of this code. */
04150 /*                                                                          */
04151 /****************************************************************************/
04152 
04153 #ifndef dbl___PRIORITY_H__
04154 #define dbl___PRIORITY_H__
04155 /****************************************************************************/
04156 /*                                                                          */
04157 /*                             dbl_priority.c                                   */
04158 /*                                                                          */
04159 /****************************************************************************/
04160 
04161 typedef struct dbl_ILLpriority
04162 {
04163   dbl_ILLdheap dbl_heap;
04164   union dbl_ILLpri_data
04165   {
04166     void *data;
04167     int next;
04168   }
04169    *pri_info;
04170   int space;
04171   int freelist;
04172 }
04173 dbl_ILLpriority;
04174 
04175 void dbl_ILLutil_priority_free (
04176   dbl_ILLpriority * pri),
04177   dbl_ILLutil_priority_delete (
04178   dbl_ILLpriority * pri,
04179   int handle),
04180   dbl_ILLutil_priority_changekey (
04181   dbl_ILLpriority * pri,
04182   int handle,
04183   double * newkey),
04184   dbl_ILLutil_priority_findmin (
04185   dbl_ILLpriority * pri,
04186   double * keyval,
04187   void **en),
04188   dbl_ILLutil_priority_deletemin (
04189   dbl_ILLpriority * pri,
04190   double * keyval,
04191   void **en);
04192 
04193 int dbl_ILLutil_priority_init (
04194   dbl_ILLpriority * pri,
04195   int k),
04196   dbl_ILLutil_priority_insert (
04197   dbl_ILLpriority * pri,
04198   void *data,
04199   double * keyval,
04200   int *handle);
04201 
04202 
04203 
04204 #endif
04205 /****************************************************************************/
04206 /*                                                                          */
04207 /*  This file is part of QSopt_ex.                                          */
04208 /*                                                                          */
04209 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04210 /*  and Daniel Espinoza                                                     */
04211 /*                                                                          */
04212 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04213 /*  copyright in QSopt.                                                     */
04214 /*                                                                          */
04215 /*  This code may be used under the terms of the GNU General Public License */
04216 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04217 /*                                                                          */
04218 /*  Alternatively, use is granted for research purposes only.               */
04219 /*                                                                          */
04220 /*  It is your choice of which of these two licenses you are operating      */
04221 /*  under.                                                                  */
04222 /*                                                                          */
04223 /*  We make no guarantees about the correctness or usefulness of this code. */
04224 /*                                                                          */
04225 /****************************************************************************/
04226 
04227 /*  $RCSfile: dbl_ratio.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
04228 #ifndef dbl___RATIO_H
04229 #define dbl___RATIO_H
04230 typedef struct dbl_ratio_res
04231 {
04232   double tz;
04233   int eindex;
04234   int lindex;
04235   int lvstat;
04236   int ratio_stat;
04237   int boundch;
04238   int coeffch;
04239   double lbound;
04240   double ecoeff;
04241   double pivotval;
04242 }
04243 dbl_ratio_res;
04244 
04245 void dbl_ILLratio_pI_test (
04246   dbl_lpinfo * const lp,
04247   int const eindex,
04248   int const dir,
04249   dbl_ratio_res * const rs),
04250   dbl_ILLratio_pII_test (
04251   dbl_lpinfo * const lp,
04252   int const eindex,
04253   int const dir,
04254   dbl_ratio_res * const rs),
04255   dbl_ILLratio_dI_test (
04256   dbl_lpinfo * const lp,
04257   int const lindex,
04258   int const lvstat,
04259   dbl_ratio_res * const rs),
04260   dbl_ILLratio_dII_test (
04261   dbl_lpinfo * const lp,
04262   /*int const lindex,*/
04263   int const lvstat,
04264   dbl_ratio_res * const rs),
04265   dbl_ILLratio_longdII_test (
04266   dbl_lpinfo * const lp,
04267   int const lindex,
04268   int const lvstat,
04269   dbl_ratio_res * const rs),
04270   dbl_ILLratio_pivotin_test (
04271   dbl_lpinfo * const lp,
04272   int *const rlist,
04273   int const rcnt,
04274   dbl_ratio_res * const rs);
04275 
04276 #endif /* dbl___RATIO_H */
04277 /****************************************************************************/
04278 /*                                                                          */
04279 /*  This file is part of QSopt_ex.                                          */
04280 /*                                                                          */
04281 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04282 /*  and Daniel Espinoza                                                     */
04283 /*                                                                          */
04284 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04285 /*  copyright in QSopt.                                                     */
04286 /*                                                                          */
04287 /*  This code may be used under the terms of the GNU General Public License */
04288 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04289 /*                                                                          */
04290 /*  Alternatively, use is granted for research purposes only.               */
04291 /*                                                                          */
04292 /*  It is your choice of which of these two licenses you are operating      */
04293 /*  under.                                                                  */
04294 /*                                                                          */
04295 /*  We make no guarantees about the correctness or usefulness of this code. */
04296 /*                                                                          */
04297 /****************************************************************************/
04298 
04299 /*  RCS_INFO = "$RCSfile: read_lp_state.h,v $ $Revision: 1.2 $ $Date: 2003/11/05 16:57:39 $"; */
04300 #ifndef dbl_READ_LP_STATE_H
04301 #define dbl_READ_LP_STATE_H
04302 
04303 /****************************************************************************/
04304 /*                                                                          */
04305 /*               Routines to support Reading LP Files                       */
04306 /*                                                                          */
04307 /****************************************************************************/
04308 
04309 /* 
04310  * -) anything after '\' is comment 
04311  * -) variables consist of a-z A-Z 0-9!"#$%(),;.?@_`'{}|~ 
04312  *    don't start with a digit or '.'
04313  */
04314 
04315 
04316 typedef struct dbl_ILLread_lp_state
04317 {
04318   dbl_qsline_reader *file;
04319   const char *file_name;
04320   char *p;
04321   double bound_val;
04322   int dbl_interactive;
04323   int line_num;
04324   int column_index;
04325   char realline[ILL_namebufsize];
04326   char line[ILL_namebufsize];
04327   char field[ILL_namebufsize + 1];
04328   char fieldOnFirstCol;
04329   char eof;
04330   char sense_val;
04331 }
04332 dbl_ILLread_lp_state;
04333 
04334 extern int dbl_ILLread_lp_state_init (
04335   dbl_ILLread_lp_state * state,
04336   dbl_qsline_reader * file,
04337   const char *dbl_fname,
04338   int interactve);
04339 extern int dbl_ILLread_lp_state_next_line (
04340   dbl_ILLread_lp_state * state);
04341 extern int dbl_ILLread_lp_state_next_var (
04342   dbl_ILLread_lp_state * state);
04343 extern int dbl_ILLread_lp_state_keyword (
04344   dbl_ILLread_lp_state * state,
04345   const char **kwd);
04346 extern int dbl_ILLread_lp_state_bad_keyword (
04347   dbl_ILLread_lp_state * state);
04348 extern int dbl_ILLtest_lp_state_keyword (
04349   dbl_ILLread_lp_state * state,
04350   const char *kwd[]);
04351 extern int dbl_ILLread_lp_state_next_field (
04352   dbl_ILLread_lp_state * state);
04353 extern int dbl_ILLread_lp_state_next_field_on_line (
04354   dbl_ILLread_lp_state * state);
04355 extern void dbl_ILLread_lp_state_prev_field (
04356   dbl_ILLread_lp_state * state);
04357 extern int dbl_ILLread_lp_state_sign (
04358   dbl_ILLread_lp_state * state,
04359   double * sign);
04360 extern int dbl_ILLread_lp_state_possible_coef (
04361   dbl_ILLread_lp_state * state,
04362   double * coef,
04363   const double defValue);
04364 
04365                                         /* returns 1 iff found a number 
04366                                          * otherwise 0 */
04367 extern int dbl_ILLread_lp_state_possible_bound_value (
04368   dbl_ILLread_lp_state * state);
04369 
04370                                                /* returns 1 iff found a number 
04371                                                 * otherwise 0 */
04372 extern int dbl_ILLread_lp_state_colon (
04373   dbl_ILLread_lp_state * state);
04374 extern int dbl_ILLread_lp_state_has_colon (
04375   dbl_ILLread_lp_state * state);
04376 extern int dbl_ILLread_lp_statxe_has_colon (
04377   dbl_ILLread_lp_state * state);
04378 extern int dbl_ILLread_lp_state_next_constraint (
04379   dbl_ILLread_lp_state * state);
04380 extern int dbl_ILLread_lp_state_sense (
04381   dbl_ILLread_lp_state * state);
04382 extern int dbl_ILLtest_lp_state_sense (
04383   dbl_ILLread_lp_state * state,
04384   int all);
04385 extern void dbl_ILLtest_lp_state_bound_sense (
04386   dbl_ILLread_lp_state * state);
04387 extern int dbl_ILLread_lp_state_value (
04388   dbl_ILLread_lp_state * state,
04389   double * d);
04390 extern int dbl_ILLtest_lp_state_next_is (
04391   dbl_ILLread_lp_state * state,
04392   const char *str);
04393 extern int dbl_ILLread_lp_state_skip_blanks (
04394   dbl_ILLread_lp_state * state,
04395   int wrapLines);
04396 
04397 extern int dbl_ILLcheck_subject_to (
04398   dbl_ILLread_lp_state * state);
04399 
04400 /*---------------------------------------------------------------------------*/
04401 /* errors and warnings 
04402  */
04403 extern int dbl_ILLlp_error (
04404   dbl_ILLread_lp_state * state,
04405   const char *format,
04406   ...);
04407 extern void dbl_ILLlp_warn (
04408   dbl_ILLread_lp_state * state,
04409   const char *format,
04410   ...);
04411 
04412 /*---------------------------------------------------------------------------*/
04413 /* shared with read_mps_state.c 
04414  */
04415 extern int dbl_ILLget_value (
04416   char *line,
04417   double * coef);
04418 
04419 #endif
04420 /****************************************************************************/
04421 /*                                                                          */
04422 /*  This file is part of QSopt_ex.                                          */
04423 /*                                                                          */
04424 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04425 /*  and Daniel Espinoza                                                     */
04426 /*                                                                          */
04427 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04428 /*  copyright in QSopt.                                                     */
04429 /*                                                                          */
04430 /*  This code may be used under the terms of the GNU General Public License */
04431 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04432 /*                                                                          */
04433 /*  Alternatively, use is granted for research purposes only.               */
04434 /*                                                                          */
04435 /*  It is your choice of which of these two licenses you are operating      */
04436 /*  under.                                                                  */
04437 /*                                                                          */
04438 /*  We make no guarantees about the correctness or usefulness of this code. */
04439 /*                                                                          */
04440 /****************************************************************************/
04441 
04442 /* $RCSfile: rd_mps.h,v $ $Revision: 1.2 $ $Date: 2003/11/05 16:57:39 $ */
04443 #ifndef dbl_READ_MPS_STATE_H
04444 #define dbl_READ_MPS_STATE_H
04445 
04446 
04447 
04448 typedef struct dbl_ILLread_mps_state_struct
04449 {
04450   int section[ILL_MPS_N_SECTIONS];
04451   ILLmps_section active;
04452   const char *file_name;
04453   dbl_qsline_reader *file;
04454   unsigned int line_num;
04455   unsigned int field_num;       /* number of successfully read fields on line */
04456   int intvar;
04457   int sosvar;
04458   char line[ILL_namebufsize];
04459   char key[ILL_namebufsize];
04460   char field[ILL_namebufsize];
04461   char *obj;
04462   char *p;                      /* ptr to next 'unread' character */
04463 }
04464 dbl_ILLread_mps_state;
04465 
04466 extern int dbl_ILLmps_state_init (
04467   dbl_ILLread_mps_state * state,
04468   dbl_qsline_reader * file,
04469   const char *dbl_fname);
04470 extern void dbl_ILLmps_state_clear (
04471   dbl_ILLread_mps_state * state);
04472 extern int dbl_ILLmps_set_section (
04473   dbl_ILLread_mps_state * state,
04474   const ILLmps_section sec);
04475 
04476 extern int dbl_ILLmps_next_line (
04477   dbl_ILLread_mps_state * state);
04478 extern int dbl_ILLmps_next_field (
04479   dbl_ILLread_mps_state * state);
04480 extern int dbl_ILLmps_next_coef (
04481   dbl_ILLread_mps_state * state,
04482   double * coef);
04483 extern int dbl_ILLmps_next_bound (
04484   dbl_ILLread_mps_state * state,
04485   double * coef);
04486 extern void dbl_ILLmps_check_end_of_line (
04487   dbl_ILLread_mps_state * state);
04488 extern void dbl_ILLmps_set_end_of_line (
04489   dbl_ILLread_mps_state * state);
04490 
04491 extern int dbl_ILLmps_int_sos_mode (
04492   dbl_ILLread_mps_state * state);
04493 
04494 extern const char *dbl_ILLmps_possibly_blank_name (
04495   const char *field,
04496   dbl_ILLread_mps_state * state,
04497   ILLsymboltab * tab);
04498 extern int dbl_ILLmps_empty_key (
04499   dbl_ILLread_mps_state * state);
04500 extern int dbl_ILLmps_empty_field (
04501   dbl_ILLread_mps_state * state);
04502 
04503 extern int dbl_ILLmps_error (
04504   dbl_ILLread_mps_state * state,
04505   const char *format,
04506   ...);
04507 extern void dbl_ILLmps_warn (
04508   dbl_ILLread_mps_state * state,
04509   const char *format,
04510   ...);
04511 
04512 #endif
04513 /****************************************************************************/
04514 /*                                                                          */
04515 /*  This file is part of QSopt_ex.                                          */
04516 /*                                                                          */
04517 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04518 /*  and Daniel Espinoza                                                     */
04519 /*                                                                          */
04520 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04521 /*  copyright in QSopt.                                                     */
04522 /*                                                                          */
04523 /*  This code may be used under the terms of the GNU General Public License */
04524 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04525 /*                                                                          */
04526 /*  Alternatively, use is granted for research purposes only.               */
04527 /*                                                                          */
04528 /*  It is your choice of which of these two licenses you are operating      */
04529 /*  under.                                                                  */
04530 /*                                                                          */
04531 /*  We make no guarantees about the correctness or usefulness of this code. */
04532 /*                                                                          */
04533 /****************************************************************************/
04534 
04535 /* $RCSfile: dbl_simplex.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $ */
04536 
04537 #ifndef dbl___SIMPLEX_H
04538 #define dbl___SIMPLEX_H
04539 
04540 struct itcnt_t;
04541 typedef struct dbl_param_info
04542 {
04543   int origalgo;
04544   int pphaseI;
04545   int pphaseII;
04546   int dphaseI;
04547   int dphaseII;
04548   int p_strategy;
04549   int d_strategy;
04550 }
04551 dbl_param_info;
04552 
04553 typedef struct dbl_iter_info
04554 {
04555   int newphase;
04556   int nextphase;
04557   int nextstep;
04558   int sdisplay;
04559   int itercnt;
04560   int solstatus;
04561   int curtime;
04562   int rounds;
04563   int chkobj;
04564   int nosolve;
04565   int noprog;
04566   int inner;
04567   int algorithm;
04568   int resumeid;
04569   int pricetype;
04570   int n_restart;
04571   int n_pivot_fail;
04572   double prevobj;
04573   double objtol;
04574   dbl_param_info oldinfo;
04575 }
04576 dbl_iter_info;
04577 
04578 void dbl_ILLsimplex_init_lpinfo ( dbl_lpinfo * lp),
04579     dbl_ILLsimplex_free_lpinfo ( dbl_lpinfo * lp),
04580     dbl_ILLsimplex_load_lpinfo ( dbl_ILLlpdata * qslp, dbl_lpinfo * lp),
04581     dbl_ILLsimplex_set_bound ( dbl_lpinfo * lp, const double * objbound, int sense);
04582 void dbl_free_internal_lpinfo ( dbl_lpinfo * lp);
04583 void dbl_init_internal_lpinfo ( dbl_lpinfo * lp);
04584 int dbl_build_internal_lpinfo ( dbl_lpinfo * lp);
04585 int dbl_ILLsimplex_retest_psolution ( dbl_lpinfo * lp, dbl_price_info * p, int phase,
04586       dbl_feas_info * fs),
04587     dbl_ILLsimplex_retest_dsolution ( dbl_lpinfo * lp, dbl_price_info * p, int phase,
04588       dbl_feas_info * fs),
04589     dbl_ILLsimplex_solution ( dbl_lpinfo * lp, double * xz, double * piz,
04590       double * dz, double * objval),
04591     dbl_ILLsimplex_infcertificate ( dbl_lpinfo * lp, double * pi),
04592     dbl_ILLsimplex ( dbl_lpinfo * lp, int algorithm, dbl_ILLlp_basis * B, 
04593       dbl_price_info * pinf, int *sol_status, int sdisplay, itcnt_t* itcnt),
04594     dbl_ILLsimplex_pivotin ( dbl_lpinfo * lp, dbl_price_info * pinf, int rcnt, 
04595       int *rlist, int pivot_opt, int *basis_mod);
04596 
04597 #endif /* dbl___SIMPLEX_H */
04598 /****************************************************************************/
04599 /*                                                                          */
04600 /*  This file is part of QSopt_ex.                                          */
04601 /*                                                                          */
04602 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04603 /*  and Daniel Espinoza                                                     */
04604 /*                                                                          */
04605 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04606 /*  copyright in QSopt.                                                     */
04607 /*                                                                          */
04608 /*  This code may be used under the terms of the GNU General Public License */
04609 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04610 /*                                                                          */
04611 /*  Alternatively, use is granted for research purposes only.               */
04612 /*                                                                          */
04613 /*  It is your choice of which of these two licenses you are operating      */
04614 /*  under.                                                                  */
04615 /*                                                                          */
04616 /*  We make no guarantees about the correctness or usefulness of this code. */
04617 /*                                                                          */
04618 /****************************************************************************/
04619 
04620 /*  RCS_INFO = "$RCSfile: wr_lp.h,v $ $Revision: 1.2 $ $Date: 2003/11/05 16:57:39 $"; */
04621 #ifndef dbl_WRITE_LP_STATE_H
04622 #define dbl_WRITE_LP_STATE_H
04623 
04624 /****************************************************************************/
04625 /*                                                                          */
04626 /*               Routines to support writing of LP files                    */
04627 /*                                                                          */
04628 /****************************************************************************/
04629 
04630 /* 
04631  * -) anything after '\' is comment 
04632  * -) variables consist of a-z A-Z 0-9!"#$%(),;.?@_`'{}|~ 
04633  *    don't start with a digit or '.'
04634  */
04635 
04636 typedef struct dbl_ILLwrite_lp_state
04637 {
04638   char buf[ILL_namebufsize];
04639   char *p;
04640   int startlen;
04641   int total;
04642 }
04643 dbl_ILLwrite_lp_state;
04644 
04645 extern void dbl_ILLwrite_lp_state_init (
04646   dbl_ILLwrite_lp_state * line,
04647   const char *str);
04648 extern void dbl_ILLwrite_lp_state_append (
04649   dbl_ILLwrite_lp_state * line,
04650   const char *str);
04651 extern void dbl_ILLwrite_lp_state_append_coef (
04652   dbl_ILLwrite_lp_state * line,
04653   double v,
04654   int cnt);
04655 
04656       /* append number sign ('+', '-') iff cnt > 0 or v < 0.0  
04657        * append number iff v != 1.0, v != -1.0  
04658        */
04659 extern void dbl_ILLwrite_lp_state_append_number (
04660   dbl_ILLwrite_lp_state * line,
04661   double v);
04662 extern void dbl_ILLwrite_lp_state_save_start (
04663   dbl_ILLwrite_lp_state * line);
04664 extern void dbl_ILLwrite_lp_state_start (
04665   dbl_ILLwrite_lp_state * line);
04666 
04667 #endif
04668 /****************************************************************************/
04669 /*                                                                          */
04670 /*  This file is part of QSopt_ex.                                          */
04671 /*                                                                          */
04672 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04673 /*  and Daniel Espinoza                                                     */
04674 /*                                                                          */
04675 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04676 /*  copyright in QSopt.                                                     */
04677 /*                                                                          */
04678 /*  This code may be used under the terms of the GNU General Public License */
04679 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04680 /*                                                                          */
04681 /*  Alternatively, use is granted for research purposes only.               */
04682 /*                                                                          */
04683 /*  It is your choice of which of these two licenses you are operating      */
04684 /*  under.                                                                  */
04685 /*                                                                          */
04686 /*  We make no guarantees about the correctness or usefulness of this code. */
04687 /*                                                                          */
04688 /****************************************************************************/
04689 
04690 /* RCSINFO $Id: dbl_lib.h,v 1.4 2003/11/05 17:00:26 meven Exp $ */
04691 #ifndef dbl_ILL_LIB_H
04692 #define dbl_ILL_LIB_H
04693 
04694 
04695 /****************************************************************************/
04696 /*                                                                          */
04697 /*                   Return Status for dbl_ILLlib_optimize                      */
04698 /*                                                                          */
04699 /****************************************************************************/
04700 
04701 /****************************************************************************/
04702 /*                                                                          */
04703 /*                               dbl_lib.c                                      */
04704 /*                                                                          */
04705 /****************************************************************************/
04706 
04707 struct itcnt_t;
04708 
04709 int dbl_ILLlib_optimize ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, dbl_price_info * pinf, int algo,
04710       int *status, int simplex_display, struct itcnt_t*itcnt),
04711     dbl_ILLlib_cache_solution ( dbl_lpinfo * lp, dbl_ILLlp_cache * C), 
04712     dbl_ILLlib_solution ( dbl_lpinfo * lp, dbl_ILLlp_cache * C, double * val, 
04713       double * x, double * pi, double * slack, double * rc),
04714     dbl_ILLlib_get_x ( dbl_lpinfo * lp, dbl_ILLlp_cache * C, double * x),
04715     dbl_ILLlib_get_slack ( dbl_lpinfo * lp, dbl_ILLlp_cache * C, double * slack),
04716     dbl_ILLlib_objval ( dbl_lpinfo * lp, dbl_ILLlp_cache * C, double * val),
04717     dbl_ILLlib_tableau ( dbl_lpinfo * lp, int row, double * binv, double * tabrow),
04718     dbl_ILLlib_basis_order ( dbl_lpinfo * lp, int *header),
04719     dbl_ILLlib_newrow ( dbl_lpinfo * lp, dbl_ILLlp_basis * B,const double rhs, int sense,
04720       const double range, const char *name),
04721     dbl_ILLlib_newrows ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, int num,const double * rhs,
04722       char *sense, const double * range, const char **names),
04723     dbl_ILLlib_addrow ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, int cnt, int *ind,
04724       const double * val, const double rhs, int sense,const double range,
04725       const char *rowname),
04726     dbl_ILLlib_addrows ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, int num, int *rmatcnt, 
04727       int *rmatbeg, int *rmatind,const double * rmatval,const double * rhs, 
04728       char *sense, const double * range, const char **names, int *nofactor),
04729     dbl_ILLlib_delrows ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, dbl_ILLlp_cache * C, int num, 
04730       int *dellist, int *basis_ok, int *cache_ok), 
04731     dbl_ILLlib_newcol ( dbl_lpinfo * lp, dbl_ILLlp_basis * B,const double obj, 
04732       const double lower,const double upper, const char *name, int factorok), 
04733     dbl_ILLlib_newcols ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, int num, double * obj,
04734       double * lower, double * upper, const char **names, int factorok),
04735     dbl_ILLlib_addcol ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, int cnt, int *ind,
04736       double * val,const double obj,const double lower,const double upper, 
04737       const char *name, int factorok),
04738     dbl_ILLlib_addcols ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, int num, int *cmatcnt,
04739       int *cmatbeg, int *cmatind, double * cmatval, double * obj,
04740       double * lower, double * upper, const char **names, int factorok),
04741     dbl_ILLlib_delcols ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, int num, int *dellist,
04742       int *basis_ok),
04743     dbl_ILLlib_chgcoef ( dbl_lpinfo * lp, int rowindex, int colindex, double coef), 
04744     dbl_ILLlib_getcoef (dbl_lpinfo *lp, int rowindex, int colindex, double* coef),
04745     dbl_ILLlib_chgrange (dbl_lpinfo *lp, int indx, double coef),
04746     dbl_ILLlib_chgsense ( dbl_lpinfo * lp, int num, int *rowlist, char *sense),
04747     dbl_ILLlib_getsenses (dbl_lpinfo *lp, char *senses),
04748     dbl_ILLlib_getrows ( dbl_lpinfo * lp, int num, int *rowlist, int **rowcnt,
04749       int **rowbeg, int **rowind, double ** rowval, double ** rhs,
04750       char **sense, double ** range, char ***names),
04751     dbl_ILLlib_getcols ( dbl_lpinfo * lp, int num, int *collist, int **colcnt,
04752       int **colbeg, int **colind, double ** colval, double ** obj,
04753       double ** lower, double ** upper, char ***names),
04754     dbl_ILLlib_getobj ( dbl_lpinfo * lp, double * obj),
04755     dbl_ILLlib_getobj_list (dbl_lpinfo *lp, int num, int* collist, double* obj),
04756     dbl_ILLlib_chgobj ( dbl_lpinfo * lp, int indx, double coef),
04757     dbl_ILLlib_getrhs ( dbl_lpinfo * lp, double * rhs),
04758     dbl_ILLlib_chgrhs ( dbl_lpinfo * lp, int indx, double coef),
04759     dbl_ILLlib_getintflags ( dbl_lpinfo * lp, int *intflags),
04760     dbl_ILLlib_rownames ( dbl_lpinfo * lp, char **rownames),
04761     dbl_ILLlib_colnames ( dbl_lpinfo * lp, char **colnames),
04762     dbl_ILLlib_colindex ( dbl_lpinfo * lp, const char *name, int *colindex),
04763     dbl_ILLlib_rowindex ( dbl_lpinfo * lp, const char *name, int *rowindex),
04764     dbl_ILLlib_chgbnd ( dbl_lpinfo * lp, int indx, int lu,const double bnd),
04765     dbl_ILLlib_chgbnds ( dbl_lpinfo * lp, int cnt, int *indx, char *lu, const double * bnd),
04766     dbl_ILLlib_getbnd ( dbl_lpinfo * lp, int indx, int lu, double * bnd),
04767     dbl_ILLlib_getbnds ( dbl_lpinfo * lp, double * lower, double * upper),
04768     dbl_ILLlib_getbnds_list ( dbl_lpinfo *lp, int num, int*collist, double *lower,
04769       double *upper),
04770     dbl_ILLlib_strongbranch ( dbl_lpinfo * lp, dbl_price_info * pinf, int *candidatelist,
04771       int ncand, double * xlist, double * downpen, double * uppen,
04772       int iterations, double objbound, struct itcnt_t*itcnt),
04773     dbl_ILLlib_getbasis ( dbl_lpinfo * lp, char *cstat, char *rstat),
04774     dbl_ILLlib_loadbasis ( dbl_ILLlp_basis * B, int nstruct, int nrows, char *cstat,
04775       char *rstat),
04776     dbl_ILLlib_readbasis ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, const char *dbl_fname),
04777     dbl_ILLlib_writebasis ( dbl_lpinfo * lp, dbl_ILLlp_basis * B, const char *dbl_fname),
04778     dbl_ILLlib_getrownorms ( dbl_lpinfo * lp, dbl_price_info * pinf, double * rownorms),
04779     dbl_ILLlib_loadrownorms ( dbl_lpinfo * lp, dbl_price_info * pinf, double * rownorms),
04780     dbl_ILLlib_recompute_rownorms ( dbl_lpinfo * lp, dbl_price_info * pinf),
04781     dbl_ILLlib_iter ( dbl_lpinfo * lp),
04782     dbl_ILLlib_print_x ( EGioFile_t * fd, dbl_lpinfo * lp, dbl_ILLlp_cache * C, double * x,
04783       int nonZerosOnly),
04784     dbl_ILLwrite_lp_file ( dbl_ILLlpdata * lp, EGioFile_t * eout, dbl_qserror_collector * c);
04785 
04786 
04787 extern int dbl_ILLlib_findName (
04788   dbl_ILLlpdata * qslp,
04789   int forRow,
04790   const char *name,
04791   int id,
04792   char buf[ILL_namebufsize]);
04793 
04794 /****************************************************************************/
04795 /*                                                                          */
04796 /*                           dbl_presolve.c                                     */
04797 /*                                                                          */
04798 /****************************************************************************/
04799 
04800 int dbl_ILLpresolve_add_logicals (
04801   dbl_ILLlpdata * lp);
04802 
04803 
04804 /****************************************************************************/
04805 /*                                                                          */
04806 /*                            dbl_binary.c                                      */
04807 /*                                                                          */
04808 /****************************************************************************/
04809 
04810 int dbl_ILLmip_binary_dfs (
04811   dbl_lpinfo * lp);
04812 
04813 #endif /* dbl_ILL_LIB_H */
04814 /****************************************************************************/
04815 /*                                                                          */
04816 /*  This file is part of QSopt_ex.                                          */
04817 /*                                                                          */
04818 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04819 /*  and Daniel Espinoza                                                     */
04820 /*                                                                          */
04821 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04822 /*  copyright in QSopt.                                                     */
04823 /*                                                                          */
04824 /*  This code may be used under the terms of the GNU General Public License */
04825 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04826 /*                                                                          */
04827 /*  Alternatively, use is granted for research purposes only.               */
04828 /*                                                                          */
04829 /*  It is your choice of which of these two licenses you are operating      */
04830 /*  under.                                                                  */
04831 /*                                                                          */
04832 /*  We make no guarantees about the correctness or usefulness of this code. */
04833 /*                                                                          */
04834 /****************************************************************************/
04835 
04836 /*  $RCSfile: fp20_qstruct.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
04837 #ifndef fp20___QS_QSTRUCT_H
04838 #define fp20___QS_QSTRUCT_H
04839 
04840 typedef struct fp20_qsdata
04841 {
04842   struct fp20_ILLlpdata *qslp;
04843   struct fp20_lpinfo *lp;
04844   struct fp20_price_info *pricing;
04845   struct fp20_ILLlp_basis *basis;
04846   struct fp20_ILLlp_cache *cache;
04847   char *name;
04848   int qstatus;                  /* QS_LP_UNSOLVED or an opt status  */
04849   int factorok;                 /* set to 0 if factorization is old */
04850   int simplex_display;          /* 0 off, 1 on */
04851   int simplex_scaling;          /* 0 off, 1 on */
04852   itcnt_t itcnt;
04853   EGfp20_t uobjlim;
04854   EGfp20_t lobjlim;
04855 }
04856 fp20_QSdata;
04857 
04858 #endif /* fp20___QS_QSTRUCT_H */
04859 /****************************************************************************/
04860 /*                                                                          */
04861 /*  This file is part of QSopt_ex.                                          */
04862 /*                                                                          */
04863 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04864 /*  and Daniel Espinoza                                                     */
04865 /*                                                                          */
04866 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04867 /*  copyright in QSopt.                                                     */
04868 /*                                                                          */
04869 /*  This code may be used under the terms of the GNU General Public License */
04870 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04871 /*                                                                          */
04872 /*  Alternatively, use is granted for research purposes only.               */
04873 /*                                                                          */
04874 /*  It is your choice of which of these two licenses you are operating      */
04875 /*  under.                                                                  */
04876 /*                                                                          */
04877 /*  We make no guarantees about the correctness or usefulness of this code. */
04878 /*                                                                          */
04879 /****************************************************************************/
04880 
04881 /* RCSINFO $Id: fp20_editor.h,v 1.2 2003/11/05 16:57:39 meven Exp $ */
04882 #ifndef fp20_EDITOR_H
04883 #define fp20_EDITOR_H
04884 
04885 extern void fp20_ILLeditor_init (
04886   void);
04887 extern void fp20_ILLeditor (
04888   fp20_QSdata * p);
04889 extern int fp20_ILLeditor_solve (
04890   fp20_QSdata * p,
04891   int salgo);
04892 
04893 #endif
04894 /****************************************************************************/
04895 /*                                                                          */
04896 /*  This file is part of QSopt_ex.                                          */
04897 /*                                                                          */
04898 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
04899 /*  and Daniel Espinoza                                                     */
04900 /*                                                                          */
04901 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
04902 /*  copyright in QSopt.                                                     */
04903 /*                                                                          */
04904 /*  This code may be used under the terms of the GNU General Public License */
04905 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
04906 /*                                                                          */
04907 /*  Alternatively, use is granted for research purposes only.               */
04908 /*                                                                          */
04909 /*  It is your choice of which of these two licenses you are operating      */
04910 /*  under.                                                                  */
04911 /*                                                                          */
04912 /*  We make no guarantees about the correctness or usefulness of this code. */
04913 /*                                                                          */
04914 /****************************************************************************/
04915 
04916 /* RCSINFO $Id: fp20_dstruct.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
04917 /****************************************************************************/
04918 /*                                                                          */
04919 /*                           fp20_svector.h                                      */
04920 /*                                                                          */
04921 /****************************************************************************/
04922 
04923 #ifndef fp20___SVECTOR_H
04924 #define fp20___SVECTOR_H
04925 
04926 typedef struct fp20_svector
04927 {
04928   int nzcnt;
04929   int *indx;
04930   int size;
04931   EGfp20_t *coef;
04932 }
04933 fp20_svector;
04934 
04935 void fp20_ILLsvector_init (
04936   fp20_svector * s),
04937   fp20_ILLsvector_free (
04938   fp20_svector * s);
04939 
04940 int fp20_ILLsvector_alloc (
04941   fp20_svector * s,
04942   int nzcnt),
04943   fp20_ILLsvector_copy (
04944   const fp20_svector * s_in,
04945   fp20_svector * s_out);
04946 
04947 #endif /* fp20___SVECTOR_H */
04948 
04949 /****************************************************************************/
04950 /*                                                                          */
04951 /*                           fp20_heap.h                                         */
04952 /*                                                                          */
04953 /****************************************************************************/
04954 
04955 #ifndef fp20___HEAP_H
04956 #define fp20___HEAP_H
04957 
04958 typedef struct
04959 {
04960   int *entry;
04961   int *loc;
04962   EGfp20_t *key;
04963   int hexist;
04964   int maxsize;
04965   int size;
04966 }
04967 fp20_heap;
04968 
04969 void fp20_ILLheap_insert (
04970   fp20_heap * const h,
04971   int const ix),
04972   fp20_ILLheap_modify (
04973   fp20_heap * const h,
04974   int const ix),
04975   fp20_ILLheap_delete (
04976   fp20_heap * const h,
04977   int const ix),
04978   fp20_ILLheap_init (
04979   fp20_heap * const h),
04980   fp20_ILLheap_free (
04981   fp20_heap * const h);
04982 
04983 int fp20_ILLheap_findmin (
04984   fp20_heap * const h),
04985   fp20_ILLheap_build (
04986   fp20_heap * const h,
04987   int const nelems,
04988   EGfp20_t * key);
04989 
04990 #endif /* fp20___HEAP_H */
04991 
04992 /****************************************************************************/
04993 /*                                                                          */
04994 /*                         matrix.h                                         */
04995 /*                                                                          */
04996 /****************************************************************************/
04997 
04998 #ifndef fp20___MATRIX_H
04999 #define fp20___MATRIX_H
05000 
05001 typedef struct fp20_ILLmatrix
05002 {
05003   EGfp20_t *matval;           /* The coefficients.                       */
05004   int *matcnt;                  /* Number of coefs in each col.            */
05005   int *matind;                  /* The row indices of the coefs.           */
05006   int *matbeg;                  /* The start of each col.                  */
05007   int matcols;                  /* Number of columns.                      */
05008   int matrows;
05009   int matcolsize;               /* Length of matbeg and matcnt.            */
05010   int matsize;                  /* Length of matind and matval.            */
05011   int matfree;                  /* Free space at end of matind.            */
05012   /* Note: free elements marked by -1 in     */
05013   /* matind; we keep at least 1 free at end. */
05014 }
05015 fp20_ILLmatrix;
05016 
05017 void fp20_ILLmatrix_init (
05018   fp20_ILLmatrix * A);
05019 void fp20_ILLmatrix_free (
05020   fp20_ILLmatrix * A);
05021 void fp20_ILLmatrix_prt (
05022   EGioFile_t * fd,
05023   fp20_ILLmatrix * A);
05024 
05025 #endif /* fp20___MATRIX_H */
05026 /****************************************************************************/
05027 /*                                                                          */
05028 /*  This file is part of QSopt_ex.                                          */
05029 /*                                                                          */
05030 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
05031 /*  and Daniel Espinoza                                                     */
05032 /*                                                                          */
05033 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
05034 /*  copyright in QSopt.                                                     */
05035 /*                                                                          */
05036 /*  This code may be used under the terms of the GNU General Public License */
05037 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
05038 /*                                                                          */
05039 /*  Alternatively, use is granted for research purposes only.               */
05040 /*                                                                          */
05041 /*  It is your choice of which of these two licenses you are operating      */
05042 /*  under.                                                                  */
05043 /*                                                                          */
05044 /*  We make no guarantees about the correctness or usefulness of this code. */
05045 /*                                                                          */
05046 /****************************************************************************/
05047 
05048 /* RCSINFO $Id: fp20_factor.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
05049 #ifndef fp20___QS_FACTOR_H_
05050 #define fp20___QS_FACTOR_H_
05051 
05052 typedef char fp20_QSbool;
05053 
05054 typedef struct fp20_uc_info
05055 {
05056   int cbeg;
05057   int nzcnt;
05058   int next;
05059   int prev;
05060   int delay;
05061 }
05062 fp20_uc_info;
05063 
05064 typedef struct fp20_ur_info
05065 {
05066   EGfp20_t max;
05067   int rbeg;
05068   int nzcnt;
05069   int pivcnt;
05070   int next;
05071   int prev;
05072   int delay;
05073 }
05074 fp20_ur_info;
05075 
05076 typedef struct fp20_lc_info
05077 {
05078   int cbeg;
05079   int nzcnt;
05080   int c;
05081   int crank;
05082   int delay;
05083 }
05084 fp20_lc_info;
05085 
05086 typedef struct fp20_lr_info
05087 {
05088   int rbeg;
05089   int nzcnt;
05090   int r;
05091   int rrank;
05092   int delay;
05093 }
05094 fp20_lr_info;
05095 
05096 typedef struct fp20_er_info
05097 {
05098   int rbeg;
05099   int nzcnt;
05100   int r;
05101 }
05102 fp20_er_info;
05103 
05104 typedef struct fp20_factor_work
05105 {
05106   int max_k;
05107   EGfp20_t fzero_tol;
05108   EGfp20_t szero_tol;
05109   EGfp20_t partial_tol;
05110   double ur_space_mul;
05111   double uc_space_mul;
05112   double lc_space_mul;
05113   double lr_space_mul;
05114   double er_space_mul;
05115   double grow_mul;
05116   int p;
05117   int etamax;
05118   double minmult;
05119   double maxmult;
05120   double updmaxmult;
05121   double dense_fract;
05122   int dense_min;
05123 
05124   EGfp20_t maxelem_orig;
05125   int nzcnt_orig;
05126   EGfp20_t maxelem_factor;
05127   int nzcnt_factor;
05128   EGfp20_t maxelem_cur;
05129   int nzcnt_cur;
05130 
05131   EGfp20_t partial_cur;
05132 
05133   int dim;
05134   int stage;
05135   int nstages;
05136   int etacnt;
05137   EGfp20_t *work_coef;
05138   int *work_indx;
05139   fp20_uc_info *uc_inf;
05140   fp20_ur_info *ur_inf;
05141   fp20_lc_info *lc_inf;
05142   fp20_lr_info *lr_inf;
05143   fp20_er_info *er_inf;
05144   int *ucindx;                  /* row index for column data */
05145   int *ucrind;                  /* index of column in row data */
05146   EGfp20_t *uccoef;           /* coefficient for column data */
05147   int *urindx;                  /* col index for row data */
05148   int *urcind;                  /* index of row in column data */
05149   EGfp20_t *urcoef;           /* coefficient for row data */
05150   int *lcindx;                  /* row index for L data */
05151   EGfp20_t *lccoef;           /* coefficient for L row data */
05152   int *lrindx;                  /* col index for L data */
05153   EGfp20_t *lrcoef;           /* coefficient for L col data */
05154   int *erindx;                  /* col index for eta data */
05155   EGfp20_t *ercoef;           /* coefficient for eta data */
05156   int *rperm;
05157   int *rrank;
05158   int *cperm;
05159   int *crank;
05160   fp20_svector xtmp;
05161   int ur_freebeg;
05162   int ur_space;
05163   int uc_freebeg;
05164   int uc_space;
05165   int lc_freebeg;
05166   int lc_space;
05167   int lr_freebeg;
05168   int lr_space;
05169   int er_freebeg;
05170   int er_space;
05171 
05172   int *p_nsing;
05173   int **p_singr;
05174   int **p_singc;
05175 
05176   EGfp20_t *dmat;
05177   int drows;
05178   int dcols;
05179   int dense_base;
05180 }
05181 fp20_factor_work;
05182 
05183 void fp20_ILLfactor_init_factor_work (
05184   fp20_factor_work * f),
05185   fp20_ILLfactor_free_factor_work (
05186   fp20_factor_work * f),
05187   fp20_ILLfactor_ftran (
05188   fp20_factor_work * f,
05189   fp20_svector * a,
05190   fp20_svector * x),
05191   fp20_ILLfactor_ftran_update (
05192   fp20_factor_work * f,
05193   fp20_svector * a,
05194   fp20_svector * upd,
05195   fp20_svector * x),
05196   fp20_ILLfactor_btran (
05197   fp20_factor_work * f,
05198   fp20_svector * a,
05199   fp20_svector * x);
05200 
05201 int fp20_ILLfactor_create_factor_work (
05202   fp20_factor_work * f,
05203   int dim),
05204   fp20_ILLfactor_set_factor_iparam (
05205   fp20_factor_work * f,
05206   int param,
05207   int val),
05208   fp20_ILLfactor_set_factor_dparam (
05209   fp20_factor_work * f,
05210   int param,
05211   EGfp20_t val),
05212   fp20_ILLfactor (
05213   fp20_factor_work * f,
05214   int *basis,
05215   int *cbeg,
05216   int *clen,
05217   int *cindx,
05218   EGfp20_t * ccoef,
05219   int *p_nsing,
05220   int **p_singr,
05221   int **p_singc),
05222   fp20_ILLfactor_update (
05223   fp20_factor_work * f,
05224   fp20_svector * a,
05225   int col,
05226   int *p_refact);
05227 
05228 #endif /* fp20___QS_FACTOR_H_ */
05229 /****************************************************************************/
05230 /*                                                                          */
05231 /*  This file is part of QSopt_ex.                                          */
05232 /*                                                                          */
05233 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
05234 /*  and Daniel Espinoza                                                     */
05235 /*                                                                          */
05236 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
05237 /*  copyright in QSopt.                                                     */
05238 /*                                                                          */
05239 /*  This code may be used under the terms of the GNU General Public License */
05240 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
05241 /*                                                                          */
05242 /*  Alternatively, use is granted for research purposes only.               */
05243 /*                                                                          */
05244 /*  It is your choice of which of these two licenses you are operating      */
05245 /*  under.                                                                  */
05246 /*                                                                          */
05247 /*  We make no guarantees about the correctness or usefulness of this code. */
05248 /*                                                                          */
05249 /****************************************************************************/
05250 
05251 /* RCSINFO $Id: fp20_lpdefs.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
05252 #ifndef fp20___QS_LPDEFS_H
05253 #define fp20___QS_LPDEFS_H
05254 
05255 
05256 /* infinity and negative infinity */
05257 #define fp20_INFTY  fp20_ILL_MAXDOUBLE
05258 #define fp20_NINFTY fp20_ILL_MINDOUBLE
05259 
05260 /* tolerances, these are initialized in fp20_ILLstart, file fp20_lpdata.c */
05261 //#if EGLPNUM_TYPE != DBL_TYPE && EGLPNUM_TYPE != LDBL_TYPE
05262 /* these three constants are defined in fp20_lpdata.c */
05263 extern EGfp20_t fp20_PARAM_IBASIS_RPIVOT; /*       0.98 */
05264 extern EGfp20_t fp20_PARAM_IBASIS_RTRIANG;/*       0.01 */
05265 extern EGfp20_t fp20_PARAM_MIN_DNORM;     /*      1e-24 */
05266 extern EGfp20_t fp20_PFEAS_TOLER;         /*       1e-6 */
05267 extern EGfp20_t fp20_BD_TOLER;            /*       1e-7 */
05268 extern EGfp20_t fp20_DFEAS_TOLER;         /*       1e-6 */
05269 extern EGfp20_t fp20_PIVOT_TOLER;         /*      1e-10 */
05270 extern EGfp20_t fp20_SZERO_TOLER;         /*      1e-15 */
05271 extern EGfp20_t fp20_PIVZ_TOLER;          /*      1e-12 */
05272 extern EGfp20_t fp20_OBJBND_TOLER;        /*       1e-2 */
05273 extern EGfp20_t fp20_DBNDPIV_TOLER;       /*       1e-3 */
05274 extern EGfp20_t fp20_DBNDPIV_RATIO;       /*       1e-2 */
05275 extern EGfp20_t fp20_ALTPIV_TOLER;        /*       1e-8 */
05276 //extern EGfp20_t DJZERO_TOLER;/*             1e-8 */
05277 extern EGfp20_t fp20_PROGRESS_ZERO;       /*       1e-7 */
05278 extern EGfp20_t fp20_PROGRESS_THRESH;     /*       1e-5 */
05279 extern EGfp20_t fp20_CB_EPS;              /*      0.001 */
05280 extern EGfp20_t fp20_CB_INF_RATIO;        /*       10.0 */
05281 extern EGfp20_t fp20_CB_PRI_RLIMIT;       /*       0.25 */
05282 
05283 /* structure for statistics */
05284 typedef struct
05285 {
05286   int ynz_cnt;                  /* nz in entering columns */
05287   int num_y;
05288   EGfp20_t y_ravg;              /* weighted avg. of current & prior y */
05289   int znz_cnt;                  /* nz in ith row of B^{-1}, ie z_i */
05290   int num_z;
05291   EGfp20_t z_ravg;              /* weighted avg. of current & prior z */
05292   int zanz_cnt;                 /* nz in z^TA */
05293   int num_za;
05294   EGfp20_t za_ravg;           /* weighted avg. of current & prior za */
05295   int pnorm_cnt;                /* nz in columns for primal norms */
05296   int dnorm_cnt;                /* nz in rows for dual norms */
05297   int pinz_cnt;                 /* nz in phase II pi (solve) */
05298   int num_pi;                   /* # of pi solves */
05299   int pi1nz_cnt;                /* nz in phase I pi (solve) */
05300   int num_pi1;                  /* # of phase I pi solves */
05301   int upnz_cnt;                 /* nz in ftran update vector */
05302   int num_up;                   /* # of ftran_updates */
05303   int pupv_cnt;                 /* nz in primal steep updates */
05304   int dupv_cnt;                 /* nz in dual steep updates */
05305 
05306   int start_slacks;             /* # slacks in beginning */
05307   int final_slacks;             /* # slacks in the end */
05308   int start_art;                /* # arts in beginning */
05309   int final_art;                /* # arts in the end */
05310 
05311   int pI_iter;                  /* primal phase I iterations */
05312   int pII_iter;
05313   int dI_iter;                  /* dual phase I iterations */
05314   int dII_iter;
05315   int tot_iter;
05316 
05317   int pivpI[10];                /* sizes of pivots */
05318   int pivpII[10];
05319   int pivdI[10];
05320   int pivdII[10];
05321 }
05322 fp20_count_struct;
05323 
05324 /* structure for tolerances */
05325 typedef struct
05326 {
05327   EGfp20_t pfeas_tol;
05328   EGfp20_t dfeas_tol;
05329   EGfp20_t pivot_tol;
05330   EGfp20_t szero_tol;
05331   EGfp20_t ip_tol;              /* inner primal & dual feas toler */
05332   EGfp20_t id_tol;
05333 }
05334 fp20_tol_struct;
05335 
05336 /* bound information */
05337 typedef struct fp20_bndinfo
05338 {
05339   EGfp20_t pbound;
05340   EGfp20_t cbound;
05341   int btype;
05342   int varnum;
05343   struct fp20_bndinfo *next;
05344 }
05345 fp20_bndinfo;
05346 
05347 /* bound information */
05348 typedef struct fp20_coefinfo
05349 {
05350   EGfp20_t pcoef;
05351   EGfp20_t ccoef;
05352   int varnum;
05353   struct fp20_coefinfo *next;
05354 }
05355 fp20_coefinfo;
05356 
05357 /* feasibility info */
05358 typedef struct fp20_feas_info
05359 {
05360   int pstatus;
05361   int dstatus;
05362   EGfp20_t totinfeas;
05363 }
05364 fp20_feas_info;
05365 
05366 typedef struct fp20_lp_status_info
05367 {
05368   char optimal;
05369   char primal_feasible;
05370   char primal_infeasible;
05371   char primal_unbounded;
05372   char dual_feasible;
05373   char dual_infeasible;
05374   char dual_unbounded;
05375   char padd;
05376 }
05377 fp20_lp_status_info;
05378 
05379 typedef struct fp20_pI_uinfo
05380 {
05381   int tctr;
05382   int i;
05383   int *perm;
05384   int *ix;
05385   int fs;
05386   EGfp20_t piv;
05387   EGfp20_t *t;
05388   EGfp20_t dty;
05389   EGfp20_t c_obj;
05390   EGfp20_t tz;
05391 }
05392 fp20_pI_uinfo;
05393 
05394 extern void fp20_ILLlp_status_info_init (
05395   fp20_lp_status_info * ls);
05396 
05397 /* structure for local lp information
05398  * contains lp obj values - status - dimensions - input data -
05399  * solution vecs - basis info - update vecs - work vecs - bound changes -
05400  * tolerances - time info - statistics 
05401  */
05402 typedef struct fp20_lpinfo
05403 {
05404 
05405   EGfp20_t objval;              /* obj info */
05406   EGfp20_t pobjval;           /* intermediate status info */
05407   EGfp20_t dobjval;
05408   EGfp20_t pinfeas;
05409   EGfp20_t dinfeas;
05410   EGfp20_t objbound;
05411   fp20_lp_status_info probstat;     /* final status */
05412   fp20_lp_status_info basisstat;      /* final status */
05413   int nrows;                    /* input info follows; given in col format */
05414   int ncols;
05415   int *matcnt;
05416   int *matbeg;
05417   int *matind;
05418   EGfp20_t *matval;
05419   int matfree;
05420   int matsize;
05421   EGfp20_t *bz;
05422   EGfp20_t *lz;
05423   EGfp20_t *uz;
05424   EGfp20_t *cz;
05425   int localrows;                /* set to 1 if these are created locally */
05426   int *rowcnt;                  /* row info follows, copy of col info */
05427   int *rowbeg;
05428   int *rowind;
05429   EGfp20_t *rowval;
05430 
05431   EGfp20_t *xbz;                /* output info x, pi, reduced cost */
05432   EGfp20_t *piz;
05433   EGfp20_t *dz;
05434   EGfp20_t *pIxbz;              /* output info (phase I) x, pi, reduced cost */
05435   EGfp20_t *pIpiz;
05436   EGfp20_t *pIdz;
05437 
05438   int final_phase;              /* final phase, inf & unboundedness info */
05439   int infub_ix;
05440 
05441   int basisid;                  /* basis and variable info follows */
05442   int nnbasic;
05443   int *baz;
05444   int *nbaz;
05445   int *vstat;
05446   int *vindex;
05447   int fbasisid;
05448   fp20_factor_work *f;
05449   int *vtype;                   /* internal var info */
05450   char *vclass;                 /* structural or logical */
05451 
05452   fp20_svector zz;                    /* local fp20_ILLfactor_update vectors z, yj, za */
05453   fp20_svector yjz;
05454   fp20_svector zA;
05455   fp20_svector work;                  /* local work vector */
05456   fp20_svector srhs;                  /* local vectors for lin. eq. solves */
05457   fp20_svector ssoln;
05458   int *iwork;                   /* local work vector */
05459   fp20_pI_uinfo upd;                  /* phase I update info */
05460   int *bfeas;                   /* primal and dual infeasibility info */
05461   int *dfeas;
05462 
05463   fp20_tol_struct *tol;             /* tolerances */
05464   fp20_count_struct *cnts;            /* counts */
05465   int nbchange;                 /* # bound shifts */
05466   int ncchange;                 /* # obj coef shifts */
05467   fp20_bndinfo *bchanges;           /* list of bound shifts */
05468   fp20_coefinfo *cchanges;            /* list of coef shifts */
05469   int pIratio;                  /* ratio tests */
05470   int pIIratio;
05471   int dIratio;
05472   int dIIratio;
05473 
05474   int maxiter;
05475   int iterskip;
05476   double maxtime;
05477   double starttime;
05478   struct fp20_ILLlpdata *O;
05479   ILLrandstate rstate;
05480 
05481 }
05482 fp20_lpinfo;
05483 
05484 /* pricing structures */
05485 typedef struct
05486 {
05487   int ninit;
05488   EGfp20_t *norms;
05489   int *refframe;
05490 }
05491 fp20_p_devex_info;
05492 
05493 typedef struct
05494 {
05495   EGfp20_t *norms;
05496 }
05497 fp20_p_steep_info;
05498 
05499 typedef struct
05500 {
05501   int k;
05502   int cgroup;
05503   int ngroups;
05504   int *gstart;
05505   int *gshift;
05506   int *gsize;
05507   int bsize;
05508   int *bucket;
05509   int *perm;
05510   EGfp20_t *infeas;
05511 }
05512 fp20_mpart_info;
05513 
05514 typedef struct
05515 {
05516   int ninit;
05517   EGfp20_t *norms;
05518   int *refframe;
05519 }
05520 fp20_d_devex_info;
05521 
05522 typedef struct
05523 {
05524   EGfp20_t *norms;
05525 }
05526 fp20_d_steep_info;
05527 
05528 /* pricing information */
05529 typedef struct fp20_price_info
05530 {
05531   int p_strategy;
05532   int d_strategy;
05533   int pI_price;
05534   int pII_price;
05535   int dI_price;
05536   int dII_price;
05537   int cur_price;
05538   EGfp20_t *p_scaleinf;
05539   EGfp20_t *d_scaleinf;
05540   fp20_p_devex_info pdinfo;
05541   fp20_p_steep_info psinfo;
05542   fp20_mpart_info pmpinfo;
05543   fp20_d_devex_info ddinfo;
05544   fp20_d_steep_info dsinfo;
05545   fp20_mpart_info dmpinfo;
05546   fp20_heap h;
05547   EGfp20_t htrigger;
05548   int hineff;
05549   char init;
05550 }
05551 fp20_price_info;
05552 
05553 #endif /* fp20___QS_LPDEFS_H */
05554 /****************************************************************************/
05555 /*                                                                          */
05556 /*  This file is part of QSopt_ex.                                          */
05557 /*                                                                          */
05558 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
05559 /*  and Daniel Espinoza                                                     */
05560 /*                                                                          */
05561 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
05562 /*  copyright in QSopt.                                                     */
05563 /*                                                                          */
05564 /*  This code may be used under the terms of the GNU General Public License */
05565 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
05566 /*                                                                          */
05567 /*  Alternatively, use is granted for research purposes only.               */
05568 /*                                                                          */
05569 /*  It is your choice of which of these two licenses you are operating      */
05570 /*  under.                                                                  */
05571 /*                                                                          */
05572 /*  We make no guarantees about the correctness or usefulness of this code. */
05573 /*                                                                          */
05574 /****************************************************************************/
05575 
05576 /* RCSINFO $Id: rdline.h,v 1.2 2003/11/05 16:57:39 meven Exp $ */
05577 #ifndef fp20_LINE_READER_FILE_H
05578 #define fp20_LINE_READER_FILE_H
05579 
05580 
05581 /* #ifdef _WINDOWS */
05582 typedef char *(
05583   *fp20_qsread_line_fct) (
05584   char *s,
05585   int size,
05586   void *src);
05587 
05588 typedef struct fp20_qsline_reader
05589 {
05590   fp20_qsread_line_fct read_line_fct;
05591   void *data_src;
05592   struct fp20_qserror_collector *error_collector;
05593 }
05594 fp20_qsline_reader;
05595 
05596 fp20_qsline_reader *fp20_ILLline_reader_new (
05597   fp20_qsread_line_fct fct,
05598   void *data_src);
05599 void fp20_ILLline_reader_free (
05600   fp20_qsline_reader * reader);
05601 
05602 #define fp20_ILLline_reader_get(s, size, reader)  \
05603   (reader)->read_line_fct(s, size, (reader)->data_src)
05604                    /* used by parsers to retrieve next input line */
05605 /* #else  
05606  *
05607  * typedef FILE fp20_qsline_reader; 
05608  *
05609  * #define fp20_ILLline_reader_new(fct, data) ((FILE*) (data)) 
05610  * #define fp20_ILLline_reader_free(reader)  
05611  * #define fp20_ILLline_reader_get(s, size, reader) fgets(s,size,reader) 
05612  * #endif 
05613  */
05614 
05615 #endif
05616 /****************************************************************************/
05617 /*                                                                          */
05618 /*  This file is part of QSopt_ex.                                          */
05619 /*                                                                          */
05620 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
05621 /*  and Daniel Espinoza                                                     */
05622 /*                                                                          */
05623 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
05624 /*  copyright in QSopt.                                                     */
05625 /*                                                                          */
05626 /*  This code may be used under the terms of the GNU General Public License */
05627 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
05628 /*                                                                          */
05629 /*  Alternatively, use is granted for research purposes only.               */
05630 /*                                                                          */
05631 /*  It is your choice of which of these two licenses you are operating      */
05632 /*  under.                                                                  */
05633 /*                                                                          */
05634 /*  We make no guarantees about the correctness or usefulness of this code. */
05635 /*                                                                          */
05636 /****************************************************************************/
05637 
05638 /* RCSINFO $Id: fp20_lpdata.h,v 1.4 2003/11/05 17:00:56 meven Exp $ */
05639 #ifndef fp20_ILL_LPDATA_H
05640 #define fp20_ILL_LPDATA_H
05641 
05642 
05643 extern EGfp20_t fp20_ILL_MAXDOUBLE; /*  1e150 */
05644 extern EGfp20_t fp20_ILL_MINDOUBLE; /* -1e150 */
05645 
05646 #define fp20_ILL_MAXINT    (2147483647) /* this is equal to 2^31-1 */
05647 #define fp20_ILL_MIN       (1)        /* Must be same as QS_MIN */
05648 #define fp20_ILL_MAX       (-1)     /* Must be same as QS_MAX */
05649 
05650 /*  Setting Alg in Presolve  */
05651 
05652 #define fp20_ILL_PRE_SCALE           1
05653 #define fp20_ILL_PRE_FIXED           2
05654 #define fp20_ILL_PRE_SINGLE_ROW      4
05655 #define fp20_ILL_PRE_FORCING         8
05656 #define fp20_ILL_PRE_SINGLE_COL     16
05657 #define fp20_ILL_PRE_DUPLICATE_ROW  32
05658 #define fp20_ILL_PRE_DUPLICATE_COL  64
05659 #define fp20_ILL_PRE_EMPTY_COL     128
05660 #define fp20_ILL_PRE_ALL (fp20_ILL_PRE_SCALE | fp20_ILL_PRE_FIXED | fp20_ILL_PRE_SINGLE_ROW           \
05661                     fp20_ILL_PRE_FORCING | fp20_ILL_PRE_SINGLE_COL | fp20_ILL_PRE_DUPLICATE_ROW \
05662                    fp20_ILL_PRE_DUPLICATE_COL | fp20_ILL_PRE_EMPTY_COL)
05663 #define fp20_ILL_PRE_SIMPLE (fp20_ILL_PRE_FIXED | fp20_ILL_PRE_EMPTY_COL)
05664 
05665 typedef struct fp20_ILLlpdata
05666 {                               /* Complete LP data filled in by mpsread.  */
05667   int nrows;
05668   int ncols;
05669   int nstruct;                  /* Not including logicals.                 */
05670   int nzcount;
05671   int rowsize;                  /* Length of row arrays.                   */
05672   int colsize;                  /* Length of col arrays.                   */
05673   int structsize;               /* Length of intmarker, structmap,         */
05674   /* colnames                                */
05675   int objsense;
05676   char *sense;                  /* Original sense, not after logicals.     */
05677   EGfp20_t *obj;
05678   EGfp20_t *rhs;
05679   EGfp20_t *rangeval;
05680   EGfp20_t *lower;
05681   EGfp20_t *upper;
05682   fp20_ILLmatrix A;                 /* The coef matrix.                        */
05683   struct fp20_ILLlp_rows *rA;       /* Coef matrix in row form.                */
05684 
05685   char **rownames;
05686   ILLsymboltab rowtab;          /* contains rownames in no particular order */
05687   char *objname;                /* if colname is not NULL it is entered into 
05688                                  * the rowtab, see reader fcts in fp20_lp.c, fp20_mps.c*/
05689 
05690   char **colnames;              /* columns of struct variables */
05691   ILLsymboltab coltab;          /* contains colnames in no particular order */
05692 
05693   char *probname;
05694   char *intmarker;
05695   int *structmap;               /* Indices of structural variables         */
05696   int *rowmap;                  /* Indices of logical and range variables  */
05697   struct fp20_ILLlp_basis *basis;
05698   struct fp20_ILLlp_predata *presolve;
05699   struct fp20_ILLlp_sinfo *sinfo;
05700 
05701    /**************************************************************************/
05702   /* these fields are currently only set by fp20_mps.c reader fcts               */
05703    /**************************************************************************/
05704   fp20_ILLmatrix sos;               /* columns are the sets, rows are the  
05705                                  * problem's structural variables
05706                                  * coefficients are the weights */
05707 
05708   char *sos_type;               /* type of each set */
05709   int *is_sos_mem;              /* for each structural variable contains 
05710                                  *    -1 == not a set member
05711                                  *     i == member of sos set i 
05712                                  *          where 0 <= i < sos.matcols */
05713   char *refrowname;             /* name of reference row */
05714   int refind;                   /* index of reference row 
05715                                  *     -1 if refrow was a free row 
05716                                  *          and weights are found only in the 
05717                                  *          sos matrix 
05718                                  *     index >=0 if refrow is also a lp-row */
05719 
05720    /**************************************************************************
05721     * fp20_QSset_reporter initializes reporter 
05722     **************************************************************************/
05723   qsstring_reporter reporter;   /* used from within ILL fcts 
05724                                  * to report fp20_feedback */
05725 }
05726 fp20_ILLlpdata;
05727 
05728 typedef struct fp20_ILLlp_basis
05729 {
05730   int nstruct;
05731   int nrows;
05732   int rownorms_size;
05733   int colnorms_size;
05734   char *cstat;
05735   char *rstat;
05736   EGfp20_t *rownorms;
05737   EGfp20_t *colnorms;
05738 }
05739 fp20_ILLlp_basis;
05740 
05741 typedef struct fp20_ILLlp_cache
05742 {
05743   int nstruct;
05744   int nrows;
05745   int status;
05746   EGfp20_t val;
05747   EGfp20_t *x;
05748   EGfp20_t *pi;
05749   EGfp20_t *rc;
05750   EGfp20_t *slack;
05751 }
05752 fp20_ILLlp_cache;
05753 
05754 typedef struct fp20_ILLlp_sinfo
05755 {                               /* LP info returned by presolve            */
05756   int ncols;
05757   int nrows;
05758   int nzcount;
05759   int rowsize;
05760   int colsize;
05761   int objsense;
05762 
05763   EGfp20_t *obj;
05764   EGfp20_t *rhs;
05765   EGfp20_t *lower;
05766   EGfp20_t *upper;
05767 
05768   fp20_ILLmatrix A;
05769 
05770   char **colnames;              /* Just for debugging - not updated */
05771 }
05772 fp20_ILLlp_sinfo;
05773 
05774 typedef struct fp20_ILLlp_preline
05775 {
05776   EGfp20_t rhs;
05777   EGfp20_t obj;
05778   EGfp20_t lower;
05779   EGfp20_t upper;
05780   int count;
05781   int *ind;
05782   int row_or_col;               /* 0 is row, 1 is col */
05783   EGfp20_t *val;
05784 }
05785 fp20_ILLlp_preline;
05786 
05787 typedef struct fp20_ILLlp_preop
05788 {
05789   int ptype;
05790   int rowindex;
05791   int colindex;
05792   fp20_ILLlp_preline line;
05793 }
05794 fp20_ILLlp_preop;
05795 
05796 typedef struct fp20_ILLlp_predata
05797 {                               /* Data needed in un-presolve.            */
05798   int opcount;
05799   int opsize;
05800   fp20_ILLlp_preop *oplist;
05801   int r_nrows;
05802   int r_ncols;
05803   int *colmap;
05804   int *rowmap;
05805   EGfp20_t *rowscale;
05806   EGfp20_t *colscale;
05807   EGfp20_t *colfixval;
05808   EGfp20_t *rowfixval;
05809 }
05810 fp20_ILLlp_predata;
05811 
05812 typedef struct fp20_ILLlp_rows
05813 {
05814   int *rowbeg;
05815   int *rowcnt;
05816   int *rowind;
05817   EGfp20_t *rowval;
05818 }
05819 fp20_ILLlp_rows;
05820 
05821 
05822 /****************************************************************************/
05823 /*                                                                          */
05824 /*                             fp20_lpdata.c                                     */
05825 /*                                                                          */
05826 /****************************************************************************/
05827 
05828 struct fp20_qsdata *fp20_ILLread (
05829   fp20_qsline_reader * file,
05830   const char *fp20_fname,
05831   int isMps);
05832 void fp20_ILLstart (
05833   void);              /**< initialize fp20_ILL_MAXDOUBLE and other 
05834 
05835                            constants, this funtion should be callef AFTER 
05836                            EGlpNumStart() */
05837 void fp20_ILLend (
05838   void);            /**< free any internal data asociated with variable 
05839 
05840                          fp20_precision numbers */
05841 void fp20_ILLchange_precision (
05842   void);                        /**< This function re-compute the internal 
05843 
05844                                      variables fp20_precision to the (previously 
05845                                      set) EGLPNUM_PRECISION value (done with 
05846                                      EGlpNumSetPrecision) */
05847 void fp20_ILLlpdata_init (
05848   fp20_ILLlpdata * lp);
05849 void fp20_ILLlpdata_free (
05850   fp20_ILLlpdata * lp);
05851 void fp20_ILLlp_basis_init (
05852   fp20_ILLlp_basis * B);
05853 void fp20_ILLlp_basis_free (
05854   fp20_ILLlp_basis * B);
05855 void fp20_ILLlp_cache_init (
05856   fp20_ILLlp_cache * C);
05857 void fp20_ILLlp_cache_free (
05858   fp20_ILLlp_cache * C);
05859 int fp20_ILLlp_basis_alloc (
05860   fp20_ILLlp_basis * B,
05861   int ncols,
05862   int nrows);
05863 int fp20_ILLlp_cache_alloc (
05864   fp20_ILLlp_cache * C,
05865   int ncols,
05866   int nrows);
05867 
05868 int fp20_ILLlp_rows_init (
05869   fp20_ILLlp_rows * lp_rows,
05870   fp20_ILLlpdata * lp,
05871   int include_logicals);
05872 void fp20_ILLlp_rows_clear (
05873   fp20_ILLlp_rows * lp_rows);
05874 int fp20_ILLprint_report (
05875   fp20_ILLlpdata * lp,
05876   const char *format,
05877   ...);
05878 
05879               /* print to lp->reporter */
05880 
05881 /****************************************************************************/
05882 /*                                                                          */
05883 /*                             fp20_presolve.c                                   */
05884 /*                                                                          */
05885 /****************************************************************************/
05886 
05887 void fp20_ILLlp_sinfo_init (
05888   fp20_ILLlp_sinfo * sinfo),
05889   fp20_ILLlp_sinfo_free (
05890   fp20_ILLlp_sinfo * sinfo),
05891   fp20_ILLlp_predata_init (
05892   fp20_ILLlp_predata * pre),
05893   fp20_ILLlp_predata_free (
05894   fp20_ILLlp_predata * pre);
05895 
05896 int fp20_ILLlp_add_logicals (
05897   fp20_ILLlpdata * lp),
05898   fp20_ILLlp_scale (
05899   fp20_ILLlpdata * lp),
05900   fp20_ILLlp_presolve (
05901   fp20_ILLlpdata * lp,
05902   int pre_types);
05903 
05904 /* ========================================================================= */
05905 /* if non-zero, then internal data has been initialized, and there is some
05906  * memory allocated, if zero, no internal memory has been allocated
05907  * (or it has been freed) */
05908 extern int fp20___QSEX_SETUP;
05909 
05910 #endif /* __ILL_LPDATA_H */
05911 /****************************************************************************/
05912 /*                                                                          */
05913 /*  This file is part of QSopt_ex.                                          */
05914 /*                                                                          */
05915 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
05916 /*  and Daniel Espinoza                                                     */
05917 /*                                                                          */
05918 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
05919 /*  copyright in QSopt.                                                     */
05920 /*                                                                          */
05921 /*  This code may be used under the terms of the GNU General Public License */
05922 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
05923 /*                                                                          */
05924 /*  Alternatively, use is granted for research purposes only.               */
05925 /*                                                                          */
05926 /*  It is your choice of which of these two licenses you are operating      */
05927 /*  under.                                                                  */
05928 /*                                                                          */
05929 /*  We make no guarantees about the correctness or usefulness of this code. */
05930 /*                                                                          */
05931 /****************************************************************************/
05932 
05933 /* RCSINFO $Id: fp20_basis.h,v 1.3 2003/11/05 16:57:39 meven Exp $ */
05934 #ifndef fp20___BASIS_H
05935 #define fp20___BASIS_H
05936 
05937 
05938 #if 0
05939 #if EGLPNUM_TYPE != DBL_TYPE && EGLPNUM_TYPE != LDBL_TYPE
05940 extern EGfp20_t fp20_CB_PRI_RLIMIT; /* = 0.25 */
05941 extern EGfp20_t fp20_CB_INF_RATIO;  /* = 10.0 */
05942 extern EGfp20_t fp20_CB_EPS;        /* = 0.001 */
05943 #endif
05944 #endif
05945 
05946 typedef struct fp20_var_data
05947 {
05948   int nartif;
05949   int nslacks;
05950   int nfree;
05951   int nbndone;
05952   int nbounded;
05953   int nfixed;
05954   EGfp20_t cmax;
05955 }
05956 fp20_var_data;
05957 
05958 void fp20_ILLbasis_init_vardata (
05959   fp20_var_data * vd);
05960 void fp20_ILLbasis_clear_vardata (
05961   fp20_var_data * vd);
05962 
05963 int fp20_ILLbasis_build_basisinfo (
05964   fp20_lpinfo * lp),
05965   fp20_ILLbasis_get_initial (
05966   fp20_lpinfo * lp,
05967   int algorithm),
05968   fp20_ILLbasis_get_cinitial (
05969   fp20_lpinfo * lp,
05970   int algorithm),
05971   fp20_ILLbasis_load (
05972   fp20_lpinfo * lp,
05973   fp20_ILLlp_basis * B),
05974   fp20_ILLbasis_tableau_row (
05975   fp20_lpinfo * lp,
05976   int row,
05977   EGfp20_t * brow,
05978   EGfp20_t * trow,
05979   EGfp20_t * rhs,
05980   int strict),
05981   fp20_ILLbasis_factor (
05982   fp20_lpinfo * lp,
05983   int *singular),
05984   fp20_ILLbasis_refactor (
05985   fp20_lpinfo * lp),
05986   fp20_ILLbasis_update (
05987   fp20_lpinfo * lp,
05988   fp20_svector * y,
05989   int lindex,
05990   int *refactor,
05991   int *singular);
05992 
05993 void fp20_ILLbasis_column_solve (
05994   fp20_lpinfo * lp,
05995   fp20_svector * rhs,
05996   fp20_svector * soln),
05997   fp20_ILLbasis_column_solve_update (
05998   fp20_lpinfo * lp,
05999   fp20_svector * rhs,
06000   fp20_svector * upd,
06001   fp20_svector * soln),
06002   fp20_ILLbasis_row_solve (
06003   fp20_lpinfo * lp,
06004   fp20_svector * rhs,
06005   fp20_svector * soln),
06006   fp20_ILLbasis_free_basisinfo (
06007   fp20_lpinfo * lp),
06008   fp20_ILLbasis_free_fbasisinfo (
06009   fp20_lpinfo * lp),
06010   fp20_ILLbasis_init_basisinfo (
06011   fp20_lpinfo * lp);
06012 
06013 #endif /* fp20___BASIS_H */
06014 /****************************************************************************/
06015 /*                                                                          */
06016 /*  This file is part of QSopt_ex.                                          */
06017 /*                                                                          */
06018 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
06019 /*  and Daniel Espinoza                                                     */
06020 /*                                                                          */
06021 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
06022 /*  copyright in QSopt.                                                     */
06023 /*                                                                          */
06024 /*  This code may be used under the terms of the GNU General Public License */
06025 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
06026 /*                                                                          */
06027 /*  Alternatively, use is granted for research purposes only.               */
06028 /*                                                                          */
06029 /*  It is your choice of which of these two licenses you are operating      */
06030 /*  under.                                                                  */
06031 /*                                                                          */
06032 /*  We make no guarantees about the correctness or usefulness of this code. */
06033 /*                                                                          */
06034 /****************************************************************************/
06035 
06036 #ifndef fp20___DHEAPS_I_H__
06037 #define fp20___DHEAPS_I_H__
06038 /****************************************************************************/
06039 /*                                                                          */
06040 /*                             fp20_dheaps_i.c                                   */
06041 /*                                                                          */
06042 /****************************************************************************/
06043 
06044 typedef struct fp20_ILLdheap
06045 {
06046   EGfp20_t *key;
06047   int *entry;
06048   int *loc;
06049   int total_space;
06050   int size;
06051 }
06052 fp20_ILLdheap;
06053 
06054 void fp20_ILLutil_dheap_free (
06055   fp20_ILLdheap * h),
06056   fp20_ILLutil_dheap_delete (
06057   fp20_ILLdheap * h,
06058   int i),
06059   fp20_ILLutil_dheap_changekey (
06060   fp20_ILLdheap * h,
06061   int i,
06062   EGfp20_t * newkey),
06063   fp20_ILLutil_dheap_findmin (
06064   fp20_ILLdheap * h,
06065   int *i),
06066   fp20_ILLutil_dheap_deletemin (
06067   fp20_ILLdheap * h,
06068   int *i);
06069 
06070 int fp20_ILLutil_dheap_init (
06071   fp20_ILLdheap * h,
06072   int k),
06073   fp20_ILLutil_dheap_resize (
06074   fp20_ILLdheap * h,
06075   int newsize),
06076   fp20_ILLutil_dheap_insert (
06077   fp20_ILLdheap * h,
06078   int i);
06079 
06080 
06081 
06082 #endif
06083 /****************************************************************************/
06084 /*                                                                          */
06085 /*  This file is part of QSopt_ex.                                          */
06086 /*                                                                          */
06087 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
06088 /*  and Daniel Espinoza                                                     */
06089 /*                                                                          */
06090 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
06091 /*  copyright in QSopt.                                                     */
06092 /*                                                                          */
06093 /*  This code may be used under the terms of the GNU General Public License */
06094 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
06095 /*                                                                          */
06096 /*  Alternatively, use is granted for research purposes only.               */
06097 /*                                                                          */
06098 /*  It is your choice of which of these two licenses you are operating      */
06099 /*  under.                                                                  */
06100 /*                                                                          */
06101 /*  We make no guarantees about the correctness or usefulness of this code. */
06102 /*                                                                          */
06103 /****************************************************************************/
06104 
06105 /*  $RCSfile: fp20_qsopt.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
06106 #ifndef fp20___QS_QSOPT_H
06107 #define fp20___QS_QSOPT_H
06108 
06109 
06110 #ifdef WIN32
06111 
06112 #ifdef QSLIB_EXPORTS
06113 #define fp20_QSLIB_INTERFACE __declspec(dllexport)
06114 #else
06115 #define fp20_QSLIB_INTERFACE __declspec(dllimport)
06116 #endif
06117 
06118 #else
06119 #define fp20_QSLIB_INTERFACE extern
06120 #endif
06121 
06122 #ifdef WIN32
06123 typedef struct fp20_QSLIB_INTERFACE fp20_qsdata *fp20_QSprob;
06124 typedef struct fp20_QSLIB_INTERFACE qsbasis *fp20_QSbas;
06125 #else
06126 typedef struct fp20_qsdata *fp20_QSprob;
06127 typedef struct qsbasis *fp20_QSbas;
06128 #endif
06129 
06130 /****************************************************************************/
06131 /*                                                                          */
06132 /*                 PARAMETERS TO SPECIFY OBJECTIVE SENSE                    */
06133 /*                                                                          */
06134 /****************************************************************************/
06135 /*
06136 #define QS_LP_PRIMAL_FEASIBLE   11
06137 #define QS_LP_PRIMAL_INFEASIBLE 12
06138 #define QS_LP_PRIMAL_UNBOUNDED  13
06139 #define QS_LP_DUAL_FEASIBLE     14
06140 #define QS_LP_DUAL_INFEASIBLE   15
06141 #define QS_LP_DUAL_UNBOUNDED    16
06142 */
06143 
06144 /****************************************************************************/
06145 /*                                                                          */
06146 /*                      QSopt Library Functions                             */
06147 /*                                                                          */
06148 /****************************************************************************/
06149 #ifdef  __cplusplus
06150 extern "C"
06151 {
06152 #endif
06153 
06154 #ifdef WIN32
06155 /* 
06156  *  in WINDOWS we make 
06157  *     fp20_solver_main/fp20_reader_main part of DLL
06158  */
06159 fp20_QSLIB_INTERFACE int fp20_solver_main ( int argc, char **argv);
06160 fp20_QSLIB_INTERFACE int fp20_reader_main ( int argc, char **argv);
06161 #endif
06162 
06163 fp20_QSLIB_INTERFACE void fp20_QSfree ( void *ptr),
06164     fp20_QSfree_prob ( fp20_QSprob p),
06165     fp20_QSfree_basis ( fp20_QSbas B),
06166     fp20_QSset_precision ( const unsigned prec),/**< set the fp20_precision for floating 
06167                                                  point numbers to the given 
06168                                                  number of bits */
06169     fp20_QSstart ( void),/**< whe we use non native numbers, we need to make 
06170                          some initializations before operating with the
06171                          library */
06172     fp20_QSend ( void); /**< just to free any internal static data needed by
06173                          the variable fp20_precision numbers */
06174 
06175 fp20_QSLIB_INTERFACE int fp20_QSopt_primal ( fp20_QSprob p, int *status),
06176     fp20_QSopt_dual ( fp20_QSprob p, int *status),
06177     fp20_QSopt_pivotin_col ( fp20_QSprob p, int ccnt, int *clist),
06178     fp20_QSopt_pivotin_row ( fp20_QSprob p, int rcnt, int *rlist),
06179     fp20_QSopt_strongbranch ( fp20_QSprob p, int ncand, int *candidatelist,
06180       EGfp20_t * xlist, EGfp20_t * down_vals, EGfp20_t * up_vals,
06181       int iterations, EGfp20_t objbound),
06182     fp20_QSchange_objsense ( fp20_QSprob p, int newsense),
06183     fp20_QSget_objsense ( fp20_QSprob p, int *newsense),
06184     fp20_QSnew_col ( fp20_QSprob p,const EGfp20_t obj,const EGfp20_t lower,const EGfp20_t upper,
06185       const char *name),
06186     fp20_QSadd_cols ( fp20_QSprob p, int num, int *cmatcnt, int *cmatbeg, int *cmatind,
06187       EGfp20_t * cmatval, EGfp20_t * obj, EGfp20_t * lower,
06188       EGfp20_t * upper, const char **names),
06189     fp20_QSadd_col ( fp20_QSprob p, int cnt, int *cmatind, EGfp20_t * cmatval,
06190       EGfp20_t obj, EGfp20_t lower, EGfp20_t upper, const char *name),
06191     fp20_QSnew_row ( fp20_QSprob p,const EGfp20_t rhs, int sense, const char *name),
06192     fp20_QSadd_ranged_rows ( fp20_QSprob p, int num, int *rmatcnt, int *rmatbeg, 
06193       int *rmatind,const EGfp20_t * rmatval,const EGfp20_t * rhs, char *sense,
06194       const EGfp20_t* range, const char **names),
06195     fp20_QSadd_ranged_row ( fp20_QSprob p, int cnt, int *rmatind,const EGfp20_t * rmatval,
06196       const EGfp20_t * rhs, int sense,const EGfp20_t * range, const char *name),
06197     fp20_QSadd_rows ( fp20_QSprob p, int num, int *rmatcnt, int *rmatbeg, int *rmatind,
06198       const EGfp20_t * rmatval,const EGfp20_t * rhs, char *sense, const char **names),
06199     fp20_QSadd_row ( fp20_QSprob p, int cnt, int *rmatind,const EGfp20_t * rmatval,
06200       const EGfp20_t * rhs, int sense, const char *name),
06201     fp20_QSdelete_rows ( fp20_QSprob p, int num, int *dellist),
06202     fp20_QSdelete_row ( fp20_QSprob p, int rowindex),
06203     fp20_QSdelete_setrows ( fp20_QSprob p, int *flags),
06204     fp20_QSdelete_named_row ( fp20_QSprob p, const char *rowname),
06205     fp20_QSdelete_named_rows_list ( fp20_QSprob p, int num, const char **rownames),
06206     fp20_QSdelete_cols ( fp20_QSprob p, int num, int *dellist),
06207     fp20_QSdelete_col ( fp20_QSprob p, int colindex),
06208     fp20_QSdelete_setcols ( fp20_QSprob p, int *flags),
06209     fp20_QSdelete_named_column ( fp20_QSprob p, const char *colname),
06210     fp20_QSdelete_named_columns_list ( fp20_QSprob p, int num, const char **colnames),
06211     fp20_QSchange_senses ( fp20_QSprob p, int num, int *rowlist, char *sense),
06212     fp20_QSchange_sense ( fp20_QSprob p, int rowindex, int sense),
06213     fp20_QSchange_coef ( fp20_QSprob p, int rowindex, int colindex, EGfp20_t coef),
06214     fp20_QSchange_objcoef ( fp20_QSprob p, int indx, EGfp20_t coef),
06215     fp20_QSchange_rhscoef ( fp20_QSprob p, int indx, EGfp20_t coef),
06216     fp20_QSchange_range(fp20_QSprob p, int rowindex, EGfp20_t range),
06217     fp20_QSchange_bounds ( fp20_QSprob p, int num, int *collist, char *lu, 
06218       const EGfp20_t * bounds),
06219     fp20_QSchange_bound ( fp20_QSprob p, int indx, int lu,const EGfp20_t bound),
06220     fp20_QSload_basis ( fp20_QSprob p, fp20_QSbas B),
06221     fp20_QSread_and_load_basis ( fp20_QSprob p, const char *filename),
06222     fp20_QSload_basis_array ( fp20_QSprob p, char *cstat, char *rstat),
06223     fp20_QSload_basis_and_row_norms_array ( fp20_QSprob p, char *cstat, char *rstat, 
06224       EGfp20_t * rownorms),
06225     fp20_QSget_basis_array ( fp20_QSprob p, char *cstat, char *rstat),
06226     fp20_QSget_basis_and_row_norms_array ( fp20_QSprob p, char *cstat, char *rstat,
06227       EGfp20_t * rownorms),
06228     fp20_QSget_binv_row ( fp20_QSprob p, int indx, EGfp20_t * binvrow),
06229     fp20_QSget_tableau_row ( fp20_QSprob p, int indx, EGfp20_t * tableaurow),
06230     fp20_QSget_basis_order ( fp20_QSprob p, int *basorder), 
06231     fp20_QSget_coef (fp20_QSprob p, int rowindex, int colindex, EGfp20_t*coef),
06232     fp20_QSget_status ( fp20_QSprob p, int *status),
06233     fp20_QSget_solution ( fp20_QSprob p, EGfp20_t * value, EGfp20_t * x,
06234       EGfp20_t * pi, EGfp20_t * slack, EGfp20_t * rc),
06235     fp20_QSget_objval ( fp20_QSprob p, EGfp20_t * value),
06236     fp20_QSget_pi_array ( fp20_QSprob p, EGfp20_t * pi),
06237     fp20_QSget_rc_array ( fp20_QSprob p, EGfp20_t * rc),
06238     fp20_QSget_x_array ( fp20_QSprob p, EGfp20_t * x),
06239     fp20_QSget_slack_array ( fp20_QSprob p, EGfp20_t * slack),
06240     fp20_QSget_infeas_array ( fp20_QSprob p, EGfp20_t * pi),
06241     fp20_QSget_colcount ( fp20_QSprob p),
06242     fp20_QSget_rowcount ( fp20_QSprob p),
06243     fp20_QSget_nzcount ( fp20_QSprob p),
06244     fp20_QSget_obj_list(fp20_QSprob p, int num, int*collist, EGfp20_t*obj),
06245     fp20_QSget_obj ( fp20_QSprob p, EGfp20_t * obj),
06246     fp20_QSget_rhs ( fp20_QSprob p, EGfp20_t * rhs),
06247     fp20_QSget_ranged_rows_list ( fp20_QSprob p, int num, int *rowlist, int **rowcnt,
06248       int **rowbeg, int **rowind, EGfp20_t ** rowval, EGfp20_t ** rhs,
06249       char **sense, EGfp20_t **range, char ***names),
06250     fp20_QSget_ranged_rows ( fp20_QSprob p, int **rowcnt, int **rowbeg, int **rowind,
06251       EGfp20_t ** rowval, EGfp20_t ** rhs, char **sense, 
06252       EGfp20_t ** range, char ***names),
06253     fp20_QSget_senses ( fp20_QSprob p, char*senses),
06254     fp20_QSget_rows_list ( fp20_QSprob p, int num, int *rowlist, int **rowcnt,
06255       int **rowbeg, int **rowind, EGfp20_t ** rowval, EGfp20_t ** rhs,
06256       char **sense, char ***names),
06257     fp20_QSget_rows ( fp20_QSprob p, int **rowcnt, int **rowbeg, int **rowind,
06258       EGfp20_t ** rowval, EGfp20_t ** rhs, char **sense, char ***names),
06259     fp20_QSget_columns_list ( fp20_QSprob p, int num, int *collist, int **colcnt,
06260       int **colbeg, int **colind, EGfp20_t ** colval, EGfp20_t ** obj,
06261       EGfp20_t ** lower, EGfp20_t ** upper, char ***names),
06262     fp20_QSget_columns ( fp20_QSprob p, int **colcnt, int **colbeg, int **colind,
06263       EGfp20_t ** colval, EGfp20_t ** obj, EGfp20_t ** lower,
06264       EGfp20_t ** upper, char ***names),
06265     fp20_QSget_rownames ( fp20_QSprob p, char **rownames),
06266     fp20_QSget_colnames ( fp20_QSprob p, char **colnames),
06267     fp20_QSget_bound ( fp20_QSprob p, int colindex, int lu, EGfp20_t * bound),
06268     fp20_QSget_bounds ( fp20_QSprob p, EGfp20_t * lower, EGfp20_t * upper),
06269     fp20_QSget_bounds_list(fp20_QSprob p, int num, int*collist, EGfp20_t*lb,
06270       EGfp20_t*ub),
06271     fp20_QSget_intflags ( fp20_QSprob p, int *intflags),
06272     fp20_QSget_intcount ( fp20_QSprob p, int *count),
06273     fp20_QSget_column_index ( fp20_QSprob p, const char *name, int *colindex),
06274     fp20_QSget_row_index ( fp20_QSprob p, const char *name, int *rowindex),
06275     fp20_QSget_named_x ( fp20_QSprob p, const char *colname, EGfp20_t * val),
06276     fp20_QSget_named_rc ( fp20_QSprob p, const char *colname, EGfp20_t * val),
06277     fp20_QSget_named_pi ( fp20_QSprob p, const char *rowname, EGfp20_t * val),
06278     fp20_QSget_named_slack ( fp20_QSprob p, const char *rowname, EGfp20_t * val),
06279     fp20_QScompute_row_norms ( fp20_QSprob p),
06280     fp20_QSwrite_prob ( fp20_QSprob p, const char *filename, const char *filetype),
06281     fp20_QSwrite_prob_file ( fp20_QSprob p, FILE * file, const char *filetype),
06282     fp20_QSwrite_basis ( fp20_QSprob p, fp20_QSbas B, const char *filename),
06283     fp20_QStest_row_norms ( fp20_QSprob p),
06284     fp20_QSget_itcnt(fp20_QSprob p, int *pI_iter, int *pII_iter, int *dI_iter,
06285       int *dII_iter, int *tot_iter),
06286     fp20_QSset_param ( fp20_QSprob p, int whichparam, int newvalue),
06287     fp20_QSset_param_EGlpNum ( fp20_QSprob p, int whichparam, EGfp20_t newvalue),
06288     fp20_QSget_param ( fp20_QSprob p, int whichparam, int *value),
06289     fp20_QSget_param_EGlpNum ( fp20_QSprob p, int whichparam, EGfp20_t * value); 
06290 
06291 fp20_QSLIB_INTERFACE char *fp20_QSget_probname ( fp20_QSprob p);
06292 fp20_QSLIB_INTERFACE char *fp20_QSget_objname ( fp20_QSprob p);
06293 fp20_QSLIB_INTERFACE char *fp20_QSversion ( void);
06294 
06295 fp20_QSLIB_INTERFACE fp20_QSprob fp20_QScreate_prob ( const char *name, int objsense),
06296     fp20_QSread_prob ( const char *filename, const char *filetype),
06297     fp20_QSload_prob ( const char *probname, int ncols, int nrows, int *cmatcnt,
06298       int *cmatbeg, int *cmatind, EGfp20_t * cmatval, int objsense,
06299       EGfp20_t * obj, EGfp20_t * rhs, char *sense, EGfp20_t * lower,
06300       EGfp20_t * upper, const char **colnames, const char **rownames),
06301     fp20_QScopy_prob ( fp20_QSprob p, const char *newname);
06302 
06303 fp20_QSLIB_INTERFACE fp20_QSbas fp20_QSget_basis ( fp20_QSprob p),
06304     fp20_QSread_basis ( fp20_QSprob p, const char *filename);
06305 
06306 #ifdef  __cplusplus
06307 }
06308 #endif
06309 
06310 /****************************************************************************
06311  *
06312  * This is the undocumented part of the QSlib interface 
06313  *
06314  ****************************************************************************/
06315 /* 
06316  * functions to facilitate line by line reading from other sources than 
06317  * files from within MPS/LP parsers  
06318  * 
06319  * functions to facilitate the collection of error information instead of 
06320  * having the parsers print messages to stderr
06321  *                              by mps/lp format writers
06322  * 
06323  * a problem's reporter is used by the solver code to provide important 
06324  * fp20_feedback/progress information
06325  */
06326 
06327 #ifdef WIN32
06328 typedef struct fp20_QSLIB_INTERFACE fp20_qsline_reader *fp20_QSline_reader;
06329 typedef struct fp20_QSLIB_INTERFACE fp20_qsformat_error *fp20_QSformat_error;
06330 typedef struct fp20_QSLIB_INTERFACE fp20_qserror_collector *fp20_QSerror_collector;
06331 typedef struct fp20_QSLIB_INTERFACE fp20_qserror_memory *fp20_QSerror_memory;
06332 #else
06333 typedef struct fp20_qsline_reader *fp20_QSline_reader;
06334 typedef struct fp20_qsformat_error *fp20_QSformat_error;
06335 typedef struct fp20_qserror_collector *fp20_QSerror_collector;
06336 typedef struct fp20_qserror_memory *fp20_QSerror_memory;
06337 #endif
06338 
06339 #ifdef  __cplusplus
06340 extern "C"
06341 {
06342 #endif
06343   fp20_QSLIB_INTERFACE const char *fp20_QSformat_error_type_string (
06344   int tp);
06345 
06346   fp20_QSLIB_INTERFACE int fp20_QSerror_get_type (
06347   fp20_QSformat_error error);
06348   fp20_QSLIB_INTERFACE const char *fp20_QSerror_get_desc (
06349   fp20_QSformat_error error);
06350   fp20_QSLIB_INTERFACE int fp20_QSerror_get_line_number (
06351   fp20_QSformat_error error);
06352   fp20_QSLIB_INTERFACE int fp20_QSerror_get_pos (
06353   fp20_QSformat_error error);
06354   fp20_QSLIB_INTERFACE const char *fp20_QSerror_get_line (
06355   fp20_QSformat_error error);
06356   fp20_QSLIB_INTERFACE void fp20_QSerror_print (
06357   FILE * f,
06358   fp20_QSformat_error error);
06359 
06360   fp20_QSLIB_INTERFACE fp20_QSerror_collector fp20_QSerror_collector_new (
06361   void *fct,
06362   void *dest);
06363   fp20_QSLIB_INTERFACE fp20_QSerror_collector fp20_QSerror_memory_collector_new (
06364   fp20_QSerror_memory mem);
06365   fp20_QSLIB_INTERFACE void fp20_QSerror_collector_free (
06366   fp20_QSerror_collector c);
06367 
06368 /****************************************************************************
06369  * line reader 
06370  */
06371   fp20_QSLIB_INTERFACE fp20_QSline_reader fp20_QSline_reader_new (
06372   void *fct,
06373   void *data_src);
06374   /* reader->read_line_fct defaults to fgets */
06375 
06376   fp20_QSLIB_INTERFACE void fp20_QSline_reader_free (
06377   fp20_QSline_reader reader);
06378 
06379   fp20_QSLIB_INTERFACE void fp20_QSline_reader_set_error_collector (
06380   fp20_QSline_reader reader,
06381   fp20_QSerror_collector collector);
06382 
06383   fp20_QSLIB_INTERFACE char *fp20_QSline_reader_get (
06384   fp20_QSline_reader reader,
06385   char *s,
06386   int size);
06387 
06388   fp20_QSLIB_INTERFACE fp20_QSprob fp20_QSget_prob (
06389   fp20_QSline_reader reader,
06390   const char *probname,
06391   const char *filetype);
06392   /* the MPS and LP parsers uses the fct from reader 
06393    * to get to next input line */
06394 
06395 
06396 /****************************************************************************
06397  * error memory 
06398  */
06399   fp20_QSLIB_INTERFACE fp20_QSerror_memory fp20_QSerror_memory_create (
06400   int takeErrorLines);
06401   fp20_QSLIB_INTERFACE void fp20_QSerror_memory_free (
06402   fp20_QSerror_memory mem);
06403 
06404   fp20_QSLIB_INTERFACE int fp20_QSerror_memory_get_nof (
06405   fp20_QSerror_memory mem,
06406   int error_type);
06407   fp20_QSLIB_INTERFACE int fp20_QSerror_memory_get_nerrors (
06408   fp20_QSerror_memory mem);
06409 
06410   fp20_QSLIB_INTERFACE fp20_QSformat_error fp20_QSerror_memory_get_last_error (
06411   fp20_QSerror_memory mem);
06412   fp20_QSLIB_INTERFACE fp20_QSformat_error fp20_QSerror_memory_get_prev_error (
06413   fp20_QSformat_error e);
06414 
06415 /**************************************************************************** 
06416  * reporter for solver fp20_feedback 
06417  */
06418   fp20_QSLIB_INTERFACE void fp20_QSset_reporter (
06419   fp20_QSprob prob,
06420   int iterskip,
06421   void *fct,
06422   void *dest);
06423 
06424   fp20_QSLIB_INTERFACE int fp20_QSreport_prob (
06425   fp20_QSprob p,
06426   const char *filetype,
06427   fp20_QSerror_collector c);
06428 
06429 #ifdef  __cplusplus
06430 }
06431 #endif
06432 #endif                          /* fp20___QS_QSOPT_H */
06433 /****************************************************************************/
06434 /*                                                                          */
06435 /*  This file is part of QSopt_ex.                                          */
06436 /*                                                                          */
06437 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
06438 /*  and Daniel Espinoza                                                     */
06439 /*                                                                          */
06440 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
06441 /*  copyright in QSopt.                                                     */
06442 /*                                                                          */
06443 /*  This code may be used under the terms of the GNU General Public License */
06444 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
06445 /*                                                                          */
06446 /*  Alternatively, use is granted for research purposes only.               */
06447 /*                                                                          */
06448 /*  It is your choice of which of these two licenses you are operating      */
06449 /*  under.                                                                  */
06450 /*                                                                          */
06451 /*  We make no guarantees about the correctness or usefulness of this code. */
06452 /*                                                                          */
06453 /****************************************************************************/
06454 
06455 /* RCSINFO $Id: fp20_format.h,v 1.3 2003/11/05 16:59:48 meven Exp $ */
06456 #ifndef fp20_QS_FORMAT_ERROR_H
06457 #define fp20_QS_FORMAT_ERROR_H
06458 
06459 
06460 /****************************************************************************/
06461 /*
06462    The LP/MPS readers, writers, 
06463        fp20_ILLrawlpdata_to_lpdata, and 
06464    use fp20_ILLformat_error to report problems with their input iff
06465        the line reader used in reading the problem  or 
06466        the  fp20_qserror_collector pointer passed to fp20_ILLwrite_lp_file
06467    is not NULL.
06468 
06469    The QSgui code uses this feature to collect fp20_qsformat_error instances 
06470    which it uses after reading is done to insert error messages into the 
06471    input window. 
06472 */
06473 /****************************************************************************/
06474 
06475 /* 
06476 for error type USE: 
06477           QS_DATA_ERROR     
06478           QS_DATA_WARN      
06479           QS_MPS_FORMAT_ERROR   
06480           QS_MPS_FORMAT_WARN    
06481           QS_LP_FORMAT_ERROR    
06482           QS_LP_FORMAT_WARN   
06483           QS_LP_OBJ_WARN      
06484           QS_GENERIC_ERROR    
06485 */
06486 
06487 typedef struct fp20_qsformat_error
06488 {
06489   char *desc;
06490   char *theLine;
06491   struct fp20_qsformat_error *next;
06492   int type;
06493   int lineNumber;               /* 1 based line counting */
06494   int at;
06495 }
06496 fp20_qsformat_error;
06497 
06498 extern int fp20_ILLformat_error_create (
06499   fp20_qsformat_error * error,
06500   int mode,
06501   const char *desc,
06502   int lineNum,
06503   const char *theLine,
06504   int atPos);
06505 extern void fp20_ILLformat_error_delete (
06506   fp20_qsformat_error * error);
06507 
06508 extern void fp20_ILLformat_error_print (
06509   EGioFile_t * out,
06510   fp20_qsformat_error * e);
06511 
06512 
06513 
06514 /*****************************************************************************
06515  * collecting error messages 
06516  * either with defining own qsad_error_fct and corresponding data structure 
06517  * or by using predefined fp20_ILLadd_error_to_memory fct with fp20_qserror_memory
06518  */
06519 
06520 typedef int (
06521   *fp20_qsadd_error_fct) (
06522   void *dest,
06523   const fp20_qsformat_error * error);
06524 
06525 typedef struct fp20_qserror_collector
06526 {
06527   fp20_qsadd_error_fct add_error;
06528   void *dest;
06529 }
06530 fp20_qserror_collector;
06531 
06532 typedef struct fp20_qserror_memory
06533 {
06534   unsigned int nerror;
06535   fp20_qsformat_error *error_list;
06536   char has_error[QS_INPUT_NERROR];
06537   char hasErrorLines;
06538 }
06539 fp20_qserror_memory;
06540 
06541 
06542 extern fp20_qserror_collector *fp20_ILLerror_collector_new (
06543   fp20_qsadd_error_fct fct,
06544   void *dest);
06545 
06546 fp20_qserror_collector *fp20_ILLerror_memory_collector_new (
06547   fp20_qserror_memory * dest);
06548 
06549 extern void fp20_ILLerror_collector_free (
06550   fp20_qserror_collector * c);
06551 
06552 #define fp20_ILLformat_error(collector, error)  \
06553   ((collector)->add_error((collector)->dest, error))
06554 
06555 
06556 extern int fp20_ILLadd_error_to_memory (
06557   void *dest,
06558   const fp20_qsformat_error * error);
06559 
06560 extern fp20_qserror_memory *fp20_ILLerror_memory_create (
06561   int takeErrorLines);
06562 extern void fp20_ILLerror_memory_free (
06563   fp20_qserror_memory * mem);
06564 
06565 #endif
06566 /****************************************************************************/
06567 /*                                                                          */
06568 /*  This file is part of QSopt_ex.                                          */
06569 /*                                                                          */
06570 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
06571 /*  and Daniel Espinoza                                                     */
06572 /*                                                                          */
06573 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
06574 /*  copyright in QSopt.                                                     */
06575 /*                                                                          */
06576 /*  This code may be used under the terms of the GNU General Public License */
06577 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
06578 /*                                                                          */
06579 /*  Alternatively, use is granted for research purposes only.               */
06580 /*                                                                          */
06581 /*  It is your choice of which of these two licenses you are operating      */
06582 /*  under.                                                                  */
06583 /*                                                                          */
06584 /*  We make no guarantees about the correctness or usefulness of this code. */
06585 /*                                                                          */
06586 /****************************************************************************/
06587 
06588 /*  RCS_INFO = "$RCSfile: fp20_rawlp.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $"; */
06589 #ifndef fp20___ILL_RAWLP_H_
06590 #define fp20___ILL_RAWLP_H_
06591 
06592 /****************************************************************************/
06593 /* DataStructure and Routines                                               */
06594 /*          to deal with raw lp information as read from mps or lp files    */
06595 /*          support scanning of input                                       */
06596 /*          error reporting                                                 */
06597 /****************************************************************************/
06598 
06599 
06600 #define fp20_ILL_ISBLANK(p) \
06601              (((*(p))==' '||(*(p))=='\t'||(*(p))=='\r'||(*(p))=='\f') ? 1 : 0)
06602 
06603 /* 
06604  * we rely on ILLsymboltab property:
06605  *   the ith name added can be retrieved by ILLsymboltab_get(table, i) 
06606  *   as long as we never delete names from the symbol table 
06607  */
06608 typedef struct fp20_rawlpdata
06609 {
06610   char *name;
06611 
06612   char *rhsname;
06613   char *rangesname;
06614   char *boundsname;
06615 
06616   int objsense;                 /* maximize or minimize */
06617   int objindex;                 /* index of objective row */
06618 
06619   int nrows;                    /* number of rows in problem */
06620   ILLsymboltab rowtab;          /* ILLsymboltab_get(rowtab, i) name of ith row */
06621 
06622   int sensesize;                /* size of rowsense */
06623   char *rowsense;               /* rowsense[i] snese of row[i] */
06624 
06625   char *rhsind;                 /* rhsind[i] == 1 we saw an rhs for row[i] */
06626   /* size is nrows */
06627   int rhssize;                  /* size of rhs array */
06628   EGfp20_t *rhs;                /* rhs values for rows; size is nrows */
06629   char *rangesind;              /* ranges[i] == 1 we saw a range def for row[i] */
06630   struct fp20_colptr *ranges;       /* list of range values */
06631 
06632   int ncols;                    /* number of cols in problem */
06633   ILLsymboltab coltab;          /* ILLsymboltab_get(coltab, i) name of ith col */
06634   int colsize;                  /* size of cols array */
06635   struct fp20_colptr **cols;
06636 
06637   char *lbind;                  /* lbind[i] == 1  we saw a lower bound for col[i] */
06638   char *ubind;                  /* ubind[i] == 1  we saw a upper bound for col[i] */
06639   EGfp20_t *lower;              /* lower[i] = lower bound for col[i] */
06640   EGfp20_t *upper;              /* upper[i] = upper bound for col[i] */
06641 
06642   int intsize;                  /* size of intmarker array */
06643   char *intmarker;              /* intmarker[i] == 1  col[i] is an int var */
06644 
06645   /* sos information is tranfered into fp20_ILLmatrix lpdata->sos */
06646   char *refrow;                 /* name of reference row */
06647   int refrowind;                /* index of refrow or -1  */
06648 
06649   int is_sos_size;              /* size of is_sos_member array */
06650   int *is_sos_member;           /* for each col contains either               
06651                                  *     -1 == no sos memeber 
06652                                  *     i  == member of set #i */
06653 
06654   int nsos_member;              /* total number of sos set members */
06655   int sos_weight_size;          /* size of sos_weight array */
06656   EGfp20_t *sos_weight;       /* sos set elem i has weight of sos_weight[i] 
06657                                  * value comes from refrow coeficients */
06658   int sos_col_size;             /* size of sos_col array */
06659   int *sos_col;                 /* sos elem i is column sos_col[i] */
06660 
06661   int nsos;                     /* number of sos sets */
06662   int sos_setsize;              /* size of sosset array */
06663   struct fp20_sosptr *sos_set;        /* type, size, first element of sos sets 
06664                                  * first is index into sos_weight and sos_col 
06665                                  * arrays */
06666   fp20_qserror_collector *error_collector;
06667   ILLptrworld ptrworld;
06668 }
06669 fp20_rawlpdata;
06670 
06671 typedef struct fp20_colptr
06672 {
06673   EGfp20_t coef;
06674   struct fp20_colptr *next;
06675   int this_val;                     /* row index */
06676 }
06677 fp20_colptr;
06678 extern fp20_colptr *fp20_ILLcolptralloc (
06679   ILLptrworld * p);
06680 
06681 typedef struct fp20_sosptr
06682 {
06683   int nelem;                    /* number of set elements */
06684   int first;                    /* index of first set element in sosmemeber */
06685   char type;                    /* set type */
06686 }
06687 fp20_sosptr;
06688 extern const int fp20_ILL_SOS_TYPE1;
06689 extern const int fp20_ILL_SOS_TYPE2;
06690 
06691 extern void fp20_ILLinit_rawlpdata (
06692   fp20_rawlpdata * lp,
06693   fp20_qserror_collector * collector);
06694 extern void fp20_ILLfree_rawlpdata (
06695   fp20_rawlpdata * lp);
06696 extern void fp20_ILLraw_clear_matrix (
06697   fp20_rawlpdata * lp);
06698 
06699 extern const char *fp20_ILLraw_rowname (
06700   fp20_rawlpdata * lp,
06701   int i);
06702 extern const char *fp20_ILLraw_colname (
06703   fp20_rawlpdata * lp,
06704   int i);
06705 
06706 extern int fp20_ILLraw_add_col (
06707   fp20_rawlpdata * lp,
06708   const char *name,
06709   int intmarker);
06710 extern int fp20_ILLraw_add_row (
06711   fp20_rawlpdata * lp,
06712   const char *name,
06713   int sense,
06714   const EGfp20_t rhs);
06715 
06716 extern int fp20_ILLraw_add_col_coef (
06717   fp20_rawlpdata * lp,
06718   int colind,
06719   int rowind,
06720   EGfp20_t coef);
06721 
06722 extern int fp20_ILLraw_init_ranges (
06723   fp20_rawlpdata * lp);
06724 extern int fp20_ILLraw_init_rhs (
06725   fp20_rawlpdata * lp);
06726 
06727 extern int fp20_ILLraw_add_ranges_coef (
06728   fp20_rawlpdata * lp,
06729   int rowind,
06730   EGfp20_t coef);
06731 
06732 
06733 extern int fp20_ILLraw_add_sos (
06734   fp20_rawlpdata * lp,
06735   int sos_type);
06736 
06737                                                 /* add empty set with type */
06738 extern int fp20_ILLraw_add_sos_member (
06739   fp20_rawlpdata * lp,
06740   int colind);
06741 
06742                                                 /* add col to last set */
06743 extern int fp20_ILLraw_is_mem_other_sos (
06744   fp20_rawlpdata * lp,
06745   int colind);
06746 
06747 extern int fp20_ILLraw_set_rhs_name (
06748   fp20_rawlpdata * lp,
06749   const char *name,
06750   int *skip);
06751 extern int fp20_ILLraw_set_bounds_name (
06752   fp20_rawlpdata * lp,
06753   const char *name,
06754   int *skip);
06755 extern int fp20_ILLraw_set_ranges_name (
06756   fp20_rawlpdata * lp,
06757   const char *name,
06758   int *skip);
06759 extern void fp20_ILLprint_rawlpdata (
06760   fp20_rawlpdata * lp);
06761 
06762 extern char *fp20_ILLraw_unique_name (
06763   ILLsymboltab * tab,
06764   char *prefix,
06765   int i);
06766 extern int fp20_ILLraw_fill_in_rownames (
06767   fp20_rawlpdata * lp);
06768 
06769 extern int fp20_ILLraw_init_bounds (
06770   fp20_rawlpdata * lp);
06771 
06772 extern const char *fp20_ILLraw_set_lowerBound (
06773   fp20_rawlpdata * lp,
06774   int i,
06775   EGfp20_t bnd);
06776 extern const char *fp20_ILLraw_set_upperBound (
06777   fp20_rawlpdata * lp,
06778   int i,
06779   EGfp20_t bnd);
06780 extern const char *fp20_ILLraw_set_fixedBound (
06781   fp20_rawlpdata * lp,
06782   int i,
06783   EGfp20_t bnd);
06784 extern const char *fp20_ILLraw_set_binaryBound (
06785   fp20_rawlpdata * lp,
06786   int i);
06787 extern const char *fp20_ILLraw_set_unbound (
06788   fp20_rawlpdata * lp,
06789   int colind);
06790 extern int fp20_ILLraw_fill_in_bounds (
06791   fp20_rawlpdata * lp);
06792 
06793 extern int fp20_ILLraw_first_nondefault_bound (
06794   fp20_ILLlpdata * lp);
06795 extern int fp20_ILLraw_default_lower (
06796   fp20_ILLlpdata * lp,
06797   int i);
06798 extern int fp20_ILLraw_default_upper (
06799   fp20_ILLlpdata * lp,
06800   int i,
06801   int ri);
06802 
06803 extern int fp20_ILLrawlpdata_to_lpdata (
06804   fp20_rawlpdata * raw,
06805   fp20_ILLlpdata * lp);
06806 
06807 extern int fp20_ILLdata_error (
06808   fp20_qserror_collector * collector,
06809   const char *format,
06810   ...);
06811 extern void fp20_ILLdata_warn (
06812   fp20_qserror_collector * collector,
06813   const char *format,
06814   ...);
06815 
06816 #endif
06817 /****************************************************************************/
06818 /*                                                                          */
06819 /*  This file is part of QSopt_ex.                                          */
06820 /*                                                                          */
06821 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
06822 /*  and Daniel Espinoza                                                     */
06823 /*                                                                          */
06824 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
06825 /*  copyright in QSopt.                                                     */
06826 /*                                                                          */
06827 /*  This code may be used under the terms of the GNU General Public License */
06828 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
06829 /*                                                                          */
06830 /*  Alternatively, use is granted for research purposes only.               */
06831 /*                                                                          */
06832 /*  It is your choice of which of these two licenses you are operating      */
06833 /*  under.                                                                  */
06834 /*                                                                          */
06835 /*  We make no guarantees about the correctness or usefulness of this code. */
06836 /*                                                                          */
06837 /****************************************************************************/
06838 
06839 /* RCSINFO $Id: fp20_mps.h,v 1.2 2003/11/05 16:57:39 meven Exp $ */
06840 #ifndef fp20_MPS_H
06841 #define fp20_MPS_H
06842 
06843 
06844 /****************************************************************************/
06845 /*                                                                          */
06846 /*              Routines to support Reading and Writing MPS Files           */
06847 /*                                                                          */
06848 /****************************************************************************/
06849 extern const char *fp20_ILLmps_section_name[ILL_MPS_N_SECTIONS + 2];
06850 
06851 
06852 extern int fp20_ILLread_mps (
06853   fp20_qsline_reader * file,
06854   const char *filename,
06855   fp20_rawlpdata * lp);
06856 
06857 extern int fp20_ILLwrite_mps (
06858   fp20_ILLlpdata * lp,
06859   fp20_qserror_collector * collector);
06860 
06861         /* use lp->reporter for output */
06862 
06863 #endif
06864 /****************************************************************************/
06865 /*                                                                          */
06866 /*  This file is part of QSopt_ex.                                          */
06867 /*                                                                          */
06868 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
06869 /*  and Daniel Espinoza                                                     */
06870 /*                                                                          */
06871 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
06872 /*  copyright in QSopt.                                                     */
06873 /*                                                                          */
06874 /*  This code may be used under the terms of the GNU General Public License */
06875 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
06876 /*                                                                          */
06877 /*  Alternatively, use is granted for research purposes only.               */
06878 /*                                                                          */
06879 /*  It is your choice of which of these two licenses you are operating      */
06880 /*  under.                                                                  */
06881 /*                                                                          */
06882 /*  We make no guarantees about the correctness or usefulness of this code. */
06883 /*                                                                          */
06884 /****************************************************************************/
06885 
06886 /*  $RCSfile: fp20_price.h,v $ $Revision: 1.3 $ $Date: 2003/11/05 16:57:39 $" */
06887 #ifndef fp20___PRICE_H
06888 #define fp20___PRICE_H
06889 
06890 
06891 typedef struct fp20_price_res
06892 {
06893   int eindex;
06894   int dir;
06895   int lindex;
06896   int lvstat;
06897   int price_stat;
06898   EGfp20_t dinfeas;
06899   EGfp20_t pinfeas;
06900 }
06901 fp20_price_res;
06902 
06903 int fp20_ILLprice_test_for_heap (
06904   fp20_lpinfo * const lp,
06905   fp20_price_info * const pinf,
06906   int const nkeys,
06907   EGfp20_t * keylist,
06908   int const algo,
06909   int const upd),
06910   fp20_ILLprice_build_heap (
06911   fp20_price_info * const pinf,
06912   int const nkeys,
06913   EGfp20_t * keylist),
06914   fp20_ILLprice_build_pricing_info (
06915   fp20_lpinfo * const lp,
06916   fp20_price_info * const pinf,
06917   int const phase),
06918   fp20_ILLprice_update_pricing_info (
06919   fp20_lpinfo * const lp,
06920   fp20_price_info * const pinf,
06921   int const phase,
06922   fp20_svector * const wz,
06923   int const eindex,
06924   int const lindex,
06925   EGfp20_t y),
06926   fp20_ILLprice_get_price (
06927   fp20_price_info * const p,
06928   int const phase),
06929   fp20_ILLprice_build_mpartial_info (
06930   fp20_lpinfo * const lp,
06931   fp20_price_info * const pinf,
06932   int const pricetype),
06933   fp20_ILLprice_build_pdevex_norms (
06934   fp20_lpinfo * const lp,
06935   fp20_p_devex_info * const pdinfo,
06936   int const reinit),
06937   fp20_ILLprice_update_pdevex_norms (
06938   fp20_lpinfo * const lp,
06939   fp20_p_devex_info * const pdinfo,
06940   int const eindex,
06941   EGfp20_t yl),
06942   fp20_ILLprice_build_psteep_norms (
06943   fp20_lpinfo * const lp,
06944   fp20_p_steep_info * const psinfo),
06945   fp20_ILLprice_build_ddevex_norms (
06946   fp20_lpinfo * const lp,
06947   fp20_d_devex_info * const ddinfo,
06948   int const reinit),
06949   fp20_ILLprice_update_ddevex_norms (
06950   fp20_lpinfo * const lp,
06951   fp20_d_devex_info * const ddinfo,
06952   int const eindex,
06953   EGfp20_t yl),
06954   fp20_ILLprice_build_dsteep_norms (
06955   fp20_lpinfo * const lp,
06956   fp20_d_steep_info * const dsinfo),
06957   fp20_ILLprice_get_dsteep_norms (
06958   fp20_lpinfo * const lp,
06959   int const count,
06960   int *constrowind,
06961   EGfp20_t * const norms),
06962   fp20_ILLprice_get_rownorms (
06963   fp20_lpinfo * const lp,
06964   fp20_price_info * const pinf,
06965   EGfp20_t * const rnorms),
06966   fp20_ILLprice_get_colnorms (
06967   fp20_lpinfo * const lp,
06968   fp20_price_info * const pinf,
06969   EGfp20_t * const cnorms),
06970   fp20_ILLprice_get_newnorms (
06971   fp20_lpinfo * const lp,
06972   int const nelems,
06973   EGfp20_t * const norms,
06974   int *const matcnt,
06975   int *const matbeg,
06976   int *const matind,
06977   EGfp20_t * const matval,
06978   int const option),
06979   fp20_ILLprice_get_new_rownorms (
06980   fp20_lpinfo * const lp,
06981   int const newrows,
06982   EGfp20_t * const rnorms,
06983   int *const rmatcnt,
06984   int *const rmatbeg,
06985   int *const rmatind,
06986   EGfp20_t * const rmatval),
06987   fp20_ILLprice_get_new_colnorms (
06988   fp20_lpinfo * const lp,
06989   int const newrows,
06990   EGfp20_t * const rnorms,
06991   int *const matcnt,
06992   int *const matbeg,
06993   int *const matind,
06994   EGfp20_t * const matval),
06995   fp20_ILLprice_load_rownorms (
06996   fp20_lpinfo * const lp,
06997   EGfp20_t * const rnorms,
06998   fp20_price_info * const pinf),
06999   fp20_ILLprice_load_colnorms (
07000   fp20_lpinfo * const lp,
07001   EGfp20_t * const cnorms,
07002   fp20_price_info * const pinf);
07003 
07004 
07005 void fp20_ILLprice_free_heap (
07006   fp20_price_info * const pinf),
07007   fp20_ILLprice_init_pricing_info (
07008   fp20_price_info * const pinf),
07009   fp20_ILLprice_free_pricing_info (
07010   fp20_price_info * const pinf),
07011   fp20_ILLprice_free_mpartial_info (
07012   fp20_mpart_info * p),
07013   fp20_ILLprice_init_mpartial_price (
07014   fp20_lpinfo * const lp,
07015   fp20_price_info * const pinf,
07016   int const phase,
07017   int const pricetype),
07018   fp20_ILLprice_update_mpartial_price (
07019   fp20_lpinfo * const lp,
07020   fp20_price_info * const pinf,
07021   int const phase,
07022   int const pricetype),
07023   fp20_ILLprice_delete_onempart_price (
07024   /*fp20_lpinfo * const lp,*/
07025   fp20_price_info * const pinf,
07026   int const indx,
07027   int const pricetype),
07028   fp20_ILLprice_mpartial_group (
07029   fp20_lpinfo * const lp,
07030   fp20_mpart_info * const p,
07031   int const phase,
07032   int const g,
07033   int const pricetype),
07034   fp20_ILLprice_column (
07035   fp20_lpinfo * const lp,
07036   int const ix,
07037   int const phase,
07038   fp20_price_res * const pr),
07039   fp20_ILLprice_row (
07040   fp20_lpinfo * const lp,
07041   int const ix,
07042   int const phase,
07043   fp20_price_res * const pr),
07044   fp20_ILLprice_update_psteep_norms (
07045   fp20_lpinfo * lp,
07046   fp20_p_steep_info * psinfo,
07047   fp20_svector * wz,
07048   int eindex,
07049   EGfp20_t yl),
07050   fp20_ILLprice_update_dsteep_norms (
07051   fp20_lpinfo * const lp,
07052   fp20_d_steep_info * const dsinfo,
07053   fp20_svector * const wz,
07054   int const lindex,
07055   EGfp20_t yl),
07056   fp20_ILLprice_compute_dual_inf (
07057   fp20_lpinfo * const lp,
07058   fp20_price_info * const p,
07059   int *const ix,
07060   int const icnt,
07061   int const phase),
07062   fp20_ILLprice_primal (
07063   fp20_lpinfo * const lp,
07064   fp20_price_info * const pinf,
07065   fp20_price_res * const pr,
07066   int const phase),
07067   fp20_ILLprice_compute_primal_inf (
07068   fp20_lpinfo * const lp,
07069   fp20_price_info * const p,
07070   int *const ix,
07071   int const icnt,
07072   int const phase),
07073   fp20_ILLprice_dual (
07074   fp20_lpinfo * const lp,
07075   fp20_price_info * const pinf,
07076   int const phase,
07077   fp20_price_res * const pr);
07078 
07079 void fp20_test_dsteep_norms (
07080   fp20_lpinfo * const lp,
07081   fp20_price_info * const p);
07082 
07083 #endif /* fp20___PRICE_H */
07084 /****************************************************************************/
07085 /*                                                                          */
07086 /*  This file is part of QSopt_ex.                                          */
07087 /*                                                                          */
07088 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
07089 /*  and Daniel Espinoza                                                     */
07090 /*                                                                          */
07091 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
07092 /*  copyright in QSopt.                                                     */
07093 /*                                                                          */
07094 /*  This code may be used under the terms of the GNU General Public License */
07095 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
07096 /*                                                                          */
07097 /*  Alternatively, use is granted for research purposes only.               */
07098 /*                                                                          */
07099 /*  It is your choice of which of these two licenses you are operating      */
07100 /*  under.                                                                  */
07101 /*                                                                          */
07102 /*  We make no guarantees about the correctness or usefulness of this code. */
07103 /*                                                                          */
07104 /****************************************************************************/
07105 
07106 #ifndef fp20___PRIORITY_H__
07107 #define fp20___PRIORITY_H__
07108 /****************************************************************************/
07109 /*                                                                          */
07110 /*                             fp20_priority.c                                   */
07111 /*                                                                          */
07112 /****************************************************************************/
07113 
07114 typedef struct fp20_ILLpriority
07115 {
07116   fp20_ILLdheap fp20_heap;
07117   union fp20_ILLpri_data
07118   {
07119     void *data;
07120     int next;
07121   }
07122    *pri_info;
07123   int space;
07124   int freelist;
07125 }
07126 fp20_ILLpriority;
07127 
07128 void fp20_ILLutil_priority_free (
07129   fp20_ILLpriority * pri),
07130   fp20_ILLutil_priority_delete (
07131   fp20_ILLpriority * pri,
07132   int handle),
07133   fp20_ILLutil_priority_changekey (
07134   fp20_ILLpriority * pri,
07135   int handle,
07136   EGfp20_t * newkey),
07137   fp20_ILLutil_priority_findmin (
07138   fp20_ILLpriority * pri,
07139   EGfp20_t * keyval,
07140   void **en),
07141   fp20_ILLutil_priority_deletemin (
07142   fp20_ILLpriority * pri,
07143   EGfp20_t * keyval,
07144   void **en);
07145 
07146 int fp20_ILLutil_priority_init (
07147   fp20_ILLpriority * pri,
07148   int k),
07149   fp20_ILLutil_priority_insert (
07150   fp20_ILLpriority * pri,
07151   void *data,
07152   EGfp20_t * keyval,
07153   int *handle);
07154 
07155 
07156 
07157 #endif
07158 /****************************************************************************/
07159 /*                                                                          */
07160 /*  This file is part of QSopt_ex.                                          */
07161 /*                                                                          */
07162 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
07163 /*  and Daniel Espinoza                                                     */
07164 /*                                                                          */
07165 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
07166 /*  copyright in QSopt.                                                     */
07167 /*                                                                          */