Rcplex - R interface to the CPLEX optimization library

Installation of the Rcplex package requires the following information:
	1) the CPLEX include directory
	2) flags to give to the C compiler when compiling the interface
	3) the directory where the CPLEX callable library is located and other libraries CPLEX requires for proper linking

As in regular usage of CPLEX, the environment variable ILOG_LICENSE_FILE must be set to the location of a file with a valid ILOG license key.


***LINUX INSTALLATION***
For Linux, pointers on where to find this information can be found in <cplex_dir>/readme.html where <cplex_dir> is your cplex
installation directory.
The easiest way is to look at variables CFLAGS and CLNFLAGS in
<cplex_path>/examples/<system>/<libformat>/Makefile. For example, that
Makefile might have

CFLAGS = -fPIC -I/usr/local/cplex90/include
CLNFLAGS = -L/usr/local/cplex90/lib/i86_linux2_glibc2.3_gcc3.2/static_pic -lcplex -lm -lpthread

Given this information, there are two ways of installing the Rcplex package:

  1) Set the PKG_CFLAGS, PKG_CPPFLAGS and PKG_LIBS used by R's installation procedure directly:

    R CMD INSTALL --configure-args="PKG_CFLAGS=-fPIC PKG_CPPFLAGS=-I/usr/local/cplex90/include PKG_LIBS='-L/usr/local/cplex90/i86_linux2_glibc2.3_gcc3.2/lib/static_pic -lcplex -lm -lpthread'" Rcplex_0.1-1.tar.gz 

    If either PKG_CPPFLAGS or PKG_LIBS is given then both must be given, otherwise configure with stop with an error

  2) Use --with-cplex-<ARG> to pass this information along:

    R CMD INSTALL --configure-args="--with-cplex-include=/usr/local/cplex90/include --with-cplex-cflags=-fPIC --with-cplex-lib='-L/usr/local/cplex90/i86_linux2_glibc2.3_gcc3.2/lib/static_pic -lcplex -lm -lpthread'" Rcplex_0.1-3.tar.gz

	If either --with-cplex-include or --with-cplex-lib is given, then both must be given, otherwise configure will stop with an error

There are two other ways of installing, but these are NOT RECOMMENDED 

  3) Give the location of your CPLEX installation:

    R CMD INSTALL --configure-args="--with-cplex-dir=/usr/local/cplex90" Rcplex_0.1-1.tar.gz
L
    This method requires that cplex90 looks exactly as installed by CPLEX. It will take the first system type and library format it finds and fills the information above from the Makefile it should find in <cplex_path>/examples/<system>/<libformat>/. Info is pulled from the Makefile using awk, so it must be present for installation to work.

  4) Don't give any information at all:

    R CMD INSTALL Rcplex_0.1-1.tar.gz

    This method looks for the CPLEX interactive optimizer and uses the directory two levels above as the CPLEX installation directory. It then does the same thing as #3 above.





***WINDOWS***
Installation in Windows systems is done by using the provided Makevars.win file in the src directory. It contains the following lines:

PKG_CPPFLAGS=-I<cplex_dir>/include
PKG_LIBS=-L<cplex_dir>/lib/x86_windows_vs2008/stat_mda -lcplex111 -lm

where <cplex_dir> is the cplex installation directory e.g. /c/ilog/cplex111. Please edit your Makevars.win file accordingly.

We have successfully tested this procedure with CPLEX 11.1 on 32-bit Windows XP.

