From fe0b3bc853abe3ab39219652166b51bca70349c2 Mon Sep 17 00:00:00 2001 From: Mayo Roettger <mayo.roettger@uni-duesseldorf.de> Date: Thu, 17 Sep 2020 15:55:15 +0200 Subject: [PATCH] Version 4.1.0; Removed function; Adaptation of configure scripts and Makevars.win; added calls to CPLEX initializers and finalizers; Correction in INSTALL file --- DESCRIPTION | 8 ++--- NAMESPACE | 1 - R/cplex.R | 2 +- R/cplexAPI.R | 22 +----------- R/cplexConst.R | 2 +- R/cplexErrorClass.R | 2 +- R/cplexPtrClass.R | 2 +- R/cplex_checkAPI.R | 2 +- R/cplex_longparamAPI.R | 2 +- R/generics.R | 2 +- R/zzz.R | 11 +++++- configure | 37 +++++++++++-------- configure.ac | 28 +++++++++++---- inst/INSTALL | 16 +++++---- inst/NEWS.Rd | 18 ++++++++++ inst/c2r.map | 1 - man/copyPartBaseCPLEX.Rd | 76 ---------------------------------------- src/Makevars.win | 2 +- src/cplexAPI.c | 43 +++++++---------------- src/cplexAPI.h | 10 +++--- src/cplexR.c | 2 +- src/cplexR.h | 2 +- src/cplex_checkAPI.c | 2 +- src/cplex_checkAPI.h | 2 +- src/cplex_longparamAPI.c | 2 +- src/cplex_longparamAPI.h | 2 +- src/init.c | 10 ++---- 27 files changed, 117 insertions(+), 192 deletions(-) delete mode 100644 man/copyPartBaseCPLEX.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 30c1c98..b963920 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: cplexAPI Type: Package Title: R Interface to C API of IBM ILOG CPLEX -Version: 1.3.6 -Date: 2019-06-21 +Version: 1.4.0 +Date: 2020-09-17 Authors@R: c(person("Mayo", "Roettger", role = "cre", email = "mayo.roettger@hhu.de"), person("Gabriel", "Gelius-Dietrich", role = "aut", email = "geliudie@uni-duesseldorf.de"), person(c("C.", "Jonathan"), "Fritzemeier", role = c("ctb"), email = "clausjonathan.fritzemeier@uni-duesseldorf.de")) @@ -14,7 +14,7 @@ License: GPL-3 | file LICENSE LazyLoad: yes Collate: generics.R cplexConst.R cplexErrorClass.R cplexPtrClass.R cplex.R cplexAPI.R cplex_checkAPI.R cplex_longparamAPI.R zzz.R -Packaged: 2019-06-21 11:35:00 UTC; mayo +Packaged: 2020-09-17 12:58:00 UTC; mayo NeedsCompilation: yes Repository: CRAN -Date/Publication: 2019-06-21 11:35:00 +Date/Publication: 2020-09-17 14:58:00 diff --git a/NAMESPACE b/NAMESPACE index 4b1244e..3e10e89 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -63,7 +63,6 @@ copyLpCPLEX, copyLpwNamesCPLEX, copyObjNameCPLEX, copyOrderCPLEX, -copyPartBaseCPLEX, copyQPsepCPLEX, copyQuadCPLEX, copyStartCPLEX, diff --git a/R/cplex.R b/R/cplex.R index 95d5bea..a310f5a 100644 --- a/R/cplex.R +++ b/R/cplex.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # cplex.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/R/cplexAPI.R b/R/cplexAPI.R index c60856b..0bb5274 100644 --- a/R/cplexAPI.R +++ b/R/cplexAPI.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # cplexAPI.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. @@ -1674,26 +1674,6 @@ copyBaseCPLEX <- function(env, lp, cstat, rstat) { } -#------------------------------------------------------------------------------# - -copyPartBaseCPLEX <- function(env, lp, ncind, cind, cstat, - nrind, rind, rstat) { - - status <- .Call("copyPartBase", PACKAGE = "cplexAPI", - cplexPointer(env), - cplexPointer(lp), - as.integer(ncind), - as.integer(cind), - as.integer(cstat), - as.integer(nrind), - as.integer(rind), - as.integer(rstat) - ) - - return(status) -} - - #------------------------------------------------------------------------------# getBaseCPLEX <- function(env, lp) { diff --git a/R/cplexConst.R b/R/cplexConst.R index 8110c91..51d42ac 100644 --- a/R/cplexConst.R +++ b/R/cplexConst.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # cplexConst.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/R/cplexErrorClass.R b/R/cplexErrorClass.R index 5825a97..437c9f9 100644 --- a/R/cplexErrorClass.R +++ b/R/cplexErrorClass.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # cpxerrClass.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/R/cplexPtrClass.R b/R/cplexPtrClass.R index 8fc3cdf..c619419 100644 --- a/R/cplexPtrClass.R +++ b/R/cplexPtrClass.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # cplex_ptrClass.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/R/cplex_checkAPI.R b/R/cplex_checkAPI.R index 919e189..e355d4f 100644 --- a/R/cplex_checkAPI.R +++ b/R/cplex_checkAPI.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # cplex_checkAPI.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/R/cplex_longparamAPI.R b/R/cplex_longparamAPI.R index 0bfbaf0..e62f66e 100644 --- a/R/cplex_longparamAPI.R +++ b/R/cplex_longparamAPI.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # cplex_longparamAPI.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/R/generics.R b/R/generics.R index f20834a..c0a3887 100644 --- a/R/generics.R +++ b/R/generics.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # generics.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/R/zzz.R b/R/zzz.R index 00559f5..da50130 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -3,7 +3,7 @@ #------------------------------------------------------------------------------# # zzz.R -# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. +# R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. # # Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, # Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. @@ -28,8 +28,17 @@ .packageName <- "cplexAPI" +# Finalize function for cplexAPI: +finalize <- function(env) { + .Call("finalizeCPLEX", PACKAGE = "cplexAPI") +} + .onLoad <- function(libname, pkgname) { .Call("initCPLEX", PACKAGE = "cplexAPI") + + # set finalizer for namespace:cplexAPI environment: + parent <- parent.env(environment()) + reg.finalizer(parent, finalize, onexit = TRUE) } #.onAttach <- function(libname, pkgname) { diff --git a/configure b/configure index 5672c3d..d127ebe 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for cplexAPI 1.3.6. +# Generated by GNU Autoconf 2.69 for cplexAPI 1.4.0. # # Report bugs to <mayo.roettger@hhu.de>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cplexAPI' PACKAGE_TARNAME='cplexapi' -PACKAGE_VERSION='1.3.6' -PACKAGE_STRING='cplexAPI 1.3.6' +PACKAGE_VERSION='1.4.0' +PACKAGE_STRING='cplexAPI 1.4.0' PACKAGE_BUGREPORT='mayo.roettger@hhu.de' PACKAGE_URL='' @@ -1246,7 +1246,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cplexAPI 1.3.6 to adapt to many kinds of systems. +\`configure' configures cplexAPI 1.4.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1308,7 +1308,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cplexAPI 1.3.6:";; + short | recursive ) echo "Configuration of cplexAPI 1.4.0:";; esac cat <<\_ACEOF @@ -1399,7 +1399,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cplexAPI configure 1.3.6 +cplexAPI configure 1.4.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1701,7 +1701,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cplexAPI $as_me 1.3.6, which was +It was created by cplexAPI $as_me 1.4.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2062,7 +2062,7 @@ if test -z "${R_HOME}"; then fi CC=`"${R_HOME}/bin/R" CMD config CC` -CPP=`"${R_HOME}/bin/R" CMD config CPP` +#CPP=`"${R_HOME}/bin/R" CMD config CPP` CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS` CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS` ac_ext=c @@ -3153,7 +3153,8 @@ $as_echo "no" >&6; } fi - + { $as_echo "$as_me:${as_lineno-$LINENO}: NOTICE $CPLEX_BIN ermittelt" >&5 +$as_echo "$as_me: NOTICE $CPLEX_BIN ermittelt" >&6;} if test "$CPLEX_BIN" = "NONE" ; then as_fn_error $? "CPLEX interactive optimizer not found" "$LINENO" 5 else @@ -3180,7 +3181,7 @@ $as_echo X"$CPLEX_BIN" | q } s/.*/./; q'` - MACHINE=`expr //$CPLEX_DIR : '.*/\(.*\)'` + MACHINE=`expr //$CPLEX_DIR : '.*/\(.*\)'` CPLEX_DIR=`$as_dirname -- "$CPLEX_DIR" || $as_expr X"$CPLEX_DIR" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$CPLEX_DIR" : 'X\(//\)[^/]' \| \ @@ -3282,11 +3283,15 @@ done if test ! -d "$CPLEX_DIR/include" ; then - as_fn_error $? "CPLEX install directory not found: $CPLEX_DIR/include does not exist" "$LINENO" 5 + if test -d "$CPLEX_DIR/cplex/include" ; then + CPLEX_DIR="$CPLEX_DIR/cplex" + else + as_fn_error $? "CPLEX install directory not found: $CPLEX_DIR/include does not exist" "$LINENO" 5 + fi fi if test -z "$MACHINE" ; then - MACHINE=`ls -l ${CPLEX_DIR}/lib | ${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1` + MACHINE=`ls -l ${CPLEX_DIR}/lib | ${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1` if test -z "$MACHINE" -o ! -d "$CPLEX_DIR/lib/${MACHINE}" ; then as_fn_error $? "could not determine platform type" "$LINENO" 5 fi @@ -3314,6 +3319,8 @@ $as_echo "$as_me: path to example Makefile is $CPLEX_MAKEFILE" >&6;} if test "${MAKEFILEVERSION}" = "-lcplex" ; then CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=3;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`" + elif test "${MAKEFILEVERSION}" = '-l$(CPLEXLIB)' ; then + CPLEX_LIBS="-L${CPLEXLIBDIR} -lcplex `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`" else CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`" fi @@ -3349,7 +3356,7 @@ fi if test -n "${CPLEX_CHECK_PATH}" -a "${NO_CHECK}" = "FALSE" ; then - if test -e "${CPLEX_CHECK_PATH}/check.c" -a -r "${CPLEX_CHECK_PATH}/check.c" ; then + if test -r "${CPLEX_CHECK_PATH}/check.c" ; then cp ${CPLEX_CHECK_PATH}/check.c src/ if test -r "src/check.c" ; then echo "#define printf Rprintf" | cat - src/check.c > src/tmp.c @@ -4227,7 +4234,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cplexAPI $as_me 1.3.6, which was +This file was extended by cplexAPI $as_me 1.4.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4289,7 +4296,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cplexAPI config.status 1.3.6 +cplexAPI config.status 1.4.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 397fdc8..bc2aeb3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([cplexAPI], [1.3.6], [mayo.roettger@hhu.de]) +AC_INIT([cplexAPI], [1.4.0], [mayo.roettger@hhu.de]) ## adopted from configure.ac in Rcplex_0.3-0 @@ -23,7 +23,7 @@ fi dnl # GNU R default settings CC=`"${R_HOME}/bin/R" CMD config CC` -CPP=`"${R_HOME}/bin/R" CMD config CPP` +#CPP=`"${R_HOME}/bin/R" CMD config CPP` CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS` CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS` AC_PROG_CC @@ -152,11 +152,12 @@ dnl # install directory (guess) if test [ "$ARGS_OK" = "FALSE" -a -z "$CPLEX_DIR" ] ; then AC_PATH_PROG(CPLEX_BIN, cplex, "NONE") - + AC_MSG_NOTICE([NOTICE $CPLEX_BIN ermittelt]) if test [ "$CPLEX_BIN" = "NONE" ] ; then AC_MSG_ERROR([CPLEX interactive optimizer not found]) else CPLEX_DIR=`AS_DIRNAME(["$CPLEX_BIN"])` + dnl # get name of last folder in the path. This is the MACHINE. MACHINE=`expr //$CPLEX_DIR : '.*/\(.*\)'` CPLEX_DIR=`AS_DIRNAME(["$CPLEX_DIR"])` if test [ -z "$MACHINE" -o ! -d "${CPLEX_DIR}/${MACHINE}" ] ; then @@ -171,14 +172,21 @@ fi dnl # install directory (--with-cplex-dir) if test [ "$ARGS_OK" = "FALSE" ] ; then -dnl check for awk +dnl # check for awk AC_PROG_AWK if test [ ! -d "$CPLEX_DIR/include" ] ; then - AC_MSG_ERROR([CPLEX install directory not found: $CPLEX_DIR/include does not exist]) + if test [ -d "$CPLEX_DIR/cplex/include" ] ; then + dnl # if user set only the name of the installation directory + dnl # and not the cplex directory inside it + CPLEX_DIR="$CPLEX_DIR/cplex" + else + AC_MSG_ERROR([CPLEX install directory not found: $CPLEX_DIR/include does not exist]) + fi fi if test [ -z "$MACHINE" ] ; then + dnl # extract first directory name within cplex lib directory: MACHINE=`ls -l ${CPLEX_DIR}/lib | ${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1` if test [ -z "$MACHINE" -o ! -d "$CPLEX_DIR/lib/${MACHINE}" ] ; then AC_MSG_ERROR([could not determine platform type]) @@ -204,6 +212,9 @@ dnl check for awk if test [ "${MAKEFILEVERSION}" = "-lcplex" ] ; then CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=3;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`" + elif test "${MAKEFILEVERSION}" = '-l$(CPLEXLIB)' ; then + dnl # adaptation to newer versions of CPLEX + CPLEX_LIBS="-L${CPLEXLIBDIR} -lcplex `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`" else CPLEX_LIBS="-L${CPLEXLIBDIR} `${AWK} 'BEGIN {ORS = " "} /^CLNFLAGS/ { for (i=4;i<=NF;++i) print $i }' ${CPLEX_MAKEFILE}`" fi @@ -239,7 +250,8 @@ fi dnl # debugging routines if test [ -n "${CPLEX_CHECK_PATH}" -a "${NO_CHECK}" = "FALSE" ] ; then - if test [ -e "${CPLEX_CHECK_PATH}/check.c" -a -r "${CPLEX_CHECK_PATH}/check.c" ] ; then + dnl # removed because redundant check -e: if test [ -e "${CPLEX_CHECK_PATH}/check.c" -a -r "${CPLEX_CHECK_PATH}/check.c" ] ; then + if test [ -r "${CPLEX_CHECK_PATH}/check.c" ] ; then cp ${CPLEX_CHECK_PATH}/check.c src/ if test [ -r "src/check.c" ] ; then echo "#define printf Rprintf" | cat - src/check.c > src/tmp.c @@ -288,6 +300,8 @@ dnl # -------------------------------------------------------------------- AC_SUBST(PKG_CFLAGS) AC_SUBST(PKG_LIBS) AC_SUBST(PKG_CPPFLAGS) -AC_OUTPUT(src/Makevars) +AC_CONFIG_FILES(src/Makevars) +AC_OUTPUT +dnl # removed deprecated: AC_OUTPUT(src/Makevars) exit 0 diff --git a/inst/INSTALL b/inst/INSTALL index 8d8b228..edbc2b6 100644 --- a/inst/INSTALL +++ b/inst/INSTALL @@ -69,9 +69,7 @@ There are several ways of installing the cplexAPI package: --with-cplex-dir=PATH - with PATH being the CPLEX directory. This is not the CPLEX installation - directory <cplex_dir>, it is the directory including the lib/ include/ and - examples/ directory. Usually this is <cplex_dir>/cplex. + with PATH being the CPLEX directory. R CMD INSTALL --configure-args=" --with-cplex-dir='<cplex_dir>/cplex'" \ @@ -88,7 +86,7 @@ There are several ways of installing the cplexAPI package: 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 teh CPLEX example Makefile as in #3 above. + other information is taken from the CPLEX example Makefile as in #3 above. # ---------------------------------------------------------------------------- # @@ -99,10 +97,14 @@ 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_DIR}\cplex\include" -PKG_LIBS=-L"${CPLEX_STUDIO_LIB32}" -L"${CPLEX_STUDIO_LIB64}" -lm -lcplex124 +PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex12100 -with the environment variable CPLEX_PATH being the installation directory -of CPLEX. This procedure was tested successfully on 32-bit Windows XP. +with the environment variable CPLEX_STUDIO_DIR being the installation directory +of CPLEX and CPLEX_STUDIO_LIB being the library directory of CPLEX (for example +C:/PROGRA~1/IBM/ILOG/CPLEX_Studio128/cplex/bin/x64_win64). + +This procedure was tested successfully with IBM ILOG CPLEX 12.10 +on 64-bit Windows 10 using Rtools 3.5. # ---------------------------------------------------------------------------- # diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 4b769ce..e12d914 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,6 +3,24 @@ \name{NEWS} \title{cplexAPI News} \encoding{UTF-8} +% ---------------------------------------------------------------------------- % +\section{Changes in version 1.4.0 2020-09-17}{ + \itemize{ + \item Removed function \code{copyPartBaseCPLEX}, because corresponding CPLEX function \code{CPXcopypartialbase} was removed in CPLEX + Version >= 12.10.0. + \item Adaptation of configure script to extract correct linker options from example Makefile in CPLEX versions >= 10.9.0, + if neither environment variables PKG_CPPFLAGS and PKG_LIBS, nor configure arguments --with-cplex-include and --with-cplex-lib are given, + and option --with-cplex-dir was given or the respective directory could be extracted from the path variable. + \item Adaptation of configure script to allow more flexibitlity in specifying the CPLEX installation directory with option --with-cplex-dir. + \item Adaptation of Makevars.win to work with CPLEX version 12.10.0. + \item According to a comment from Daniel Junglas, CPLEX functions \code{CPXinitialize} and \code{CPXfinalize} should be called when the + shared library is loaded and unloaded to prevent subtle bugs. \code{CPXinitialize} is now called within cplexAPI's \code{.onload()} hook. + CPXfinalize() is called via a finalizer of the namespace:cplexAPI environment. + \item Small correction in INSTALL file to give the correct information for Windows installation. + } +} + + % ---------------------------------------------------------------------------- % \section{Changes in version 1.3.6 2019-06-21}{ \itemize{ diff --git a/inst/c2r.map b/inst/c2r.map index 56b4c0c..3738e91 100644 --- a/inst/c2r.map +++ b/inst/c2r.map @@ -55,7 +55,6 @@ CPXcopylp <- cplexAPI::copyLpCPLEX CPXcopylpwnames <- cplexAPI::copyLpwNamesCPLEX CPXcopyobjname <- cplexAPI::copyObjNameCPLEX CPXcopyorder <- cplexAPI::copyOrderCPLEX -CPXcopypartialbase <- cplexAPI::copyPartBaseCPLEX CPXcopyqpsep <- cplexAPI::copyQPsepCPLEX CPXcopyquad <- cplexAPI::copyQuadCPLEX CPXcopystart <- cplexAPI::copyStartCPLEX diff --git a/man/copyPartBaseCPLEX.Rd b/man/copyPartBaseCPLEX.Rd deleted file mode 100644 index 552849b..0000000 --- a/man/copyPartBaseCPLEX.Rd +++ /dev/null @@ -1,76 +0,0 @@ -\name{copyPartBaseCPLEX} -\alias{copyPartBaseCPLEX} -\alias{CPXcopypartialbase} - -\title{ - Copies a partial basis into an LP problem object. -} - -\description{ - Low level interface function to the IBM ILOG CPLEX function - \code{CPXcopypartialbase}. Consult the IBM ILOG CPLEX documentation for more - detailed information. -} -\usage{ - copyPartBaseCPLEX(env, lp, ncind, cind, cstat, nrind, rind, rstat) -} - -\arguments{ - \item{env}{ - An object of class \code{"\linkS4class{cplexPtr}"} as returned by - \code{\link{openEnvCPLEX}}. This is basically a pointer to an - IBM ILOG CPLEX environment. - } - \item{lp}{ - An object of class \code{"\linkS4class{cplexPtr}"} as returned by - \code{\link{initProbCPLEX}}. This is basically a pointer to an - IBM ILOG CPLEX problem object. - } - \item{ncind}{ - An integer that specifies the number of variable or column status values - specified. - } - \item{cind}{ - A vector that contains the indices of the variables for which status values - are being specified. - } - \item{cstat}{ - A vector where the ith entry contains the status for variable - \code{cind[i]}. - } - \item{nrind}{ - An integer that specifies the number of slack, surplus, or artificial status - values specified. - } - \item{rind}{ - A vector rcnt that contains the indices of the slack, surplus, or artificial - variables for which status values are being specified. - } - \item{rstat}{ - A vector of where the \code{i}-th entry contains the status for slack, - surplus, or artificial \code{rind[i]}. - } -} - -\details{ - Interface to the C function \code{copyPartBase} which calls the CPLEX - function \code{CPXcopypartialbase}. -} - -\value{ - Zero if successful, otherwise nonzero. -} - -\references{ - The IBM ILOG CPLEX home page at - \url{https://www.ibm.com/support/knowledgecenter/SSSA5P}. -} - -\author{ - Gabriel Gelius-Dietrich <geliudie@uni-duesseldorf.de> - - Maintainer: Mayo Roettger <mayo.roettger@hhu.de> -} - - -\keyword{ optimize } diff --git a/src/Makevars.win b/src/Makevars.win index cd71763..2eea606 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,2 +1,2 @@ PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"${CPLEX_STUDIO_DIR}\cplex\include" -PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex1261 +PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex12100 diff --git a/src/cplexAPI.c b/src/cplexAPI.c index 283d8cd..1518aed 100644 --- a/src/cplexAPI.c +++ b/src/cplexAPI.c @@ -1,5 +1,5 @@ /* cplexAPI.c - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. @@ -230,6 +230,17 @@ SEXP initCPLEX(void) { tagCPLEXfile = Rf_install("TYPE_CPLEX_FILE"); tagCPLEXchannel = Rf_install("TYPE_CPLEX_CHANNEL"); tagCPLEXtermination = Rf_install("TYPE_CPLEX_TERMINATION"); + + CPXinitialize(); + + return R_NilValue; +} + + +/* -------------------------------------------------------------------------- */ +/* call CPLEX finalizer */ +SEXP finalizeCPLEX(void) { + CPXfinalize(); return R_NilValue; } @@ -3312,36 +3323,6 @@ SEXP copyBase(SEXP env, SEXP lp, SEXP cstat, SEXP rstat) { } -/* -------------------------------------------------------------------------- */ -/* copy a partial basis into an LP problem object */ -SEXP copyPartBase(SEXP env, SEXP lp, - SEXP ncind, SEXP cind, SEXP cstat, - SEXP nrind, SEXP rind, SEXP rstat) { - - SEXP out = R_NilValue; - - int *rcind = INTEGER(cind); - int *rrind = INTEGER(rind); - int *rcstat = INTEGER(cstat); - int *rrstat = INTEGER(rstat); - - checkEnv(env); - checkProb(lp); - - status = CPXcopypartialbase(R_ExternalPtrAddr(env), R_ExternalPtrAddr(lp), - Rf_asInteger(ncind), rcind, rcstat, - Rf_asInteger(nrind), rrind, rrstat - ); - if (status != 0) { - status_message(R_ExternalPtrAddr(env), status); - } - - out = Rf_ScalarInteger(status); - - return out; -} - - /* -------------------------------------------------------------------------- */ /* access the basis resident in a problem object */ SEXP getBase(SEXP env, SEXP lp) { diff --git a/src/cplexAPI.h b/src/cplexAPI.h index da26843..9336d18 100644 --- a/src/cplexAPI.h +++ b/src/cplexAPI.h @@ -1,5 +1,5 @@ /* cplexAPI.h - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. @@ -71,6 +71,9 @@ SEXP getStatStr(SEXP env, SEXP stat); /* initialize cplex */ SEXP initCPLEX(void); +/* call cplex finalizer */ +SEXP finalizeCPLEX(void); + /* close cplex environment */ SEXP closeEnv(SEXP env); @@ -375,11 +378,6 @@ SEXP copyStart(SEXP env, SEXP lp, /* copy a basis into a problem object */ SEXP copyBase(SEXP env, SEXP lp, SEXP cstat, SEXP rstat); -/* copy a partial basis into an LP problem object */ -SEXP copyPartBase(SEXP env, SEXP lp, - SEXP ncind, SEXP cind, SEXP cstat, - SEXP nrind, SEXP rind, SEXP rstat); - /* access the basis resident in a problem object */ SEXP getBase(SEXP env, SEXP lp); diff --git a/src/cplexR.c b/src/cplexR.c index 83e0eae..92e246f 100644 --- a/src/cplexR.c +++ b/src/cplexR.c @@ -1,5 +1,5 @@ /* cplexR.c - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/src/cplexR.h b/src/cplexR.h index 6243381..7059ede 100644 --- a/src/cplexR.h +++ b/src/cplexR.h @@ -1,5 +1,5 @@ /* cplexR.h - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/src/cplex_checkAPI.c b/src/cplex_checkAPI.c index 196cc44..98c9d8f 100644 --- a/src/cplex_checkAPI.c +++ b/src/cplex_checkAPI.c @@ -1,5 +1,5 @@ /* cplex_checkAPI.c - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/src/cplex_checkAPI.h b/src/cplex_checkAPI.h index 9cec72a..1642219 100644 --- a/src/cplex_checkAPI.h +++ b/src/cplex_checkAPI.h @@ -1,5 +1,5 @@ /* cplex_checkAPI.h - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/src/cplex_longparamAPI.c b/src/cplex_longparamAPI.c index c512eda..5750421 100644 --- a/src/cplex_longparamAPI.c +++ b/src/cplex_longparamAPI.c @@ -1,5 +1,5 @@ /* cplex_longparamAPI.c - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/src/cplex_longparamAPI.h b/src/cplex_longparamAPI.h index ea419c4..24bf690 100644 --- a/src/cplex_longparamAPI.h +++ b/src/cplex_longparamAPI.h @@ -1,5 +1,5 @@ /* cplex_longparamAPI.h - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. diff --git a/src/init.c b/src/init.c index 23c1853..a807f50 100644 --- a/src/init.c +++ b/src/init.c @@ -1,5 +1,5 @@ /* init.c - R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.6. + R Interface to C API of IBM ILOG CPLEX Version 12.1 to 12.10. Copyright (C) 2011-2014 Gabriel Gelius-Dietrich, Dpt. for Bioinformatics, Institute for Informatics, Heinrich-Heine-University, Duesseldorf, Germany. @@ -40,6 +40,7 @@ static const R_CallMethodDef callMethods[] = { {"isCPLEXtermPtr", (DL_FUNC) &isCPLEXtermPtr, 1}, {"isNULLptr", (DL_FUNC) &isNULLptr, 1}, {"initCPLEX", (DL_FUNC) &initCPLEX, 0}, + {"finalizeCPLEX", (DL_FUNC) &finalizeCPLEX, 0}, {"getErrorStr", (DL_FUNC) &getErrorStr, 2}, {"getStatStr", (DL_FUNC) &getStatStr, 2}, {"closeEnv", (DL_FUNC) &closeEnv, 1}, @@ -134,7 +135,6 @@ static const R_CallMethodDef callMethods[] = { {"cleanupCoef", (DL_FUNC) &cleanupCoef, 3}, {"copyStart", (DL_FUNC) ©Start, 8}, {"copyBase", (DL_FUNC) ©Base, 4}, - {"copyPartBase", (DL_FUNC) ©PartBase, 8}, {"getBase", (DL_FUNC) &getBase, 2}, {"baseWrite", (DL_FUNC) &baseWrite, 3}, {"readCopyBase", (DL_FUNC) &readCopyBase, 3}, @@ -270,13 +270,7 @@ static const R_CallMethodDef callMethods[] = { {NULL, NULL, 0} }; -/* -------------------------------------------------------------------------- */ - void R_init_cplexAPI(DllInfo *info) { R_registerRoutines(info, NULL, callMethods, NULL, NULL); R_useDynamicSymbols(info, FALSE); } - - - - -- GitLab