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

Add support for scip 8 #2409

Merged
merged 5 commits into from
May 26, 2022
Merged

Add support for scip 8 #2409

merged 5 commits into from
May 26, 2022

Conversation

sebuer
Copy link

@sebuer sebuer commented May 18, 2022

Fixes # .

#2226

Summary/Motivation:

SCIP 8.0 integrates the AMPl interface into the main SCIP executable with slight changes to the command line arguments. Starting from that version, the scipampl executable is no longer provided, which is currently used by pyomo. This pull request adds support for the newer SCIP versions. I tested the changes with precompiled scip 8.0.0 and self compiled scipampl 7.0.3 on Ubuntu 20.04.

I also noticed the missing check of the _timelimit property as it is performed in GLPKSHELL. These changes also add a corresponding solver option to the options file.

Changes proposed in this PR:

  • Add _known_versions handling similar to GLPKSHELL.
  • Check version of scip before falling back to scipampl.
  • Remove .nl extension from command line options if solver version >= 8.
  • Provide options in temporary directory to the solver instead of in a temporary file.
    • The creation and the use of the temporary directory as the working directory for the solver is necessary, since the new command line options for scip do not allow for a non-default path for the solver setting if the -AMPL option is used. The working directory is now set optionally in the subprocess.run call of SystemCallSolver.
  • Set timelimit option in solver settings if a timelimit was provided to pyomo.

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@@ -10,6 +10,7 @@
# ___________________________________________________________________________

import os
import os.path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

@mrmundt
Copy link
Contributor

mrmundt commented May 23, 2022

@sebuer - This is a lovely PR, thank you. Could you possibly add some tests so we can ensure the functionality works as intended (and to safeguard against future changes)? Our test suite runs for Linux, MacOS, and Windows (more information can be found here: https://pyomo.readthedocs.io/en/stable/contribution_guide.html#testing)

Current tests for scip are in https://github.com/Pyomo/pyomo/tree/main/pyomo/solvers/tests/mip, but you are also welcome to create a new test if you desire.

NOTE: PR #2419 resolves a testing failure related to a newer version of dill. Once that is merged, you will want to add those changes to your branch.

@codecov
Copy link

codecov bot commented May 26, 2022

Codecov Report

Merging #2409 (10b0038) into main (622cf52) will increase coverage by 0.05%.
The diff coverage is 96.55%.

@@            Coverage Diff             @@
##             main    #2409      +/-   ##
==========================================
+ Coverage   85.89%   85.94%   +0.05%     
==========================================
  Files         617      618       +1     
  Lines       76198    76438     +240     
==========================================
+ Hits        65453    65698     +245     
+ Misses      10745    10740       -5     
Flag Coverage Δ
linux 82.70% <93.10%> (+0.07%) ⬆️
osx ?
other 82.89% <93.10%> (+0.06%) ⬆️
win 79.72% <93.10%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyomo/opt/solver/shellcmd.py 85.71% <ø> (+0.57%) ⬆️
pyomo/solvers/plugins/solvers/SCIPAMPL.py 67.40% <96.55%> (+3.82%) ⬆️
pyomo/common/download.py 91.51% <0.00%> (-0.45%) ⬇️
pyomo/core/__init__.py 100.00% <0.00%> (ø)
pyomo/contrib/incidence_analysis/connected.py 100.00% <0.00%> (ø)
pyomo/core/base/initializer.py 99.67% <0.00%> (+0.18%) ⬆️
pyomo/contrib/incidence_analysis/interface.py 98.46% <0.00%> (+0.25%) ⬆️
examples/pyomobook/test_book_examples.py 96.80% <0.00%> (+0.79%) ⬆️
pyomo/opt/results/container.py 75.75% <0.00%> (+0.90%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 622cf52...10b0038. Read the comment docs.

@mrmundt
Copy link
Contributor

mrmundt commented May 26, 2022

@sebuer - The codecov failure is unrelated (and a known issue: codecov/codecov-action#745). Thank you for this PR! We appreciate your contribution.

@mrmundt mrmundt merged commit 74b5005 into Pyomo:main May 26, 2022
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

Successfully merging this pull request may close these issues.

5 participants