home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / math / lpsolves / defines.h < prev    next >
C/C++ Source or Header  |  1993-07-28  |  2KB  |  91 lines

  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5.  
  6. #define HASH_SIZE  10000 
  7. #define ETA_START_SIZE 10000 /* start size of array Eta. Realloced if needed */
  8. #define FNAMLEN 64
  9. #define NAMELEN 25
  10. #define MAXSTRL (NAMELEN-1)
  11. #define STD_ROW_NAME_PREFIX "r_"
  12.  
  13. #define    FALSE    0
  14. #define    TRUE    1
  15.  
  16. #define LE      0
  17. #define EQ      1
  18. #define GE      2
  19. #define OF      3
  20.  
  21. #define    abs(x)    ((x) < 0 ? -(x) : (x))
  22.  
  23. #define CALLOC(ptr, nr, type) if(!(ptr = calloc((size_t)(nr),\
  24.   sizeof(type)))) { fprintf(stderr, "calloc failed\n"); exit(1); }
  25.  
  26. #define MALLOC(ptr, nr, type) if(!(ptr = malloc((size_t)((nr) * \
  27.   sizeof(type))))) { fprintf(stderr, "malloc failed\n"); exit(1); }
  28.  
  29. #define FREE(ptr) free(ptr);ptr=NULL;
  30.  
  31. #define INFINITE  1.0e12
  32. #define EPSB      0.0001
  33. #define EPSEL     1.0e-8
  34. #define EPSD      0.0001
  35. #define EPSILON   0.01 /* to determine if float is an int */
  36.  
  37. typedef char    nstring[NAMELEN];
  38.  
  39. typedef struct _column
  40. {
  41.   int row;
  42.   float value;
  43.   struct _column *next ;
  44. } column;
  45.  
  46. typedef struct _bound
  47. {
  48.   double        upbo;
  49.   double        lowbo;
  50. } bound;
  51.  
  52. typedef struct _hashelem
  53. {
  54.   nstring          colname;
  55.   struct _hashelem *next;
  56.   struct _column   *col;
  57.   struct _bound    *bnd;
  58.   int              must_be_int;
  59. } hashelem;
  60.  
  61. typedef struct _rside /* contains relational operator and rhs value */
  62. {
  63.   double        value;
  64.   struct _rside *next;
  65.   short         relat;
  66. } rside;
  67.  
  68. /* structure or final data-storage */
  69.  
  70. typedef struct  _matrec 
  71. {
  72.   int    rownr;
  73.   double  value;
  74. } matrec;
  75.  
  76. typedef struct _tmp_store_struct
  77. {
  78.   nstring name;
  79.   int     row;
  80.   double  value;
  81.   double  rhs_value;
  82.   short   relat;
  83. } tmp_store_struct;
  84.  
  85. typedef struct _intrec
  86. {
  87.   int             varnr;
  88.   struct _intrec  *next;
  89. }
  90. intrec;
  91.