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${CPLEX_INCLUDE_PATH}
CLNFLAGS = -L${CPLEX_LIB_PATH}/static_pic -lcplex -lm -lpthread

Set/replace the ${CPLEX_INCLUDE_PATH} and ${CPLEX_LIB_PATH} with the
corresponding paths to the 'include' and 'lib' directories of your
CPLEX installation on your system.

Given this information, there are several 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${CPLEX_INCLUDE_PATH} \
    PKG_LIBS='-L${CPLEX_INCLUDE_PATH}/static_pic \
    -lcplex -lm -lpthread'" Rcplex_0.3-0.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=${CPLEX_INCLUDE_PATH} \
    --with-cplex-cflags=-fPIC \
    --with-cplex-lib='-L${CPLEX_LIB_PATH}/static_pic \
    -lcplex -lm -lpthread'" Rcplex_0.3-0.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

  3) Give the location of your CPLEX installation:

    R CMD INSTALL --configure-args="--with-cplex-dir=${CPLEX_DIR}"\
    Rcplex_0.3-0.tar.gz 

    This method requires that ${CPLEX_DIR} 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.3-0.tar.gz

    This method looks for the CPLEX interactive optimizer, or,
    alternatively, gets this information from the CPLEX_BIN
    environment variable. Then it uses the directory two levels above
    as the CPLEX installation directory. Afterwards, it does the same
    thing as #3 above.



***WINDOWS***

Installation on 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.


***AIX***

Installation in AIX was successful using IBM's XL C compiler and the
following arguments to R CMD INSTALL:

R CMD INSTALL Rcplex_0.3-0 \
--configure-args="--with-cplex-include=<cplex_dir>/include \
--with-cplex-cflags=\"-q64\" \
--with-cplex-lib=\"-L<cplex_dir>/lib/power64_aix5.2_7.0/static_mt_stl \
-lcplex -lm -lpthread -q64\""

This was successfully tested with CPLEX 11.2 for AIX (6.1.0) on Power
systems (Power 6).
