|
From: <xr...@us...> - 2012-03-14 14:14:19
|
Revision: 1346
http://scstudio.svn.sourceforge.net/scstudio/?rev=1346&view=rev
Author: xrehak
Date: 2012-03-14 14:14:06 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
LpSolve added as a third party SW.
Modified Paths:
--------------
trunk/FindLpSolve.cmake
trunk/README
trunk/src/data/beautify/CMakeLists.txt
Added Paths:
-----------
trunk/third-party-sw/
trunk/third-party-sw/lpsolve/
trunk/third-party-sw/lpsolve/README
trunk/third-party-sw/lpsolve/lib/
trunk/third-party-sw/lpsolve/lib/liblpsolve55.lib
trunk/third-party-sw/lpsolve/lib/liblpsolve55d.lib
trunk/third-party-sw/lpsolve/lib/lpsolve55.dll
trunk/third-party-sw/lpsolve/lib/lpsolve55.lib
trunk/third-party-sw/lpsolve/lib32/
trunk/third-party-sw/lpsolve/lib32/liblpsolve55.a
trunk/third-party-sw/lpsolve/lib32/liblpsolve55.so
trunk/third-party-sw/lpsolve/lib64/
trunk/third-party-sw/lpsolve/lib64/liblpsolve55.a
trunk/third-party-sw/lpsolve/lib64/liblpsolve55.so
trunk/third-party-sw/lpsolve/lp_Hash.h
trunk/third-party-sw/lpsolve/lp_SOS.h
trunk/third-party-sw/lpsolve/lp_lib.h
trunk/third-party-sw/lpsolve/lp_matrix.h
trunk/third-party-sw/lpsolve/lp_mipbb.h
trunk/third-party-sw/lpsolve/lp_types.h
trunk/third-party-sw/lpsolve/lp_utils.h
trunk/third-party-sw/lpsolve/lpsolve_README.txt
Modified: trunk/FindLpSolve.cmake
===================================================================
--- trunk/FindLpSolve.cmake 2012-03-13 23:19:59 UTC (rev 1345)
+++ trunk/FindLpSolve.cmake 2012-03-14 14:14:06 UTC (rev 1346)
@@ -1,14 +1,32 @@
# set the default LPSOLVE_ROOT value
+
+set(FIND_LIBRARY_USE_LIB64_PATHS TRUE)
+
IF(NOT LPSOLVE_ROOT)
- SET(LPSOLVE_ROOT $ENV{LPSOLVE_ROOT} CACHE PATH "The LPSOLVE directory root.")
+ #set implicit LPSOLVE_ROOT
+ SET(LPSOLVE_ROOT "${CMAKE_SOURCE_DIR}/third-party-sw/lpsolve" CACHE PATH "The LPSOLVE directory root.")
+ IF(ENV{LPSOLVE_ROOT})
+ SET(LPSOLVE_ROOT $ENV{LPSOLVE_ROOT} CACHE PATH "The LPSOLVE directory root.")
+ ENDIF(ENV{LPSOLVE_ROOT})
ENDIF(NOT LPSOLVE_ROOT)
-FIND_LIBRARY(LPSOLVE_LIBRARY
- NAMES lpsolve55
- PATHS
- ${LPSOLVE_ROOT}
- ${LPSOLVE_ROOT}/lib
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ FIND_LIBRARY(LPSOLVE_LIBRARY
+ NAMES lpsolve55
+ PATHS
+ ${LPSOLVE_ROOT}
+ ${LPSOLVE_ROOT}/lib
+ ${LPSOLVE_ROOT}/lib64
+ DOC "The lp_solve library")
+ELSE()
+ FIND_LIBRARY(LPSOLVE_LIBRARY
+ NAMES lpsolve55
+ PATHS
+ ${LPSOLVE_ROOT}
+ ${LPSOLVE_ROOT}/lib
+ ${LPSOLVE_ROOT}/lib32
DOC "The lp_solve library")
+ENDIF()
FIND_PATH(LPSOLVE_INCLUDE_DIR
NAMES lp_lib.h
Modified: trunk/README
===================================================================
--- trunk/README 2012-03-13 23:19:59 UTC (rev 1345)
+++ trunk/README 2012-03-14 14:14:06 UTC (rev 1346)
@@ -20,7 +20,8 @@
view/ Applications.
visio/ Microsoft Visio plug-in.
tests/ Automated regression tests.
- tools/ Auxiliary tools and third-party SW.
+ third-party-sw/ Third-party SW.
+ tools/ Auxiliary tools.
To get the latest sources
svn co https://scstudio.svn.sourceforge.net/svnroot/scstudio/trunk scstudio
Modified: trunk/src/data/beautify/CMakeLists.txt
===================================================================
--- trunk/src/data/beautify/CMakeLists.txt 2012-03-13 23:19:59 UTC (rev 1345)
+++ trunk/src/data/beautify/CMakeLists.txt 2012-03-14 14:14:06 UTC (rev 1346)
@@ -1,4 +1,4 @@
-OPTION(BUILD_OPTIMIZER "Enable to build the layout optimizer" OFF)
+OPTION(BUILD_OPTIMIZER "Enable to build the layout optimizer" ON)
IF(BUILD_OPTIMIZER)
FIND_PACKAGE(LpSolve REQUIRED)
INCLUDE_DIRECTORIES(${LPSOLVE_INCLUDE_DIR})
Added: trunk/third-party-sw/lpsolve/README
===================================================================
--- trunk/third-party-sw/lpsolve/README (rev 0)
+++ trunk/third-party-sw/lpsolve/README 2012-03-14 14:14:06 UTC (rev 1346)
@@ -0,0 +1,10 @@
+# $Id$
+
+This is a library is downloaded from
+http://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.0/
+
+Actually, it is assembled from
+- lp_solve_5.5.2.0_dev_win32.zip
+- lp_solve_5.5.2.0_dev_ux32.tar.gz
+- lp_solve_5.5.2.0_dev_ux64.tar.gz
+- lpsolve_README.txt is taken from lp_solve_5.5.2.0_source.tar.gz
Property changes on: trunk/third-party-sw/lpsolve/README
___________________________________________________________________
Added: svn:keywords
+ Date Revision Author HeadURL Id
Added: svn:eol-style
+ native
Added: trunk/third-party-sw/lpsolve/lib/liblpsolve55.lib
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib/liblpsolve55.lib
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lib/liblpsolve55d.lib
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib/liblpsolve55d.lib
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lib/lpsolve55.dll
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib/lpsolve55.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lib/lpsolve55.lib
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib/lpsolve55.lib
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lib32/liblpsolve55.a
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib32/liblpsolve55.a
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lib32/liblpsolve55.so
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib32/liblpsolve55.so
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lib64/liblpsolve55.a
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib64/liblpsolve55.a
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lib64/liblpsolve55.so
===================================================================
(Binary files differ)
Property changes on: trunk/third-party-sw/lpsolve/lib64/liblpsolve55.so
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: trunk/third-party-sw/lpsolve/lp_Hash.h
===================================================================
--- trunk/third-party-sw/lpsolve/lp_Hash.h (rev 0)
+++ trunk/third-party-sw/lpsolve/lp_Hash.h 2012-03-14 14:14:06 UTC (rev 1346)
@@ -0,0 +1,43 @@
+#ifndef HEADER_lp_hash
+#define HEADER_lp_hash
+
+/* For row and column name hash tables */
+
+typedef struct _hashelem
+{
+ char *name;
+ int index;
+ struct _hashelem *next;
+ struct _hashelem *nextelem;
+} hashelem;
+
+typedef struct /* _hashtable */
+{
+ hashelem **table;
+ int size;
+ int base;
+ int count;
+ struct _hashelem *first;
+ struct _hashelem *last;
+} hashtable;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+STATIC hashtable *create_hash_table(int size, int base);
+STATIC void free_hash_table(hashtable *ht);
+STATIC hashelem *findhash(const char *name, hashtable *ht);
+STATIC hashelem *puthash(const char *name, int index, hashelem **list, hashtable *ht);
+STATIC void drophash(const char *name, hashelem **list, hashtable *ht);
+STATIC void free_hash_item(hashelem **hp);
+STATIC hashtable *copy_hash_table(hashtable *ht, hashelem **list, int newsize);
+STATIC int find_var(lprec *lp, char *name, MYBOOL verbose);
+STATIC int find_row(lprec *lp, char *name, MYBOOL Unconstrained_rows_found);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* HEADER_lp_hash */
+
Property changes on: trunk/third-party-sw/lpsolve/lp_Hash.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/third-party-sw/lpsolve/lp_SOS.h
===================================================================
--- trunk/third-party-sw/lpsolve/lp_SOS.h (rev 0)
+++ trunk/third-party-sw/lpsolve/lp_SOS.h 2012-03-14 14:14:06 UTC (rev 1346)
@@ -0,0 +1,108 @@
+#ifndef HEADER_lp_SOS
+#define HEADER_lp_SOS
+
+/* Specially Ordered Sets (SOS) prototypes and settings */
+/* ------------------------------------------------------------------------- */
+
+#include "lp_types.h"
+#include "lp_utils.h"
+#include "lp_matrix.h"
+
+
+/* SOS constraint defines */
+/* ------------------------------------------------------------------------- */
+#define SOS1 1
+#define SOS2 2
+#define SOS3 -1
+#define SOSn MAXINT32
+#define SOS_START_SIZE 10 /* Start size of SOS_list array; realloced if needed */
+
+/* Define SOS_is_feasible() return values */
+/* ------------------------------------------------------------------------- */
+#define SOS3_INCOMPLETE -2
+#define SOS_INCOMPLETE -1
+#define SOS_COMPLETE 0
+#define SOS_INFEASIBLE 1
+#define SOS_INTERNALERROR 2
+
+
+typedef struct _SOSgroup SOSgroup;
+
+typedef struct _SOSrec
+{
+ SOSgroup *parent;
+ int tagorder;
+ char *name;
+ int type;
+ MYBOOL isGUB;
+ int size;
+ int priority;
+ int *members;
+ REAL *weights;
+ int *membersSorted;
+ int *membersMapped;
+} SOSrec;
+
+/* typedef */ struct _SOSgroup
+{
+ lprec *lp; /* Pointer to owner */
+ SOSrec **sos_list; /* Array of pointers to SOS lists */
+ int sos_alloc; /* Size allocated to specially ordered sets (SOS1, SOS2...) */
+ int sos_count; /* Number of specially ordered sets (SOS1, SOS2...) */
+ int maxorder; /* The highest-order SOS in the group */
+ int sos1_count; /* Number of the lowest order SOS in the group */
+ int *membership; /* Array of variable-sorted indeces to SOSes that the variable is member of */
+ int *memberpos; /* Starting positions of the each column's membership list */
+} /* SOSgroup */;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* SOS storage structure */
+STATIC SOSgroup *create_SOSgroup(lprec *lp);
+STATIC void resize_SOSgroup(SOSgroup *group);
+STATIC int append_SOSgroup(SOSgroup *group, SOSrec *SOS);
+STATIC int clean_SOSgroup(SOSgroup *group, MYBOOL forceupdatemap);
+STATIC void free_SOSgroup(SOSgroup **group);
+
+STATIC SOSrec *create_SOSrec(SOSgroup *group, char *name, int type, int priority, int size, int *variables, REAL *weights);
+STATIC MYBOOL delete_SOSrec(SOSgroup *group, int sosindex);
+STATIC int append_SOSrec(SOSrec *SOS, int size, int *variables, REAL *weights);
+STATIC void free_SOSrec(SOSrec *SOS);
+
+/* SOS utilities */
+STATIC int make_SOSchain(lprec *lp, MYBOOL forceresort);
+STATIC int SOS_member_updatemap(SOSgroup *group);
+STATIC MYBOOL SOS_member_sortlist(SOSgroup *group, int sosindex);
+STATIC MYBOOL SOS_shift_col(SOSgroup *group, int sosindex, int column, int delta, LLrec *usedmap, MYBOOL forceresort);
+int SOS_member_delete(SOSgroup *group, int sosindex, int member);
+int SOS_get_type(SOSgroup *group, int sosindex);
+int SOS_infeasible(SOSgroup *group, int sosindex);
+int SOS_member_index(SOSgroup *group, int sosindex, int member);
+int SOS_member_count(SOSgroup *group, int sosindex);
+int SOS_memberships(SOSgroup *group, int column);
+int *SOS_get_candidates(SOSgroup *group, int sosindex, int column, MYBOOL excludetarget, REAL *upbound, REAL *lobound);
+int SOS_is_member(SOSgroup *group, int sosindex, int column);
+MYBOOL SOS_is_member_of_type(SOSgroup *group, int column, int sostype);
+MYBOOL SOS_set_GUB(SOSgroup *group, int sosindex, MYBOOL state);
+MYBOOL SOS_is_GUB(SOSgroup *group, int sosindex);
+MYBOOL SOS_is_marked(SOSgroup *group, int sosindex, int column);
+MYBOOL SOS_is_active(SOSgroup *group, int sosindex, int column);
+MYBOOL SOS_is_full(SOSgroup *group, int sosindex, int column, MYBOOL activeonly);
+MYBOOL SOS_can_activate(SOSgroup *group, int sosindex, int column);
+MYBOOL SOS_set_marked(SOSgroup *group, int sosindex, int column, MYBOOL asactive);
+MYBOOL SOS_unmark(SOSgroup *group, int sosindex, int column);
+int SOS_fix_unmarked(SOSgroup *group, int sosindex, int variable, REAL *bound, REAL value,
+ MYBOOL isupper, int *diffcount, DeltaVrec *changelog);
+int SOS_fix_list(SOSgroup *group, int sosindex, int variable, REAL *bound,
+ int *varlist, MYBOOL isleft, DeltaVrec *changelog);
+int SOS_is_satisfied(SOSgroup *group, int sosindex, REAL *solution);
+MYBOOL SOS_is_feasible(SOSgroup *group, int sosindex, REAL *solution);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* HEADER_lp_SOS */
Property changes on: trunk/third-party-sw/lpsolve/lp_SOS.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/third-party-sw/lpsolve/lp_lib.h
===================================================================
--- trunk/third-party-sw/lpsolve/lp_lib.h (rev 0)
+++ trunk/third-party-sw/lpsolve/lp_lib.h 2012-03-14 14:14:06 UTC (rev 1346)
@@ -0,0 +1,2294 @@
+
+#ifndef HEADER_lp_lib
+#define HEADER_lp_lib
+
+/* --------------------------------------------------------------------------
+
+ This is the main library header file for the lp_solve v5.0 release
+
+ Starting at version 3.0, LP_Solve is released under the LGPL license.
+ For full information, see the enclosed file LGPL.txt.
+
+ Original developer: Michel Berkelaar - mi...@ic...
+ Most changes 1.5-2.0: Jeroen Dirks - je...@to...
+ Changes 3.2-4.0: Kjell Eikland - kje...@br...
+ (Simplex code, SOS, SC, code optimization)
+ Peter Notebaert - lp...@pe...
+ (Sensitivity analysis, documentation)
+ Changes 5.0+: Kjell Eikland - kje...@br...
+ (BFP, XLI, simplex, B&B, code modularization)
+ Peter Notebaert - lp...@pe...
+ (Sensitivity analysis, New lp parser, LINDO (XLI)
+ parser, VB/.NET interface, documentation)
+
+ Release notes:
+
+ Version 4.0 enhances version 3.2 in terms of internal program/simplex
+ architecture, call level interfaces, data layout, features and contains
+ several bug fixes. There is now complete support for semi-continuous
+ variables and SOS constructions. In the process, a complete API
+ was added. The MPS parser has been amended to support this.
+ Sensitivity analysis and variouse bug fixes was provided by Peter
+ Notebaert in 4.0 sub-releases. Peter also wrote a complete
+ documentation of the API and contributed a VB interface, both of which
+ significantly enhanced the accessibility of lp_solve.
+
+ Version 5.0 is a major rewrite and code cleanup. The main additions that
+ drove forward this cleanup were the modular inversion logic with optimal
+ column ordering, addition of primal phase 1 and dual phase 2 logic for
+ full flexibility in the selection of primal and dual simplex modes,
+ DEVEX and steepest edge pivot selection, along with dynamic cycling
+ detection and prevention. This cleanup made it possible to harmonize the
+ internal rounding principles, contributing to increased numerical stability.
+
+ Version 5.1 rearranges the matrix storage model by enabling both legacy
+ element record-based storage and split vector storage. In addition the
+ lprec structure is optimized and additional routines are added, mainly for
+ sparse vector additions and enhanced XLI functionality. Support for XML-
+ based models was added on the basis of the LPFML schema via xli_LPFML.
+
+ Version 5.2 removes the objective function from the constraint matrix,
+ adds a number of presolve options and speed them up. Degeneracy handling
+ is significantly improved. Support for XLI_ZIMPL was added.
+ Multiple and partial pricing has been enhanced and activated.
+
+ -------------------------------------------------------------------------- */
+/* Define user program feature option switches */
+/* ------------------------------------------------------------------------- */
+
+# if defined _WIN32 && !defined __GNUC__
+# define isnan _isnan
+# endif
+#if defined NOISNAN
+# define isnan(x) FALSE
+#endif
+
+#define SETMASK(variable, mask) variable |= mask
+#define CLEARMASK(variable, mask) variable &= ~(mask)
+#define TOGGLEMASK(variable, mask) variable ^= mask
+#define ISMASKSET(variable, mask) (MYBOOL) (((variable) & (mask)) != 0)
+
+/* Utility/system settings */
+/* ------------------------------------------------------------------------- */
+/*#define INTEGERTIME */ /* Set use of lower-resolution timer */
+
+
+/* New v5.0+ simplex/optimization features and settings */
+/* ------------------------------------------------------------------------- */
+/*#define NoRowScaleOF */ /* Optionally skip row-scaling of the OF */
+#define DoMatrixRounding /* Round A matrix elements to precision */
+#define DoBorderRounding /* Round RHS, bounds and ranges to precision */
+#define Phase1EliminateRedundant /* Remove rows of redundant artificials */
+#define FixViolatedOptimal
+#define ImproveSolutionPrecision /* Round optimal solution values */
+/*#define IncreasePivotOnReducedAccuracy */ /* Increase epspivot on instability */
+/*#define FixInaccurateDualMinit */ /* Reinvert on inaccuracy in dual minits */
+/*#define EnforcePositiveTheta */ /* Ensure that the theta range is valid */
+#define ResetMinitOnReinvert
+/*#define UsePrimalReducedCostUpdate */ /* Not tested */
+/*#define UseDualReducedCostUpdate */ /* Seems Ok, but slower than expected */
+/*#ifdef UseLegacyExtrad */ /* Use v3.2- style Extrad method */
+#define UseMilpExpandedRCF /* Non-ints in reduced cost bound tightening */
+/*#define UseMilpSlacksRCF */ /* Slacks in reduced cost bound tightening (degen
+ prone); requires !SlackInitMinusInf */
+#define LegacySlackDefinition /* Slack as the "value of the constraint" */
+
+
+/* Development features (change at own risk) */
+/* ------------------------------------------------------------------------- */
+/*#define MIPboundWithOF */ /* Enable to detect OF constraint for use during B&B */
+/*#define SlackInitMinusInf */ /* Slacks have 0 LB if this is not defined */
+#define FULLYBOUNDEDSIMPLEX FALSE /* WARNING: Activate at your own risk! */
+
+
+/* Specify use of the basic linear algebra subroutine library */
+/* ------------------------------------------------------------------------- */
+#define libBLAS 2 /* 0: No, 1: Internal, 2: External */
+#define libnameBLAS "myBLAS"
+
+
+/* Active inverse logic (default is optimized original etaPFI) */
+/* ------------------------------------------------------------------------- */
+#if !defined LoadInverseLib
+# define LoadInverseLib TRUE /* Enable alternate inverse libraries */
+#endif
+/*#define ExcludeNativeInverse */ /* Disable INVERSE_ACTIVE inverse engine */
+
+#define DEF_OBJINBASIS TRUE /* Additional rows inserted at the top (1 => OF) */
+
+#define INVERSE_NONE -1
+#define INVERSE_LEGACY 0
+#define INVERSE_ETAPFI 1
+#define INVERSE_LUMOD 2
+#define INVERSE_LUSOL 3
+#define INVERSE_GLPKLU 4
+
+#ifndef RoleIsExternalInvEngine /* Defined in inverse DLL drivers */
+ #ifdef ExcludeNativeInverse
+ #define INVERSE_ACTIVE INVERSE_NONE /* Disable native engine */
+ #else
+ #define INVERSE_ACTIVE INVERSE_LEGACY /* User or DLL-selected */
+ #endif
+#endif
+
+
+/* Active external language interface logic (default is none) */
+/* ------------------------------------------------------------------------- */
+#if !defined LoadLanguageLib
+# define LoadLanguageLib TRUE /* Enable alternate language libraries */
+#endif
+#define ExcludeNativeLanguage /* Disable LANGUAGE_ACTIVE XLI */
+
+#define LANGUAGE_NONE -1
+#define LANGUAGE_LEGACYLP 0
+#define LANGUAGE_CPLEXLP 1
+#define LANGUAGE_MPSX 2
+#define LANGUAGE_LPFML 3
+#define LANGUAGE_MATHPROG 4
+#define LANGUAGE_AMPL 5
+#define LANGUAGE_GAMS 6
+#define LANGUAGE_ZIMPL 7
+#define LANGUAGE_S 8
+#define LANGUAGE_R 9
+#define LANGUAGE_MATLAB 10
+#define LANGUAGE_OMATRIX 11
+#define LANGUAGE_SCILAB 12
+#define LANGUAGE_OCTAVE 13
+#define LANGUAGE_EMPS 14
+
+#ifndef RoleIsExternalLanguageEngine /* Defined in XLI driver libraries */
+ #ifdef ExcludeNativeLanguage
+ #define LANGUAGE_ACTIVE LANGUAGE_NONE /* Disable native engine */
+ #else
+ #define LANGUAGE_ACTIVE LANGUAGE_CPLEXLP /* User or DLL-selected */
+ #endif
+#endif
+
+
+/* Default parameters and tolerances */
+/* ------------------------------------------------------------------------- */
+#define OriginalPARAM 0
+#define ProductionPARAM 1
+#define ChvatalPARAM 2
+#define LoosePARAM 3
+#if 1
+ #define ActivePARAM ProductionPARAM
+#else
+ #define ActivePARAM LoosePARAM
+#endif
+
+
+/* Miscellaneous settings */
+/* ------------------------------------------------------------------------- */
+#ifndef Paranoia
+ #ifdef _DEBUG
+ #define Paranoia
+ #endif
+#endif
+
+
+/* Program version data */
+/* ------------------------------------------------------------------------- */
+#define MAJORVERSION 5
+#define MINORVERSION 5
+#define RELEASE 2
+#define BUILD 0
+#define BFPVERSION 12 /* Checked against bfp_compatible() */
+#define XLIVERSION 12 /* Checked against xli_compatible() */
+/* Note that both BFPVERSION and XLIVERSION typically have to be incremented
+ in the case that the lprec structure changes. */
+
+
+/* Include/header files */
+/* ------------------------------------------------------------------------- */
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "lp_types.h"
+#include "lp_utils.h"
+
+#if (LoadInverseLib == TRUE) || (LoadLanguageLib == TRUE)
+ #ifdef WIN32
+ #include <windows.h>
+ #else
+ #include <dlfcn.h>
+ #endif
+#endif
+
+#ifndef BFP_CALLMODEL
+ #ifdef WIN32
+ #define BFP_CALLMODEL __stdcall /* "Standard" call model */
+ #else
+ #define BFP_CALLMODEL
+ #endif
+#endif
+#ifndef XLI_CALLMODEL
+ #define XLI_CALLMODEL BFP_CALLMODEL
+#endif
+
+#define REGISTER register /* Speed up certain operations */
+
+
+/* Definition of program constrants */
+/* ------------------------------------------------------------------------- */
+#define SIMPLEX_UNDEFINED 0
+#define SIMPLEX_Phase1_PRIMAL 1
+#define SIMPLEX_Phase1_DUAL 2
+#define SIMPLEX_Phase2_PRIMAL 4
+#define SIMPLEX_Phase2_DUAL 8
+#define SIMPLEX_DYNAMIC 16
+#define SIMPLEX_AUTODUALIZE 32
+
+#define SIMPLEX_PRIMAL_PRIMAL (SIMPLEX_Phase1_PRIMAL + SIMPLEX_Phase2_PRIMAL)
+#define SIMPLEX_DUAL_PRIMAL (SIMPLEX_Phase1_DUAL + SIMPLEX_Phase2_PRIMAL)
+#define SIMPLEX_PRIMAL_DUAL (SIMPLEX_Phase1_PRIMAL + SIMPLEX_Phase2_DUAL)
+#define SIMPLEX_DUAL_DUAL (SIMPLEX_Phase1_DUAL + SIMPLEX_Phase2_DUAL)
+#define SIMPLEX_DEFAULT (SIMPLEX_DUAL_PRIMAL)
+
+/* Variable codes (internal) */
+#define ISREAL 0
+#define ISINTEGER 1
+#define ISSEMI 2
+#define ISSOS 4
+#define ISSOSTEMPINT 8
+#define ISGUB 16
+
+/* Presolve defines */
+#define PRESOLVE_NONE 0
+#define PRESOLVE_ROWS 1
+#define PRESOLVE_COLS 2
+#define PRESOLVE_LINDEP 4
+#define PRESOLVE_AGGREGATE 8 /* Not implemented */
+#define PRESOLVE_SPARSER 16 /* Not implemented */
+#define PRESOLVE_SOS 32
+#define PRESOLVE_REDUCEMIP 64
+#define PRESOLVE_KNAPSACK 128 /* Implementation not tested completely */
+#define PRESOLVE_ELIMEQ2 256
+#define PRESOLVE_IMPLIEDFREE 512
+#define PRESOLVE_REDUCEGCD 1024
+#define PRESOLVE_PROBEFIX 2048
+#define PRESOLVE_PROBEREDUCE 4096
+#define PRESOLVE_ROWDOMINATE 8192
+#define PRESOLVE_COLDOMINATE 16384 /* Reduced functionality, should be expanded */
+#define PRESOLVE_MERGEROWS 32768
+#define PRESOLVE_IMPLIEDSLK 65536
+#define PRESOLVE_COLFIXDUAL 131072
+#define PRESOLVE_BOUNDS 262144
+#define PRESOLVE_LASTMASKMODE (PRESOLVE_DUALS - 1)
+#define PRESOLVE_DUALS 524288
+#define PRESOLVE_SENSDUALS 1048576
+
+/* Basis crash options */
+#define CRASH_NONE 0
+#define CRASH_NONBASICBOUNDS 1
+#define CRASH_MOSTFEASIBLE 2
+#define CRASH_LEASTDEGENERATE 3
+
+/* Solution recomputation options (internal) */
+#define INITSOL_SHIFTZERO 0
+#define INITSOL_USEZERO 1
+#define INITSOL_ORIGINAL 2
+
+/* Strategy codes to avoid or recover from degenerate pivots,
+ infeasibility or numeric errors via randomized bound relaxation */
+#define ANTIDEGEN_NONE 0
+#define ANTIDEGEN_FIXEDVARS 1
+#define ANTIDEGEN_COLUMNCHECK 2
+#define ANTIDEGEN_STALLING 4
+#define ANTIDEGEN_NUMFAILURE 8
+#define ANTIDEGEN_LOSTFEAS 16
+#define ANTIDEGEN_INFEASIBLE 32
+#define ANTIDEGEN_DYNAMIC 64
+#define ANTIDEGEN_DURINGBB 128
+#define ANTIDEGEN_RHSPERTURB 256
+#define ANTIDEGEN_BOUNDFLIP 512
+#define ANTIDEGEN_DEFAULT (ANTIDEGEN_FIXEDVARS | ANTIDEGEN_STALLING /* | ANTIDEGEN_INFEASIBLE */)
+
+/* REPORT defines */
+#define NEUTRAL 0
+#define CRITICAL 1
+#define SEVERE 2
+#define IMPORTANT 3
+#define NORMAL 4
+#define DETAILED 5
+#define FULL 6
+
+/* MESSAGE defines */
+#define MSG_NONE 0
+#define MSG_PRESOLVE 1
+#define MSG_ITERATION 2
+#define MSG_INVERT 4
+#define MSG_LPFEASIBLE 8
+#define MSG_LPOPTIMAL 16
+#define MSG_LPEQUAL 32
+#define MSG_LPBETTER 64
+#define MSG_MILPFEASIBLE 128
+#define MSG_MILPEQUAL 256
+#define MSG_MILPBETTER 512
+#define MSG_MILPSTRATEGY 1024
+#define MSG_MILPOPTIMAL 2048
+#define MSG_PERFORMANCE 4096
+#define MSG_INITPSEUDOCOST 8192
+
+/* MPS file types */
+#define MPSFIXED 1
+#define MPSFREE 2
+#define MPSIBM 4
+#define MPSNEGOBJCONST 8
+
+#define MPS_FREE (MPSFREE<<2)
+#define MPS_IBM (MPSIBM<<2)
+#define MPS_NEGOBJCONST (MPSNEGOBJCONST<<2)
+
+/* MPS defines (internal) */
+#define MPSUNDEF -4
+#define MPSNAME -3
+#define MPSOBJSENSE -2
+#define MPSOBJNAME -1
+#define MPSROWS 0
+#define MPSCOLUMNS 1
+#define MPSRHS 2
+#define MPSBOUNDS 3
+#define MPSRANGES 4
+#define MPSSOS 5
+
+#define MPSVARMASK "%-8s"
+#define MPSVALUEMASK "%12g"
+
+/* Constraint type codes (internal) */
+#define ROWTYPE_EMPTY 0
+#define ROWTYPE_LE 1
+#define ROWTYPE_GE 2
+#define ROWTYPE_EQ 3
+#define ROWTYPE_CONSTRAINT ROWTYPE_EQ /* This is the mask for modes */
+#define ROWTYPE_OF 4
+#define ROWTYPE_INACTIVE 8
+#define ROWTYPE_RELAX 16
+#define ROWTYPE_GUB 32
+#define ROWTYPE_OFMAX (ROWTYPE_OF + ROWTYPE_GE)
+#define ROWTYPE_OFMIN (ROWTYPE_OF + ROWTYPE_LE)
+#define ROWTYPE_CHSIGN ROWTYPE_GE
+
+/* Public constraint codes */
+#define FR ROWTYPE_EMPTY
+#define LE ROWTYPE_LE
+#define GE ROWTYPE_GE
+#define EQ ROWTYPE_EQ
+#define OF ROWTYPE_OF
+
+/* MIP constraint classes */
+#define ROWCLASS_Unknown 0 /* Undefined/unknown */
+#define ROWCLASS_Objective 1 /* The objective function */
+#define ROWCLASS_GeneralREAL 2 /* General real-values constraint */
+#define ROWCLASS_GeneralMIP 3 /* General mixed integer/binary and real valued constraint */
+#define ROWCLASS_GeneralINT 4 /* General integer-only constraint */
+#define ROWCLASS_GeneralBIN 5 /* General binary-only constraint */
+#define ROWCLASS_KnapsackINT 6 /* Sum of positive integer times integer variables <= positive integer */
+#define ROWCLASS_KnapsackBIN 7 /* Sum of positive integer times binary variables <= positive integer */
+#define ROWCLASS_SetPacking 8 /* Sum of binary variables >= 1 */
+#define ROWCLASS_SetCover 9 /* Sum of binary variables <= 1 */
+#define ROWCLASS_GUB 10 /* Sum of binary variables = 1 */
+#define ROWCLASS_MAX ROWCLASS_GUB
+
+/* Column subsets (internal) */
+#define SCAN_USERVARS 1
+#define SCAN_SLACKVARS 2
+#define SCAN_ARTIFICIALVARS 4
+#define SCAN_PARTIALBLOCK 8
+#define USE_BASICVARS 16
+#define USE_NONBASICVARS 32
+#define SCAN_NORMALVARS (SCAN_USERVARS + SCAN_ARTIFICIALVARS)
+#define SCAN_ALLVARS (SCAN_SLACKVARS + SCAN_USERVARS + SCAN_ARTIFICIALVARS)
+#define USE_ALLVARS (USE_BASICVARS + USE_NONBASICVARS)
+#define OMIT_FIXED 64
+#define OMIT_NONFIXED 128
+
+/* Improvement defines */
+#define IMPROVE_NONE 0
+#define IMPROVE_SOLUTION 1
+#define IMPROVE_DUALFEAS 2
+#define IMPROVE_THETAGAP 4
+#define IMPROVE_BBSIMPLEX 8
+#define IMPROVE_DEFAULT (IMPROVE_DUALFEAS + IMPROVE_THETAGAP)
+#define IMPROVE_INVERSE (IMPROVE_SOLUTION + IMPROVE_THETAGAP)
+
+/* Scaling types */
+#define SCALE_NONE 0
+#define SCALE_EXTREME 1
+#define SCALE_RANGE 2
+#define SCALE_MEAN 3
+#define SCALE_GEOMETRIC 4
+#define SCALE_FUTURE1 5
+#define SCALE_FUTURE2 6
+#define SCALE_CURTISREID 7 /* Override to Curtis-Reid "optimal" scaling */
+
+/* Alternative scaling weights */
+#define SCALE_LINEAR 0
+#define SCALE_QUADRATIC 8
+#define SCALE_LOGARITHMIC 16
+#define SCALE_USERWEIGHT 31
+#define SCALE_MAXTYPE (SCALE_QUADRATIC-1)
+
+/* Scaling modes */
+#define SCALE_POWER2 32 /* As is or rounded to power of 2 */
+#define SCALE_EQUILIBRATE 64 /* Make sure that no scaled number is above 1 */
+#define SCALE_INTEGERS 128 /* Apply to integer columns/variables */
+#define SCALE_DYNUPDATE 256 /* Apply incrementally every solve() */
+#define SCALE_ROWSONLY 512 /* Override any scaling to only scale the rows */
+#define SCALE_COLSONLY 1024 /* Override any scaling to only scale the rows */
+
+/* Standard defines for typical scaling models (no Lagrangeans) */
+#define SCALEMODEL_EQUILIBRATED (SCALE_LINEAR+SCALE_EXTREME+SCALE_INTEGERS)
+#define SCALEMODEL_GEOMETRIC (SCALE_LINEAR+SCALE_GEOMETRIC+SCALE_INTEGERS)
+#define SCALEMODEL_ARITHMETIC (SCALE_LINEAR+SCALE_MEAN+SCALE_INTEGERS)
+#define SCALEMODEL_DYNAMIC (SCALEMODEL_GEOMETRIC+SCALE_EQUILIBRATE)
+#define SCALEMODEL_CURTISREID (SCALE_CURTISREID+SCALE_INTEGERS+SCALE_POWER2)
+
+/* Iteration status and strategies (internal) */
+#define ITERATE_MAJORMAJOR 0
+#define ITERATE_MINORMAJOR 1
+#define ITERATE_MINORRETRY 2
+
+/* Pricing methods */
+#define PRICER_FIRSTINDEX 0
+#define PRICER_DANTZIG 1
+#define PRICER_DEVEX 2
+#define PRICER_STEEPESTEDGE 3
+#define PRICER_LASTOPTION PRICER_STEEPESTEDGE
+
+/* Additional settings for pricers (internal) */
+#define PRICER_RANDFACT 0.1
+#define DEVEX_RESTARTLIMIT 1.0e+09 /* Reset the norms if any value exceeds this limit */
+#define DEVEX_MINVALUE 0.000 /* Minimum weight [0..1] for entering variable, consider 0.01 */
+
+/* Pricing strategies */
+#define PRICE_PRIMALFALLBACK 4 /* In case of Steepest Edge, fall back to DEVEX in primal */
+#define PRICE_MULTIPLE 8 /* Enable multiple pricing (primal simplex) */
+#define PRICE_PARTIAL 16 /* Enable partial pricing */
+#define PRICE_ADAPTIVE 32 /* Temporarily use alternative strategy if cycling is detected */
+#define PRICE_HYBRID 64 /* NOT IMPLEMENTED */
+#define PRICE_RANDOMIZE 128 /* Adds a small randomization effect to the selected pricer */
+#define PRICE_AUTOPARTIAL 256 /* Detect and use data on the block structure of the model (primal) */
+#define PRICE_AUTOMULTIPLE 512 /* Automatically select multiple pricing (primal simplex) */
+#define PRICE_LOOPLEFT 1024 /* Scan entering/leaving columns left rather than right */
+#define PRICE_LOOPALTERNATE 2048 /* Scan entering/leaving columns alternatingly left/right */
+#define PRICE_HARRISTWOPASS 4096 /* Use Harris' primal pivot logic rather than the default */
+#define PRICE_FORCEFULL 8192 /* Non-user option to force full pricing */
+#define PRICE_TRUENORMINIT 16384 /* Use true norms for Devex and Steepest Edge initializations */
+
+/*#define _PRICE_NOBOUNDFLIP*/
+#if defined _PRICE_NOBOUNDFLIP
+#define PRICE_NOBOUNDFLIP 65536 /* Disallow automatic bound-flip during pivot */
+#endif
+
+#define PRICE_STRATEGYMASK (PRICE_PRIMALFALLBACK + \
+ PRICE_MULTIPLE + PRICE_PARTIAL + \
+ PRICE_ADAPTIVE + PRICE_HYBRID + \
+ PRICE_RANDOMIZE + PRICE_AUTOPARTIAL + PRICE_AUTOMULTIPLE + \
+ PRICE_LOOPLEFT + PRICE_LOOPALTERNATE + \
+ PRICE_HARRISTWOPASS + \
+ PRICE_FORCEFULL + PRICE_TRUENORMINIT)
+
+/* B&B active variable codes (internal) */
+#define BB_REAL 0
+#define BB_INT 1
+#define BB_SC 2
+#define BB_SOS 3
+#define BB_GUB 4
+
+/* B&B strategies */
+#define NODE_FIRSTSELECT 0
+#define NODE_GAPSELECT 1
+#define NODE_RANGESELECT 2
+#define NODE_FRACTIONSELECT 3
+#define NODE_PSEUDOCOSTSELECT 4
+#define NODE_PSEUDONONINTSELECT 5 /* Kjell Eikland #1 - Minimize B&B depth */
+#define NODE_PSEUDOFEASSELECT (NODE_PSEUDONONINTSELECT+NODE_WEIGHTREVERSEMODE)
+#define NODE_PSEUDORATIOSELECT 6 /* Kjell Eikland #2 - Minimize a "cost/benefit" ratio */
+#define NODE_USERSELECT 7
+#define NODE_STRATEGYMASK (NODE_WEIGHTREVERSEMODE-1) /* Mask for B&B strategies */
+#define NODE_WEIGHTREVERSEMODE 8
+#define NODE_BRANCHREVERSEMODE 16
+#define NODE_GREEDYMODE 32
+#define NODE_PSEUDOCOSTMODE 64
+#define NODE_DEPTHFIRSTMODE 128
+#define NODE_RANDOMIZEMODE 256
+#define NODE_GUBMODE 512
+#define NODE_DYNAMICMODE 1024
+#define NODE_RESTARTMODE 2048
+#define NODE_BREADTHFIRSTMODE 4096
+#define NODE_AUTOORDER 8192
+#define NODE_RCOSTFIXING 16384
+#define NODE_STRONGINIT 32768
+
+#define BRANCH_CEILING 0
+#define BRANCH_FLOOR 1
+#define BRANCH_AUTOMATIC 2
+#define BRANCH_DEFAULT 3
+
+/* Action constants for simplex and B&B (internal) */
+#define ACTION_NONE 0
+#define ACTION_ACTIVE 1
+#define ACTION_REBASE 2
+#define ACTION_RECOMPUTE 4
+#define ACTION_REPRICE 8
+#define ACTION_REINVERT 16
+#define ACTION_TIMEDREINVERT 32
+#define ACTION_ITERATE 64
+#define ACTION_RESTART 255
+
+/* Solver status values */
+#define UNKNOWNERROR -5
+#define DATAIGNORED -4
+#define NOBFP -3
+#define NOMEMORY -2
+#define NOTRUN -1
+#define OPTIMAL 0
+#define SUBOPTIMAL 1
+#define INFEASIBLE 2
+#define UNBOUNDED 3
+#define DEGENERATE 4
+#define NUMFAILURE 5
+#define USERABORT 6
+#define TIMEOUT 7
+#define RUNNING 8
+#define PRESOLVED 9
+
+/* Branch & Bound and Lagrangean extra status values (internal) */
+#define PROCFAIL 10
+#define PROCBREAK 11
+#define FEASFOUND 12
+#define NOFEASFOUND 13
+#define FATHOMED 14
+
+/* Status values internal to the solver (internal) */
+#define SWITCH_TO_PRIMAL 20
+#define SWITCH_TO_DUAL 21
+#define SINGULAR_BASIS 22
+#define LOSTFEAS 23
+#define MATRIXERROR 24
+
+/* Objective testing options for "bb_better" (internal) */
+#define OF_RELAXED 0
+#define OF_INCUMBENT 1
+#define OF_WORKING 2
+#define OF_USERBREAK 3
+#define OF_HEURISTIC 4
+#define OF_DUALLIMIT 5
+#define OF_DELTA 8 /* Mode */
+#define OF_PROJECTED 16 /* Mode - future, not active */
+
+#define OF_TEST_BT 1
+#define OF_TEST_BE 2
+#define OF_TEST_NE 3
+#define OF_TEST_WE 4
+#define OF_TEST_WT 5
+#define OF_TEST_RELGAP 8 /* Mode */
+
+
+/* Name list and sparse matrix storage parameters (internal) */
+#define MAT_START_SIZE 10000
+#define DELTACOLALLOC 100
+#define DELTAROWALLOC 100
+#define RESIZEFACTOR 4 /* Fractional increase in selected memory allocations */
+
+/* Default solver parameters and tolerances (internal) */
+#define DEF_PARTIALBLOCKS 10 /* The default number of blocks for partial pricing */
+#define DEF_MAXRELAX 7 /* Maximum number of non-BB relaxations in MILP */
+#define DEF_MAXPIVOTRETRY 10 /* Maximum number of times to retry a div-0 situation */
+#define DEF_MAXSINGULARITIES 10 /* Maximum number of singularities in refactorization */
+#define MAX_MINITUPDATES 60 /* Maximum number of bound swaps between refactorizations
+ without recomputing the whole vector - contain errors */
+#define MIN_REFACTFREQUENCY 5 /* Refactorization frequency indicating an inherent
+ numerical instability of the basis */
+#define LAG_SINGULARLIMIT 5 /* Number of times the objective does not change
+ before it is assumed that the Lagrangean constraints
+ are non-binding, and therefore impossible to converge;
+ upper iteration limit is divided by this threshold */
+#define MIN_TIMEPIVOT 5.0e-02 /* Minimum time per pivot for reinversion optimization
+ purposes; use active monitoring only if a pivot
+ takes more than MINTIMEPIVOT seconds. 5.0e-2 is
+ roughly suitable for a 1GHz system. */
+#define MAX_STALLCOUNT 12 /* The absolute upper limit to the number of stalling or
+ cycling iterations before switching rule */
+#define MAX_RULESWITCH 5 /* The maximum number of times to try an alternate pricing rule
+ to recover from stalling; set negative for no limit. */
+#define DEF_TIMEDREFACT AUTOMATIC /* Default for timed refactorization in BFPs;
+ can be FALSE, TRUE or AUTOMATIC (dynamic) */
+
+#define DEF_SCALINGLIMIT 5 /* The default maximum number of scaling iterations */
+
+#define DEF_NEGRANGE -1.0e+06 /* Downward limit for expanded variable range before the
+ variable is split into positive and negative components */
+#define DEF_BB_LIMITLEVEL -50 /* Relative B&B limit to protect against very deep,
+ memory-consuming trees */
+
+#define MAX_FRACSCALE 6 /* The maximum decimal scan range for simulated integers */
+#define RANDSCALE 100 /* Randomization scaling range */
+#define DOUBLEROUND 0.0e-02 /* Extra rounding scalar used in btran/ftran calculations; the
+ rationale for 0.0 is that prod_xA() uses rounding as well */
+#define DEF_EPSMACHINE 2.22e-16 /* Machine relative precision (doubles) */
+#define MIN_STABLEPIVOT 5.0 /* Minimum pivot magnitude assumed to be numerically stable */
+
+
+/* Precision macros */
+/* -------------------------------------------------------------------------------------- */
+#define PREC_REDUCEDCOST lp->epsvalue
+#define PREC_IMPROVEGAP lp->epsdual
+#define PREC_SUBSTFEASGAP lp->epsprimal
+#if 1
+ #define PREC_BASICSOLUTION lp->epsvalue /* Zero-rounding of RHS/basic solution vector */
+#else
+ #define PREC_BASICSOLUTION lp->epsmachine /* Zero-rounding of RHS/basic solution vector */
+#endif
+#define LIMIT_ABS_REL 10.0 /* Limit for testing using relative metric */
+
+
+/* Parameters constants for short-cut setting of tolerances */
+/* -------------------------------------------------------------------------------------- */
+#define EPS_TIGHT 0
+#define EPS_MEDIUM 1
+#define EPS_LOOSE 2
+#define EPS_BAGGY 3
+#define EPS_DEFAULT EPS_TIGHT
+
+
+#if ActivePARAM==ProductionPARAM /* PARAMETER SET FOR PRODUCTION */
+/* -------------------------------------------------------------------------------------- */
+#define DEF_INFINITE 1.0e+30 /* Limit for dynamic range */
+#define DEF_EPSVALUE 1.0e-12 /* High accuracy and feasibility preserving tolerance */
+#define DEF_EPSPRIMAL 1.0e-10 /* For rounding primal/RHS values to 0 */
+#define DEF_EPSDUAL 1.0e-09 /* For rounding reduced costs to 0 */
+#define DEF_EPSPIVOT 2.0e-07 /* Pivot reject threshold */
+#define DEF_PERTURB 1.0e-05 /* Perturbation scalar for degenerate problems;
+ must at least be RANDSCALE greater than EPSPRIMAL */
+#define DEF_EPSSOLUTION 1.0e-05 /* Margin of error for solution bounds */
+#define DEF_EPSINT 1.0e-07 /* Accuracy for considering a float value as integer */
+
+#elif ActivePARAM==OriginalPARAM /* PARAMETER SET FOR LEGACY VERSIONS */
+/* -------------------------------------------------------------------------------------- */
+#define DEF_INFINITE 1.0e+24 /* Limit for dynamic range */
+#define DEF_EPSVALUE 1.0e-08 /* High accuracy and feasibility preserving tolerance */
+#define DEF_EPSPRIMAL 5.01e-07 /* For rounding primal/RHS values to 0, infeasibility */
+#define DEF_EPSDUAL 1.0e-06 /* For rounding reduced costs to 0 */
+#define DEF_EPSPIVOT 1.0e-04 /* Pivot reject threshold */
+#define DEF_PERTURB 1.0e-05 /* Perturbation scalar for degenerate problems;
+ must at least be RANDSCALE greater than EPSPRIMAL */
+#define DEF_EPSSOLUTION 1.0e-02 /* Margin of error for solution bounds */
+#define DEF_EPSINT 1.0e-03 /* Accuracy for considering a float value as integer */
+
+#elif ActivePARAM==ChvatalPARAM /* PARAMETER SET EXAMPLES FROM Vacek Chvatal */
+/* -------------------------------------------------------------------------------------- */
+#define DEF_INFINITE 1.0e+30 /* Limit for dynamic range */
+#define DEF_EPSVALUE 1.0e-10 /* High accuracy and feasibility preserving tolerance */
+#define DEF_EPSPRIMAL 10e-07 /* For rounding primal/RHS values to 0 */
+#define DEF_EPSDUAL 10e-05 /* For rounding reduced costs to 0 */
+#define DEF_EPSPIVOT 10e-05 /* Pivot reject threshold */
+#define DEF_PERTURB 10e-03 /* Perturbation scalar for degenerate problems;
+ must at least be RANDSCALE greater than EPSPRIMAL */
+#define DEF_EPSSOLUTION 1.0e-05 /* Margin of error for solution bounds */
+#define DEF_EPSINT 5.0e-03 /* Accuracy for considering a float value as integer */
+
+#elif ActivePARAM==LoosePARAM /* PARAMETER SET FOR LOOSE TOLERANCES */
+/* -------------------------------------------------------------------------------------- */
+#define DEF_INFINITE 1.0e+30 /* Limit for dynamic range */
+#define DEF_EPSVALUE 1.0e-10 /* High accuracy and feasibility preserving tolerance */
+#define DEF_EPSPRIMAL 5.01e-08 /* For rounding primal/RHS values to 0 */
+#define DEF_EPSDUAL 1.0e-07 /* For rounding reduced costs to 0 */
+#define DEF_EPSPIVOT 1.0e-05 /* Pivot reject threshold */
+#define DEF_PERTURB 1.0e-05 /* Perturbation scalar for degenerate problems;
+ must at least be RANDSCALE greater than EPSPRIMAL */
+#define DEF_EPSSOLUTION 1.0e-05 /* Margin of error for solution bounds */
+#define DEF_EPSINT 1.0e-04 /* Accuracy for considering a float value as integer */
+
+#endif
+
+
+#define DEF_MIP_GAP 1.0e-11 /* The default absolute and relative MIP gap */
+#define SCALEDINTFIXRANGE 1.6 /* Epsilon range multiplier < 2 for collapsing bounds to fix */
+
+#define MIN_SCALAR 1.0e-10 /* Smallest allowed scaling adjustment */
+#define MAX_SCALAR 1.0e+10 /* Largest allowed scaling adjustment */
+#define DEF_SCALINGEPS 1.0e-02 /* Relative scaling convergence criterion for auto_scale */
+
+#define DEF_LAGACCEPT 1.0e-03 /* Default Lagrangean convergence acceptance criterion */
+#define DEF_LAGCONTRACT 0.90 /* The contraction parameter for Lagrangean iterations */
+#define DEF_LAGMAXITERATIONS 100 /* The maximum number of Lagrangean iterations */
+
+#define DEF_PSEUDOCOSTUPDATES 7 /* The default number of times pseudo-costs are recalculated;
+ experiments indicate that costs tend to stabilize */
+#define DEF_PSEUDOCOSTRESTART 0.15 /* The fraction of price updates required for B&B restart
+ when the mode is NODE_RESTARTMODE */
+#define DEF_MAXPRESOLVELOOPS 0 /* Upper limit to the number of loops during presolve,
+ <= 0 for no limit. */
+
+
+/* Hashing prototypes and function headers */
+/* ------------------------------------------------------------------------- */
+#include "lp_Hash.h"
+
+
+/* Sparse matrix prototypes */
+/* ------------------------------------------------------------------------- */
+#include "lp_matrix.h"
+
+
+/* Basis storage (mainly for B&B) */
+typedef struct _basisrec
+{
+ int level;
+ int *var_basic;
+ MYBOOL *is_basic;
+ MYBOOL *is_lower;
+ int pivots;
+ struct _basisrec *previous;
+} basisrec;
+
+/* Presolve undo data storage */
+typedef struct _presolveundorec
+{
+ lprec *lp;
+ int orig_rows;
+ int orig_columns;
+ int orig_sum;
+ int *var_to_orig; /* sum_alloc+1 : Mapping of variables from solution to
+ best_solution to account for removed variables and
+ rows during presolve; a non-positive value indicates
+ that the constraint or variable was removed */
+ int *orig_to_var; /* sum_alloc+1 : Mapping from original variable index to
+ current / working index number */
+ REAL *fixed_rhs; /* rows_alloc+1 : Storage of values of presolved fixed colums */
+ REAL *fixed_obj; /* columns_alloc+1: Storage of values of presolved fixed rows */
+ DeltaVrec *deletedA; /* A matrix of eliminated data from matA */
+ DeltaVrec *primalundo; /* Affine translation vectors for eliminated primal variables */
+ DeltaVrec *dualundo; /* Affine translation vectors for eliminated dual variables */
+ MYBOOL OFcolsdeleted;
+} presolveundorec;
+
+/* Pseudo-cost arrays used during B&B */
+typedef struct _BBPSrec
+{
+ lprec *lp;
+ int pseodotype;
+ int updatelimit;
+ int updatesfinished;
+ REAL restartlimit;
+ MATitem *UPcost;
+ MATitem *LOcost;
+ struct _BBPSrec *secondary;
+} BBPSrec;
+
+#include "lp_mipbb.h"
+
+
+/* Partial pricing block data */
+typedef struct _partialrec {
+ lprec *lp;
+ int blockcount; /* ## The number of logical blocks or stages in the model */
+ int blocknow; /* The currently active block */
+ int *blockend; /* Array of column indeces giving the start of each block */
+ int *blockpos; /* Array of column indeces giving the start scan position */
+ MYBOOL isrow;
+} partialrec;
+
+
+/* Specially Ordered Sets (SOS) prototypes and settings */
+/* ------------------------------------------------------------------------- */
+/* SOS storage structure (LINEARSEARCH is typically in the 0-10 range) */
+#ifndef LINEARSEARCH
+#define LINEARSEARCH 0
+#endif
+
+#include "lp_SOS.h"
+
+
+/* Prototypes for user call-back functions */
+/* ------------------------------------------------------------------------- */
+typedef int (__WINAPI lphandle_intfunc)(lprec *lp, void *userhandle);
+typedef void (__WINAPI lphandlestr_func)(lprec *lp, void *userhandle, char *buf);
+typedef void (__WINAPI lphandleint_func)(lprec *lp, void *userhandle, int message);
+typedef int (__WINAPI lphandleint_intfunc)(lprec *lp, void *userhandle, int message);
+
+
+/* API typedef definitions */
+/* ------------------------------------------------------------------------- */
+typedef MYBOOL (__WINAPI add_column_func)(lprec *lp, REAL *column);
+typedef MYBOOL (__WINAPI add_columnex_func)(lprec *lp, int count, REAL *column, int *rowno);
+typedef MYBOOL (__WINAPI add_constraint_func)(lprec *lp, REAL *row, int constr_type, REAL rh);
+typedef MYBOOL (__WINAPI add_constraintex_func)(lprec *lp, int count, REAL *row, int *colno, int constr_type, REAL rh);
+typedef MYBOOL (__WINAPI add_lag_con_func)(lprec *lp, REAL *row, int con_type, REAL rhs);
+typedef int (__WINAPI add_SOS_func)(lprec *lp, char *name, int sostype, int priority, int count, int *sosvars, REAL *weights);
+typedef int (__WINAPI column_in_lp_func)(lprec *lp, REAL *column);
+typedef lprec * (__WINAPI copy_lp_func)(lprec *lp);
+typedef void (__WINAPI default_basis_func)(lprec *lp);
+typedef MYBOOL (__WINAPI del_column_func)(lprec *lp, int colnr);
+typedef MYBOOL (__WINAPI del_constraint_func)(lprec *lp, int rownr);
+typedef void (__WINAPI delete_lp_func)(lprec *lp);
+typedef MYBOOL (__WINAPI dualize_lp_func)(lprec *lp);
+typedef void (__WINAPI free_lp_func)(lprec **plp);
+typedef int (__WINAPI get_anti_degen_func)(lprec *lp);
+typedef MYBOOL (__WINAPI get_basis_func)(lprec *lp, int *bascolumn, MYBOOL nonbasic);
+typedef int (__WINAPI get_basiscrash_func)(lprec *lp);
+typedef int (__WINAPI get_bb_depthlimit_func)(lprec *lp);
+typedef int (__WINAPI get_bb_floorfirst_func)(lprec *lp);
+typedef int (__WINAPI get_bb_rule_func)(lprec *lp);
+typedef MYBOOL (__WINAPI get_bounds_tighter_func)(lprec *lp);
+typedef REAL (__WINAPI get_break_at_value_func)(lprec *lp);
+typedef char * (__WINAPI get_col_name_func)(lprec *lp, int colnr);
+typedef MYBOOL (__WINAPI get_column_func)(lprec *lp, int colnr, REAL *column);
+typedef int (__WINAPI get_columnex_func)(lprec *lp, int colnr, REAL *column, int *nzrow);
+typedef int (__WINAPI get_constr_type_func)(lprec *lp, int rownr);
+typedef REAL (__WINAPI get_constr_value_func)(lprec *lp, int rownr, int count, REAL *primsolution, int *nzindex);
+typedef MYBOOL (__WINAPI get_constraints_func)(lprec *lp, REAL *constr);
+typedef MYBOOL (__WINAPI get_dual_solution_func)(lprec *lp, REAL *rc);
+typedef REAL (__WINAPI get_epsb_func)(lprec *lp);
+typedef REAL (__WINAPI get_epsd_func)(lprec *lp);
+typedef REAL (__WINAPI get_epsel_func)(lprec *lp);
+typedef REAL (__WINAPI get_epsint_func)(lprec *lp);
+typedef REAL (__WINAPI get_epsperturb_func)(lprec *lp);
+typedef REAL (__WINAPI get_epspivot_func)(lprec *lp);
+typedef int (__WINAPI get_improve_func)(lprec *lp);
+typedef REAL (__WINAPI get_infinite_func)(lprec *lp);
+typedef MYBOOL (__WINAPI get_lambda_func)(lprec *lp, REAL *lambda);
+typedef REAL (__WINAPI get_lowbo_func)(lprec *lp, int colnr);
+typedef int (__WINAPI get_lp_index_func)(lprec *lp, int orig_index);
+typedef char * (__WINAPI get_lp_name_func)(lprec *lp);
+typedef int (__WINAPI get_Lrows_func)(lprec *lp);
+typedef REAL (__WINAPI get_mat_func)(lprec *lp, int rownr, int colnr);
+typedef REAL (__WINAPI get_mat_byindex_func)(lprec *lp, int matindex, MYBOOL isrow, MYBOOL adjustsign);
+typedef int (__WINAPI get_max_level_func)(lprec *lp);
+typedef int (__WINAPI get_maxpivot_func)(lprec *lp);
+typedef REAL (__WINAPI get_mip_gap_func)(lprec *lp, MYBOOL absolute);
+typedef int (__WINAPI get_multiprice_func)(lprec *lp, MYBOOL getabssize);
+typedef MYBOOL (__WINAPI is_use_names_func)(lprec *lp, MYBOOL isrow);
+typedef void (__WINAPI set_use_names_func)(lprec *lp, MYBOOL isrow, MYBOOL use_names);
+typedef int (__WINAPI get_nameindex_func)(lprec *lp, char *varname, MYBOOL isrow);
+typedef int (__WINAPI get_Ncolumns_func)(lprec *lp);
+typedef REAL (__WINAPI get_negrange_func)(lprec *lp);
+typedef int (__WINAPI get_nz_func)(lprec *lp);
+typedef int (__WINAPI get_Norig_columns_func)(lprec *lp);
+typedef int (__WINAPI get_Norig_rows_func)(lprec *lp);
+typedef int (__WINAPI get_Nrows_func)(lprec *lp);
+typedef REAL (__WINAPI get_obj_bound_func)(lprec *lp);
+typedef REAL (__WINAPI get_objective_func)(lprec *lp);
+typedef int (__WINAPI get_orig_index_func)(lprec *lp, int lp_index);
+typedef char * (__WINAPI get_origcol_name_func)(lprec *lp, int colnr);
+typedef char * (__WINAPI get_origrow_name_func)(lprec *lp, int rownr);
+typedef void (__WINAPI get_partialprice_func)(lprec *lp, int *blockcount, int *blockstart, MYBOOL isrow);
+typedef int (__WINAPI get_pivoting_func)(lprec *lp);
+typedef int (__WINAPI get_presolve_func)(lprec *lp);
+typedef int (__WINAPI get_presolveloops_func)(lprec *lp);
+typedef MYBOOL (__WINAPI get_primal_solution_func)(lprec *lp, REAL *pv);
+typedef int (__WINAPI get_print_sol_func)(lprec *lp);
+typedef MYBOOL (__WINAPI get_pseudocosts_func)(lprec *lp, REAL *clower, REAL *cupper, int *updatelimit);
+typedef MYBOOL (__WINAPI get_ptr_constraints_func)(lprec *lp, REAL **constr);
+typedef MYBOOL (__WINAPI get_ptr_dual_solution_func)(lprec *lp, REAL **rc);
+typedef MYBOOL (__WINAPI get_ptr_lambda_func)(lprec *lp, REAL **lambda);
+typedef MYBOOL (__WINAPI get_ptr_primal_solution_func)(lprec *lp, REAL **pv);
+typedef MYBOOL (__WINAPI get_ptr_sensitivity_obj_func)(lprec *lp, REAL **objfrom, REAL **objtill);
+typedef MYBOOL (__WINAPI get_ptr_sensitivity_objex_func)(lprec *lp, REAL **objfrom, REAL **objtill, REAL **objfromvalue, REAL **objtillvalue);
+typedef MYBOOL (__WINAPI get_ptr_sensitivity_rhs_func)(lprec *lp, REAL **duals, REAL **dualsfrom, REAL **dualstill);
+typedef MYBOOL (__WINAPI get_ptr_variables_func)(lprec *lp, REAL **var);
+typedef REAL (__WINAPI get_rh_func)(lprec *lp, int rownr);
+typedef REAL (__WINAPI get_rh_range_func)(lprec *lp, int rownr);
+typedef int (__WINAPI get_rowex_func)(lprec *lp, int rownr, REAL *row, int *colno);
+typedef MYBOOL (__WINAPI get_row_func)(lprec *lp, int rownr, REAL *row);
+typedef char * (__WINAPI get_row_name_func)(lprec *lp, int rownr);
+typedef REAL (__WINAPI get_scalelimit_func)(lprec *lp);
+typedef int (__WINAPI get_scaling_func)(lprec *lp);
+typedef MYBOOL (__WINAPI get_sensitivity_obj_func)(lprec *lp, REAL *objfrom, REAL *objtill);
+typedef MYBOOL (__WINAPI get_sensitivity_objex_func)(lprec *lp, REAL *objfrom, REAL *objtill, REAL *objfromvalue, REAL *objtillvalue);
+typedef MYBOOL (__WINAPI get_sensitivity_rhs_func)(lprec *lp, REAL *duals, REAL *dualsfrom, REAL *dualstill);
+typedef int (__WINAPI get_simplextype_func)(lprec *lp);
+typedef int (__WINAPI get_solutioncount_func)(lprec *lp);
+typedef int (__WINAPI get_solutionlimit_func)(lprec *lp);
+typedef int (__WINAPI get_status_func)(lprec *lp);
+typedef char * (__WINAPI get_statustext_func)(lprec *lp, int statuscode);
+typedef long (__WINAPI get_timeout_func)(lprec *lp);
+typedef COUNTER (__WINAPI get_total_iter_func)(lprec *lp);
+typedef COUNTER (__WINAPI get_total_nodes_func)(lprec *lp);
+typedef REAL (__WINAPI get_upbo_func)(lprec *lp, int colnr);
+typedef int (__WINAPI get_var_branch_func)(lprec *lp, int colnr);
+typedef REAL (__WINAPI get_var_dualresult_func)(lprec *lp, int index);
+typedef REAL (__WINAPI get_var_primalresult_func)(lprec *lp, int index);
+typedef int (__WINAPI get_var_priority_func)(lprec *lp, int colnr);
+typedef MYBOOL (__WINAPI get_variables_func)(lprec *lp, REAL *var);
+typedef int (__WINAPI get_verbose_func)(lprec *lp);
+typedef MYBOOL (__WINAPI guess_basis_func)(lprec *lp, REAL *guessvector, int *basisvector);
+typedef REAL (__WINAPI get_working_objective_func)(lprec *lp);
+typedef MYBOOL (__WINAPI has_BFP_func)(lprec *lp);
+typedef MYBOOL (__WINAPI has_XLI_func)(lprec *lp);
+typedef MYBOOL (__WINAPI is_add_rowmode_func)(lprec *lp);
+typedef MYBOOL (__WINAPI is_anti_degen_func)(lprec *lp, int testmask);
+typedef MYBOOL (__WINAPI is_binary_func)(lprec *lp, int colnr);
+typedef MYBOOL (__WINAPI is_break_at_first_func)(lprec *lp);
+typedef MYBOOL (__WINAPI is_constr_type_func)(lprec *lp, int rownr, int mask);
+typedef MYBOOL (__WINAPI is_debug_func)(lprec *lp);
+typedef MYBOOL (__WINAPI is_feasible_func)(lprec *lp, REAL *values, REAL threshold);
+typedef MYBOOL (__WINAPI is_unbounded_func)(lprec *lp, int colnr);
+typedef MYBOOL (__WINAPI is_infinite_func)(lprec *lp, REAL value);
+typedef MYBOOL (__WINAPI is_int_func)(lprec *lp, int column);
+typedef MYBO...
[truncated message content] |