/usr/include/lpsolve/lp_types.h is in liblpsolve55-dev 5.5.0.13-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | #ifndef HEADER_lp_types
#define HEADER_lp_types
#ifdef WIN32
#include <windows.h>
#endif
/* Define data types */
/* ------------------------------------------------------------------------- */
#ifndef LLONG
#if defined __BORLANDC__
#define LLONG __int64
#elif !defined _MSC_VER || _MSC_VER >= 1310
#define LLONG long long
#else
#define LLONG __int64
#endif
#endif
#ifndef COUNTER
#define COUNTER LLONG
#endif
#ifndef REAL
#define REAL double
#endif
#ifndef REALXP
#if 1
#define REALXP long double /* Set local accumulation variable as long double */
#else
#define REALXP REAL /* Set local accumulation as default precision */
#endif
#endif
#ifndef LREAL
#if 0
#define LREAL long double /* Set global solution update variable as long double */
#else
#define LREAL REAL /* Set global solution update variable as default precision */
#endif
#endif
#define RESULTVALUEMASK "%18.12g" /* Set fixed-format real-valued output precision;
suggested width: ABS(exponent of DEF_EPSVALUE)+6. */
#define INDEXVALUEMASK "%8d" /* Set fixed-format integer-valued output width */
#ifndef DEF_STRBUFSIZE
#define DEF_STRBUFSIZE 512
#endif
#ifndef MAXINT32
#define MAXINT32 2147483647
#endif
#ifndef MAXUINT32
#define MAXUINT32 4294967295
#endif
#ifndef MAXINT64
#if defined _LONGLONG || defined __LONG_LONG_MAX__ || defined LLONG_MAX
#define MAXINT64 9223372036854775807ll
#else
#define MAXINT64 9223372036854775807l
#endif
#endif
#ifndef MAXUINT64
#if defined _LONGLONG || defined __LONG_LONG_MAX__ || defined LLONG_MAX
#define MAXUINT64 18446744073709551615ll
#else
#define MAXUINT64 18446744073709551615l
#endif
#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
#ifndef MYBOOL
#define MYBOOL unsigned char /* Conserve memory, could be unsigned int */
#endif
/* Constants */
/* ------------------------------------------------------------------------- */
#ifndef NULL
#define NULL 0
#endif
/* Byte-sized Booleans and extended options */
#define FALSE 0
#define TRUE 1
#define AUTOMATIC 2
#define DYNAMIC 4
/* Sorting and comparison constants */
#define COMP_PREFERCANDIDATE 1
#define COMP_PREFERNONE 0
#define COMP_PREFERINCUMBENT -1
/* Library load status values */
#define LIB_LOADED 0
#define LIB_NOTFOUND 1
#define LIB_NOINFO 2
#define LIB_NOFUNCTION 3
#define LIB_VERINVALID 4
#define LIB_STR_LOADED "Successfully loaded"
#define LIB_STR_NOTFOUND "File not found"
#define LIB_STR_NOINFO "No version data"
#define LIB_STR_NOFUNCTION "Missing function header"
#define LIB_STR_VERINVALID "Incompatible version"
#define LIB_STR_MAXLEN 23
/* Compiler/target settings */
/* ------------------------------------------------------------------------- */
#if (defined _WIN32) || (defined WIN32) || (defined _WIN64) || (defined WIN64)
# define __WINAPI WINAPI
#else
# define __WINAPI
#endif
#if (defined _WIN32) || (defined WIN32) || (defined _WIN64) || (defined WIN64)
# define __VACALL __cdecl
#else
# define __VACALL
#endif
#ifndef __BORLANDC__
#ifdef _USRDLL
#if 1
#define __EXPORT_TYPE __declspec(dllexport)
#else
/* Set up for the Microsoft compiler */
#ifdef LP_SOLVE_EXPORTS
#define __EXPORT_TYPE __declspec(dllexport)
#else
#define __EXPORT_TYPE __declspec(dllimport)
#endif
#endif
#else
#define __EXPORT_TYPE
#endif
#ifdef __cplusplus
#define __EXTERN_C extern "C"
#else
#define __EXTERN_C
#endif
#else /* Otherwise set up for the Borland compiler */
#ifdef __DLL__
#define _USRDLL
#define __EXTERN_C extern "C"
#ifdef __READING_THE_DLL
#define __EXPORT_TYPE __import
#else
#define __EXPORT_TYPE __export
#endif
#else
#define __EXPORT_TYPE
#define __EXTERN_C extern "C"
#endif
#endif
#if 0
#define STATIC static
#else
#define STATIC
#endif
#if !defined INLINE
#if defined __cplusplus
#define INLINE inline
#elif (defined _WIN32) || (defined WIN32) || (defined _WIN64) || (defined WIN64)
#define INLINE __inline
#else
#define INLINE static
#endif
#endif
/* Function macros */
/* ------------------------------------------------------------------------- */
#define my_limitrange(x, lo, hi) ((x) < (lo) ? (lo) : ((x) > (hi) ? (hi) : (x)))
#ifndef my_mod
#define my_mod(n, m) ((n) % (m))
#endif
#define my_if(t, x, y) ((t) ? (x) : (y))
#define my_sign(x) ((x) < 0 ? -1 : 1)
#if 0
#define my_chsign(t, x) ( ((t) && ((x) != 0)) ? -(x) : (x))
#else
#define my_chsign(t, x) ( (2*((t) == 0) - 1) * (x) ) /* "Pipelined" */
#endif
#define my_flipsign(x) ( fabs((REAL) (x)) == 0 ? 0 : -(x) )
#define my_roundzero(val, eps) if (fabs((REAL) (val)) < eps) val = 0
#define my_avoidtiny(val, eps) (fabs((REAL) (val)) < eps ? 0 : val)
#if 1
#define my_infinite(lp, val) ( (MYBOOL) (fabs(val) >= lp->infinite) )
#else
#define my_infinite(lp, val) is_infinite(lp, val)
#endif
#define my_inflimit(lp, val) ( my_infinite(lp, val) ? lp->infinite * my_sign(val) : (val) )
#if 0
#define my_precision(val, eps) ((fabs((REAL) (val))) < (eps) ? 0 : (val))
#else
#define my_precision(val, eps) restoreINT(val, eps)
#endif
#define my_reldiff(x, y) (((x) - (y)) / (1.0 + fabs((REAL) (y))))
#define my_boundstr(x) (fabs(x) < lp->infinite ? sprintf("%g",x) : ((x) < 0 ? "-Inf" : "Inf") )
#ifndef my_boolstr
#define my_boolstr(x) (!(x) ? "FALSE" : "TRUE")
#endif
#define my_basisstr(isbasic) ((isbasic) ? "BASIC" : "NON-BASIC")
#define my_simplexstr(isdual) ((isdual) ? "DUAL" : "PRIMAL")
#define my_plural_std(count) (count == 1 ? "" : "s")
#define my_plural_y(count) (count == 1 ? "y" : "ies")
#define my_lowbound(x) ((FULLYBOUNDEDSIMPLEX) ? (x) : 0)
/* Bound macros usable for both the standard and fully bounded simplex */
/* ------------------------------------------------------------------------- */
/*
#define my_lowbo(lp, varnr) ( lp->isfullybounded ? lp->lowbo[varnr] : 0.0 )
#define my_upbo(lp, varnr) ( lp->isfullybounded ? lp->upbo[varnr] : lp->lowbo[varnr] + lp->upbo[varnr] )
#define my_rangebo(lp, varnr) ( lp->isfullybounded ? lp->upbo[varnr] - lp->lowbo[varnr] : lp->upbo[varnr] )
*/
#define my_lowbo(lp, varnr) ( 0.0 )
#define my_upbo(lp, varnr) ( lp->lowbo[varnr] + lp->upbo[varnr] )
#define my_rangebo(lp, varnr) ( lp->upbo[varnr] )
#define my_unbounded(lp, varnr) ((lp->upbo[varnr] >= lp->infinite) && (lp->lowbo[varnr] <= -lp->infinite))
#define my_bounded(lp, varnr) ((lp->upbo[varnr] < lp->infinite) && (lp->lowbo[varnr] > -lp->infinite))
/* Forward declarations */
/* ------------------------------------------------------------------------- */
typedef struct _lprec lprec;
typedef struct _INVrec INVrec;
union QSORTrec;
#ifndef UNIONTYPE
#ifdef __cplusplus
#define UNIONTYPE
#else
#define UNIONTYPE union
#endif
#endif
/* B4 factorization optimization data */
typedef struct _B4rec
{
int *B4_var; /* Position of basic columns in the B4 basis */
int *var_B4; /* Variable in the B4 basis */
int *B4_row; /* B4 position of the i'th row */
int *row_B4; /* Original position of the i'th row */
REAL *wcol;
int *nzwcol;
} B4rec;
#define OBJ_STEPS 5
typedef struct _OBJmonrec {
lprec *lp;
int oldpivstrategy,
oldpivrule, pivrule, ruleswitches,
limitstall[2], limitruleswitches,
idxstep[OBJ_STEPS], countstep, startstep, currentstep,
Rcycle, Ccycle, Ncycle, Mcycle, Icount;
REAL thisobj, prevobj,
objstep[OBJ_STEPS],
thisinfeas, previnfeas,
epsvalue;
char spxfunc[10];
MYBOOL pivdynamic;
MYBOOL isdual;
MYBOOL active;
} OBJmonrec;
typedef struct _edgerec
{
REAL *edgeVector;
} edgerec;
typedef struct _pricerec
{
REAL theta;
REAL pivot;
REAL epspivot;
int varno;
lprec *lp;
MYBOOL isdual;
} pricerec;
typedef struct _multirec
{
lprec *lp;
int size; /* The maximum number of multiply priced rows/columns */
int used; /* The current / active number of multiply priced rows/columns */
int limit; /* The active/used count at which a full update is triggered */
pricerec *items; /* Array of best multiply priced rows/columns */
int *freeList; /* The indeces of available positions in "items" */
UNIONTYPE QSORTrec *sortedList; /* List of pointers to "pricerec" items in sorted order */
REAL *stepList; /* Working array (values in sortedList order) */
REAL *valueList; /* Working array (values in sortedList order) */
int *indexSet; /* The final exported index list of pivot variables */
int active; /* Index of currently active multiply priced row/column */
int retries;
REAL step_base;
REAL step_last;
REAL obj_base;
REAL obj_last;
REAL epszero;
REAL maxpivot;
REAL maxbound;
MYBOOL sorted;
MYBOOL truncinf;
MYBOOL objcheck;
MYBOOL dirty;
} multirec;
#endif /* HEADER_lp_types */
|