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

Enabling SCIP as an available solver for testing #1281

Closed
lbianchi-lbl opened this issue Oct 5, 2023 · 1 comment · Fixed by #1282
Closed

Enabling SCIP as an available solver for testing #1281

lbianchi-lbl opened this issue Oct 5, 2023 · 1 comment · Fixed by #1282
Assignees
Labels
Priority:High High Priority Issue or PR

Comments

@lbianchi-lbl
Copy link
Contributor

  • This would be needed to fully test some functionality, e.g. SVD Toolbox for diagnostics #1256
  • SCIP can be installed using Conda (requires an activated Conda environment): conda install -c conda-forge scip
  • However, this also causes a different (in the sense of non-idaes-ext) version of IPOPT to be installed in the Conda environment:
    $ python -c "from pyomo.environ import SolverFactory as F; s = F('ipopt'); print(s.executable())"
    /opt/conda/envs/test-idaes-scip/bin/ipopt
    $ python -c "import idaes; from pyomo.environ import SolverFactory as F; s = F('ipopt'); print(s.executable())"
    /home/ludo/.idaes/bin/ipopt

My vague concern is that having two versions of IPOPT might lead to hard(er)-to-debug environment issues. However, I don't know enough about the Pyomo solver interface and/or the internals of idaes-ext to understand whether this can be problematic, so I've opened this issue as a spin-off of an ongoing conversation with @andrewlee94 to discuss it with a wider group.

@lbianchi-lbl lbianchi-lbl changed the title Enabling SCIP as an available solver Enabling SCIP as an available solver for testing Oct 5, 2023
@jsiirola
Copy link
Contributor

jsiirola commented Oct 5, 2023

An alternative is to install it with pip install -i https://pypi.ampl.com ampl_module_scip. It looks like this is a static build of scip, and therefore won't interfere with the IDAES ipopt build.

To get Pyomo to see the executable, you either need to add a directory to the PATH before importing Pyomo:

import ampl_module_scip
import os
os.environ['PATH'] = os.pathsep.join([ampl_module_scip.bin_dir, os.environ['PATH']])

or else, you can tell Pyomo to re-check the PATH for executables, e.g.:

>>> from pyomo.environ import *
>>> s = SolverFactory('scip')
>>> s.available()
False
>>> import ampl_module_scip
>>> import os
>>> os.environ['PATH'] = os.pathsep.join([ampl_module_scip.bin_dir, os.environ['PATH']])
>>> from pyomo.common import Executable
>>> Executable.rehash()
>>> s.available()
True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:High High Priority Issue or PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants