/
INSTALL
120 lines (79 loc) · 4.44 KB
/
INSTALL
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
GNU R package cplexAPI: R Interface to C API of IBM ILOG CPLEX
The installation procedure for the cplexAPI package needs to know where to
find the CPLEX include directory and where to find the callable library.
# ---------------------------------------------------------------------------- #
# Linux and MacOS X installation
# ---------------------------------------------------------------------------- #
The locations of the CPLEX callable library and the CPLEX include directory
can be found in <cplex_dir>/README.html>, where <cplex_dir> is the CPLEX
installation directory. Also have a look at the variables CLNFLAGS and COPT
in the example Makefile of your CPLEX installation. There, the variable
CPLEXLIBDIR points to the callable library directory.
There are several ways of installing the cplexAPI package:
1) Set variables PKG_CFLAGS, PKG_CPPFLAGS and PKG_LIBS directly, e.g.:
R CMD INSTALL --configure-args =" \
PKG_CFLAGS='-m64 -fPIC' \
PKG_CPPFLAGS='-I<cplex_dir>/cplex/include' \
PKG_LIBS='-L${CPLEXLIBDIR} -lcplex -m64 -lm -pthread'" \
cplexAPI_x.x.x.tar.gz
PKF_CFLAGS is optional, but both PKG_CPPFLAGS and PKG_LIBS must be given.
2) Use --with-cplex-<ARG>:
--with-cplex-include=PATH with PATH being the include directory of CPLEX
--with-cplex-lib=PATH with PATH being the directory containing the
callable library of CPLEX.
R CMD INSTALL --configure-args=" \
--with-cplex-include=/path/to/include/dir \
--with-cplex-lib=/path/to/lib/dir" cplexAPI_x.x.x.tar.gz
When using --with-cplex-<ARG>, both arguments --with-cplex-lib and
--with-cplex-include must be given.
--with-cplex-link=-l... libraries to path to the linker during
compilation.
If --with-cplex-link is not given, '-lcplex -lm -pthread' will be used
as default.
--with-cplex-cflags=... optional CFLAGS
A further argument can be used in order to use the debuging routines included
in the C API of CPLEX:
--with-cplex-check=PATH with PATH being the directory containing the
file check.c from the CPLEX examples directory.
R CMD INSTALL --configure-args=" \
--with-cplex-lib='/path/to/lib/dir' \
--with-cplex-include='/path/to/include/dir' \
--with-cplex-link='-lcplex -m64 -lm -pthread' \
--with-cplex-cflags='-m64 -fPIC' \
--with-cplex-check='/path/to/examples/dir/examples/src/c'" \
cplexAPI_x.x.x.tar.gz
3) Give the location of the CPLEX installation:
--with-cplex-dir=PATH
with PATH being the CPLEX directory.
R CMD INSTALL --configure-args="
--with-cplex-dir='<cplex_dir>/cplex'" \
cplexAPI_x.x.x.tar.gz
This procedure will take the first system type and library format it finds.
Information reqired for the compilation is taken from the example Makefile.
4) Give no information:
R CMD INSTALL cplexAPI_x.x.x.tar.gz
This procedure will try to find the CPLEX interactive optimizer, or the
CPLEX_BIN environment variable pointing to the CPLEX interactive optimizer
will be used. The directory two levels above is used as CPLEX directory, all
other information is taken from the CPLEX example Makefile as in #3 above.
In case, the directory could not be determined on Mac OS, the default
installation directory will be used.
# ---------------------------------------------------------------------------- #
# Windows installation
# ---------------------------------------------------------------------------- #
For the installation on Windows systems the file Makewars.win in src/ is
required. The file looks like this:
PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"${CPLEX_STUDIO_DIR221}\cplex\include" -DBUILDCPXSTATIC
PKG_LIBS=-L"${CPLEX_STUDIO_DIR221}\cplex\bin\x64_win64" -lm -lcplex2210
with the environment variable CPLEX_STUDIO_DIR221 being the installation directory
of CPLEX (for example C:/PROGRA~1/IBM/ILOG/CPLEX_Studio221).
This procedure was tested successfully with IBM ILOG CPLEX 22.1.0
on 64-bit Windows 10 using Rtools 4.2.
# ---------------------------------------------------------------------------- #
See also: http://www.stats.ox.ac.uk/~ripley/Win64/W64porting.html
If you want to have both 32- and 64 bit DLLs of libcplex in your PATH,
a good way is to set PATH in
R_HOME/etc/i386/Renviron.site for 32-bit and in
R_HOME/etc/x64/Renviron.site for 64-bit.
Also the variables CPLEX_STUDIO_DIR, CPLEX_STUDIO_LIB32 and
CPLEX_STUDIO_LIB64 can be set here.