Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clpexAPI related bug on Virtual machine #33

Closed
aassie opened this issue May 28, 2020 · 2 comments
Closed

clpexAPI related bug on Virtual machine #33

aassie opened this issue May 28, 2020 · 2 comments

Comments

@aassie
Copy link

aassie commented May 28, 2020

Hello Johannes,

So I still can't install cplexAPI on my virtual machine and couldn't find how to have the glpk solver used instead. I have digged a bit in the code and found out that the adapt.R and gf.suite.R scripts have to both load the cplexAPI before checking if it is present in the installed package.

if you move the

suppressMessages(library(cplexAPI))

within the the if loop below

if( "cplexAPI" %in% rownames(installed.packages()) ){
  sybil::SYBIL_SETTINGS("SOLVER","cplexAPI"); ok <- 1
}else{
  warning("glpkAPI is used but cplexAPI is recommended because it is much faster")
  sybil::SYBIL_SETTINGS("SOLVER","glpkAPI"); ok <- 5
}

like this

if( "cplexAPI" %in% rownames(installed.packages()) ){
  suppressMessages(library(cplexAPI))
  sybil::SYBIL_SETTINGS("SOLVER","cplexAPI"); ok <- 1
}

it seems to fix the script crashing because it can't load the cplexAPI so it can't choose the solver =)

Waschina added a commit that referenced this issue May 29, 2020
@Waschina
Copy link
Collaborator

Waschina commented May 29, 2020

Hello Adrien,

Thank you very much for pointing this out! The commit 59ea9ce should fix the issue in the same way as you suggested.
We'll also run some tests to compare models between glpk and cplex.

Thanks again!
Silvio

@Waschina
Copy link
Collaborator

Waschina commented Jun 2, 2020

Hello Adrien,

just as a small addition. I also struggled with the installation of cplexAPI but it worked for me using the following commands. Maybe it works for you the same way.

CPLEXDIR=/dir/to/cplex129/cplex # adjust this with the path to your cplex installation
SYSTEM=`ls -d ${CPLEXDIR}/lib/*`
LIBFORMAT=static_pic
CPLEXLIBDIR=${SYSTEM}/${LIBFORMAT}

R CMD INSTALL --configure-args=" \
PKG_CFLAGS='-m64 -fPIC' \
PKG_CPPFLAGS='-I${CPLEXDIR}/include' \
PKG_LIBS='-L${CPLEXLIBDIR} -lcplex -lm -pthread -ldl'" \
cplexAPI_1.3.6.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants