diff --git a/DESCRIPTION b/DESCRIPTION index 5873fcfd6df1ad016760fe0285090132d28f1d02..2eaa2d7421d4d57953b5ce9280296c9ff4d0198b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: clpAPI Type: Package Title: R Interface to C API of COIN-or Clp -Version: 1.2.13 -Date: 2020-02-13 +Version: 1.3.0 +Date: 2020-08-07 Authors@R: c(person("Mayo", "Roettger", role = "cre", email = "mayo.roettger@hhu.de"), person("Gabriel", "Gelius-Dietrich", role = c("aut"), email = "geliudie@uni-duesseldorf.de"), person(c("C.", "Jonathan"), "Fritzemeier", role = "ctb", email = "clausjonathan.fritzemeier@uni-duesseldorf.de")) @@ -13,9 +13,9 @@ SystemRequirements: COIN-OR Clp (>= 1.12.0) License: GPL-3 | file LICENSE LazyLoad: yes Collate: generics.R clp_ptrClass.R clp.R clpAPI.R zzz.R -Packaged: 2020-02-13 10:47:00 UTC; mayo +Packaged: 2020-08-07 10:38:00 UTC; mayo Author: Mayo Roettger [cre], Gabriel Gelius-Dietrich [aut], C. Jonathan Fritzemeier [ctb] Maintainer: Mayo Roettger <mayo.roettger@hhu.de> NeedsCompilation: yes Repository: CRAN -Date/Publication: 2020-02-13 11:47:00 +Date/Publication: 2020-08-07 11:38:00 diff --git a/NAMESPACE b/NAMESPACE index c66a323abae477eb37056335068f872669690ce5..c315a02e4f10105b69fa14f5db2315b2dccedcd8 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -80,6 +80,7 @@ versionCLP, setRowNameCLP, setColNameCLP, writeMPSCLP, -modifyCoefficientCLP +modifyCoefficientCLP, +isAvailableFuncCLP ) diff --git a/R/clpAPI.R b/R/clpAPI.R index bbd4b1bfc8ba007074b5c2682e63d96d9a9ffc88..e563fab1358b1ca3a6a9652c28dcef0a17e01376 100755 --- a/R/clpAPI.R +++ b/R/clpAPI.R @@ -936,7 +936,7 @@ writeMPSCLP <- function(lp, fname, formatType = 0, numberAcross = 1, objSense = as.integer(formatType), as.integer(numberAcross), as.numeric(objSense) - ) + ) return(check) @@ -960,3 +960,14 @@ modifyCoefficientCLP <- function(lp, i, j, el, keepZero = TRUE) { } + +# Function to check availability of Clp-1.17.2 functions # +#------------------------------------------------------------------------------# + +isAvailableFuncCLP <- function(funcname) { + check <- .Call("isAvailableFunc", PACKAGE = "clpAPI", + as.character(funcname) + ) + + return(check) +} diff --git a/configure b/configure index 02f3c3f4c77704050670455ecac8224d0b0a8d42..5f1591481d262cbadd53542c29a986f47b2ec12a 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 clpAPI 1.2.13. +# Generated by GNU Autoconf 2.69 for clpAPI 1.3.0. # # Report bugs to <mayo.roettger@hhu.de>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='clpAPI' PACKAGE_TARNAME='clpapi' -PACKAGE_VERSION='1.2.13' -PACKAGE_STRING='clpAPI 1.2.13' +PACKAGE_VERSION='1.3.0' +PACKAGE_STRING='clpAPI 1.3.0' PACKAGE_BUGREPORT='mayo.roettger@hhu.de' PACKAGE_URL='' @@ -1242,7 +1242,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 clpAPI 1.2.13 to adapt to many kinds of systems. +\`configure' configures clpAPI 1.3.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1304,7 +1304,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of clpAPI 1.2.13:";; + short | recursive ) echo "Configuration of clpAPI 1.3.0:";; esac cat <<\_ACEOF @@ -1392,7 +1392,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -clpAPI configure 1.2.13 +clpAPI configure 1.3.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1694,7 +1694,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 clpAPI $as_me 1.2.13, which was +It was created by clpAPI $as_me 1.3.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4251,7 +4251,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 clpAPI $as_me 1.2.13, which was +This file was extended by clpAPI $as_me 1.3.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4313,7 +4313,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="\\ -clpAPI config.status 1.2.13 +clpAPI config.status 1.3.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index c9ec3eb83a0fd9dbab1061e90fd97907899c9c59..b459b47be593de8da1a247e8bdc6e1126582d731 100755 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([clpAPI], [1.2.13], [mayo.roettger@hhu.de]) +AC_INIT([clpAPI], [1.3.0], [mayo.roettger@hhu.de]) dnl # -------------------------------------------------------------------- dnl # template config.h.in diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 3743e4671b3f1875036bab488b26c9d700dd5ab6..a9cf18350fc4785bcabb59548113cae322d1e014 100755 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,6 +3,14 @@ \name{NEWS} \title{clpAPI News} \encoding{UTF-8} +% ---------------------------------------------------------------------------- % +\section{Changes in version 1.3.0 2020-08-07}{ + \itemize{ + \item Added function \code{isAvailableFuncCLP}, to check if newer API + functions are available. + } +} + % ---------------------------------------------------------------------------- % \section{Changes in version 1.2.13 2020-02-13}{ \itemize{ diff --git a/man/isAvailableFuncCLP.Rd b/man/isAvailableFuncCLP.Rd new file mode 100755 index 0000000000000000000000000000000000000000..35b8b1e9bd30eea203a16ade6b64be5d1f821171 --- /dev/null +++ b/man/isAvailableFuncCLP.Rd @@ -0,0 +1,46 @@ +\name{isAvailableFuncCLP} +\alias{isAvailableFuncCLP} + +\title{ + Check if some newer functions relying on CLP version >= 1.17.2 are available +} + +\description{ + Checks if functions like \code{setRowNameCLP}, \code{setColNameCLP}, + \code{writeMpsCLP}, and \code{modifyCoefficientCLP} are available. +} + +\usage{ + isAvailableFuncCLP(funcname) +} + +\arguments{ + \item{funcname}{ + The name of the function. + } +} + +\details{ + Some functions of the API require that the package was build against + CLP version >= 1.17.2, otherwise they will be dummy functions. + These functions are \code{setRowNameCLP}, \code{setColNameCLP}, + \code{writeMpsCLP}, and \code{modifyCoefficientCLP}. This function + tests, if these functions are available. +} + +\value{ + TRUE, if the respective function is available, + returns FALSE, if it is not. If the funcname + does not match one of the mentioned functions, it + returns FALSE. +} + +\author{ + Mayo Roettger <mayo.roettger@hhu.de> + + Maintainer: Mayo Roettger <mayo.roettger@hhu.de> +} + + +\keyword{ optimize } + diff --git a/man/modifyCoefficientCLP.Rd b/man/modifyCoefficientCLP.Rd index 6000036b63204db9ea0f38b158c988af86a708c1..d1851be528565cf74b34425b7cca09b53fb772b3 100755 --- a/man/modifyCoefficientCLP.Rd +++ b/man/modifyCoefficientCLP.Rd @@ -23,10 +23,10 @@ problem object. } \item{i}{ - Row index. + Row index (starts with 0). } \item{j}{ - Column index. + Column index (starts with 0). } \item{el}{ Coefficient to set. diff --git a/src/clpAPI.c b/src/clpAPI.c index ac230146f5d6bf0738871b1e4b527d0f6d4ff30c..53aa60663b1fdbc3c0ac2797e2dd43fba58297df 100755 --- a/src/clpAPI.c +++ b/src/clpAPI.c @@ -1371,26 +1371,71 @@ SEXP modifyCoefficient(SEXP lp, SEXP row, SEXP column, SEXP newElement, SEXP kee return out; } +/* -------------------------------------------------------------------------- */ +/* check for functionality of new clp functions */ +SEXP isAvailableFunc(SEXP funcname) { + + SEXP out = R_NilValue; + + const char *rfuncname = CHAR(STRING_ELT(funcname, 0)); + + if (strcmp(rfuncname,"setRowNameCLP") == 0) { + out = Rf_ScalarLogical(1); + } else if (strcmp(rfuncname,"setColNameCLP") == 0) { + out = Rf_ScalarLogical(1); + } else if (strcmp(rfuncname,"writeMpsCLP") == 0) { + out = Rf_ScalarLogical(1); + } else if (strcmp(rfuncname,"modifyCoefficientCLP") == 0) { + out = Rf_ScalarLogical(1); + } + + return out; +} + #else /* not CLP_EXT1_17_2 */ +/* dummy function */ SEXP setRowName(SEXP lp, SEXP i, SEXP rname) { SEXP out = R_NilValue; return out; } +/* dummy function */ SEXP setColName(SEXP lp, SEXP j, SEXP cname) { SEXP out = R_NilValue; return out; } +/* dummy function */ SEXP writeMps(SEXP lp, SEXP filename, SEXP formatType, SEXP numberAcross, SEXP objSense) { - SEXP out = R_NilValue; + SEXP out = Rf_ScalarInteger(1); return out; } +/* dummy function */ SEXP modifyCoefficient(SEXP lp, SEXP row, SEXP column, SEXP newElement, SEXP keepZero) { SEXP out = R_NilValue; return out; } +/* check for functionality of new clp functions */ +SEXP isAvailableFunc(SEXP funcname) { + + SEXP out = R_NilValue; + + const char *rfuncname = CHAR(STRING_ELT(funcname, 0)); + + if (strcmp(rfuncname,"setRowNameCLP") == 0) { + out = Rf_ScalarLogical(0); + } else if (strcmp(rfuncname,"setColNameCLP") == 0) { + out = Rf_ScalarLogical(0); + } else if (strcmp(rfuncname,"writeMpsCLP") == 0) { + out = Rf_ScalarLogical(0); + } else if (strcmp(rfuncname,"modifyCoefficientCLP") == 0) { + out = Rf_ScalarLogical(0); + } + + return out; +} + #endif /* HAVE_CLP_EXT1_17_2 */ diff --git a/src/clpAPI.h b/src/clpAPI.h index bea917f7057d021848faccfcd3b059a449b58fa4..fb46e4f1a847a5dafb45d641b24be4836fd642b2 100755 --- a/src/clpAPI.h +++ b/src/clpAPI.h @@ -253,3 +253,6 @@ SEXP writeMps(SEXP lp, SEXP filename, SEXP formatType, SEXP numberAcross, SEXP o /* Change matrix coefficients */ SEXP modifyCoefficient(SEXP lp, SEXP row, SEXP column, SEXP newElement, SEXP keepZero); /* ------------------------------------------------ */ + +/* check for functionality of new clp functions */ +SEXP isAvailableFunc(SEXP funcname); diff --git a/src/config.h b/src/config.h old mode 100755 new mode 100644 index adcbc6f3e0eacd69edb4331c0de929e7663c36c5..c9b450371eb815e21aff2d85e0bdada4dea44afb --- a/src/config.h +++ b/src/config.h @@ -41,7 +41,7 @@ #define PACKAGE_NAME "clpAPI" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "clpAPI 1.2.10" +#define PACKAGE_STRING "clpAPI 1.2.13" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "clpapi" @@ -50,7 +50,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.2.10" +#define PACKAGE_VERSION "1.2.13" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 diff --git a/src/init.c b/src/init.c index a3213a7930567e0e52dc5b35a883ca4953b087f9..60b420564155322cbfe2ef06e76b290d16eb54a9 100755 --- a/src/init.c +++ b/src/init.c @@ -101,6 +101,7 @@ static const R_CallMethodDef callMethods[] = { {"setColName", (DL_FUNC) &setColName, 3}, {"writeMps", (DL_FUNC) &writeMps, 5}, {"modifyCoefficient", (DL_FUNC) &modifyCoefficient, 5}, + {"isAvailableFunc", (DL_FUNC) &isAvailableFunc, 1}, {NULL, NULL, 0} }; diff --git a/src/symbols.rds b/src/symbols.rds index 63efcff60f9a0b315602bd76b01b3e8f084b55b6..c86af8080fd5a918a13a4edc917f0d8a0ce216ca 100755 Binary files a/src/symbols.rds and b/src/symbols.rds differ