GLPKMEX INSTALLATION INSTRUCTIONS
**********************************

GLPKMEX is a Matlab MEX Interface for the GLPK library developed by 
Andrew Makhorin. GLPKMEX is developed by Nicolo' Giorgetti, email 
giorgetti __ at __ ieee.org.  
GLPK is currently being mantained by Niels Klitgord, email
niels __ at __ bu.edu. 

To install mps2mat.py script, please see INSTALL_mps2mat file.

--> Standard installation procedure (suitable for most 32-bit linux/windows users):

1) Download and install GLPK version 4.40 or higher:
       http://ftp.gnu.org/gnu/glpk/ 

2) Start Matlab and run makeglpkmex.m. Specify correct path to both GLPK 
   directory and eventually to the GLPK include and library directories.

3) Test the interface on the examples included (glpktest1.m, glpktest2.m, 
   glpksparse.m). Everything should works fine.

--> Specific installation procedure for those who use CYGWIN under Win*

Niels's Install Notes 

(Linux 64bit machine)

1) a)  if you plan on compling glpk with gmp, recomplie gmp with 'CFLAGS+=-fPIC'
   b)  recomplied glpk-4.36 (or newer) with 'CFLAGS+=-fPIC'
    This is do deal with a weird issue with ld in 64bit format

2) Directly compiled glpkmex with:
(default):
mex -I<path to>/include glpkcc.cpp <path to>/libglpk.a

(with gmp compiled into glpk and large arrays (64bit stuff...)):
mex -largeArrayDims -I<path to>/include glpkcc.cpp <path to>/libglpk.a <path to>/libgmp.a

**note -largArrayDims is optional, but allows matlab to use large arrays with glpk on 64bit machines**

## this particular pipeline has worked for me on a number of different 64bit linux boxes:
1) in the linux comandline cd to glpk dir (4.36 or above)
2) run:
make clean
./configure
make CFLAGS+=-fPIC
make check
make  prefix=/usr/local install

###note: update the dir install dir if you want, but be sure to do the same below ###

3) cd glpkmex dir
4) run from the comand line:
mex -largeArrayDims -I/usr/local/include glpkcc.cpp /usr/local/lib/libglpk.a

5) start matlab, add glpkmex dir to path and run glpktest1 and glpktest2 in matlab environment.  if these work you should be good to go.


Installing on a PC
1) if you used winglpk, you still need to compile the glpk.lib file. 
   to do this go to w32 or w64 folder in winglpk and run 'Build_GLPK_with_VC9.bat'.
   see the readme.txt file in w32 or w64 for more details on how to do this.
2) note windows uses .lib, not .a files so change libglpk.a to glpk.lib (simular for gmp if used)
3) full paths to directions (like include) often need to be in quotes.
   ex: mex -I'C:\\some path\include' glpkcc.cpp 'C:\\some other path\glpk.lib'

Special notes for installing on a Mac,( worked for Leapard )
add GLPK lib install directory to your DYLD_LIBRARY_PATH shell variable (before you start matlab)
example: 'export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH' in .bashrc
continue as above for linux install.


Installing with cygwin (alternate method on a pc):
Requirements:
A) The last version of cygwin, downloadable from http://www.cygwin.com
   (or download mingw)
B) Gnumex: http://gnumex.sourceforge.net/

1) Download GLPK and install it by specifying CFLAGS="-O3 -mno-cygwin" as 
   argument of make, i.e.: 
      a) ./configure;
      b) make CFLAGS="-O3 -mno-cygwin"
      c) make install
   This avoid to build a glpk library which needs of cygwin1.dll to run.  
   
2) Start Matlab and run gnumex. Make a mexopts.bat with option 'cygwin-mingw' if 
   you are using cygwin or 'mingw' if you are using mingw.

3) run makeglpkmex.m. Specify correct path to GLPK directory and eventually to 
   the GLPK include and library directories. Moreover, you have to specify the 
   location of mexopts.bat file generated at step 2).

4) Test the interface on the examples included (glpktest1.m, glpktest2.m, 
   glpksparse.m). Everything should works fine.
  

