Skip to content

Commit

Permalink
Add SCIP_STATUS_(PRIMAL;DUAL)LIMIT (#864)
Browse files Browse the repository at this point in the history
* Add SCIP_STATUS_(PRIMAL;DUAL)LIMIT

* Update README to SCIP 9.1

* Change version to 5.1.0
  • Loading branch information
Opt-Mucca committed Jun 21, 2024
1 parent d47d9a0 commit feb38fd
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Run tests with coverage
env:
version: 9.0.0
version: 9.1.0

on:
push:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
### Added
- Added SCIP_STATUS_DUALLIMIT and SCIP_STATUS_PRIMALLIMIT
- Added SCIPprintExternalCodes (retrieves version of linked symmetry, lp solver, nl solver etc)
- Added recipe with reformulation for detecting infeasible constraints
- Wrapped SCIPcreateOrigSol and added tests
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ The following table summarizes which version of PySCIPOpt is required for a give

|SCIP| PySCIPOpt |
|----|----|
9.0 | 5.x
9.1 | 5.1+
9.0 | 5.0.x
8.0 | 4.x
7.0 | 3.x
6.0 | 2.x
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

setup(
name="PySCIPOpt",
version="5.0.1",
version="5.1.0",
description="Python interface and modeling environment for SCIP",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion src/pyscipopt/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '5.0.1'
__version__ = '5.1.0'
4 changes: 3 additions & 1 deletion src/pyscipopt/scip.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ cdef extern from "scip/scip.h":
SCIP_STATUS SCIP_STATUS_GAPLIMIT
SCIP_STATUS SCIP_STATUS_SOLLIMIT
SCIP_STATUS SCIP_STATUS_BESTSOLLIMIT
SCIP_STATUS SCIP_STATUS_RESTARTLIMIT
SCIP_STATUS SCIP_STATUS_RESTARTLIMIT
SCIP_STATUS SCIP_STATUS_PRIMALLIMIT
SCIP_STATUS SCIP_STATUS_DUALLIMIT
SCIP_STATUS SCIP_STATUS_OPTIMAL
SCIP_STATUS SCIP_STATUS_INFEASIBLE
SCIP_STATUS SCIP_STATUS_UNBOUNDED
Expand Down
6 changes: 6 additions & 0 deletions src/pyscipopt/scip.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ cdef class PY_SCIP_STATUS:
SOLLIMIT = SCIP_STATUS_SOLLIMIT
BESTSOLLIMIT = SCIP_STATUS_BESTSOLLIMIT
RESTARTLIMIT = SCIP_STATUS_RESTARTLIMIT
PRIMALLIMIT = SCIP_STATUS_PRIMALLIMIT
DUALLIMIT = SCIP_STATUS_DUALLIMIT
OPTIMAL = SCIP_STATUS_OPTIMAL
INFEASIBLE = SCIP_STATUS_INFEASIBLE
UNBOUNDED = SCIP_STATUS_UNBOUNDED
Expand Down Expand Up @@ -4992,6 +4994,10 @@ cdef class Model:
return "bestsollimit"
elif stat == SCIP_STATUS_RESTARTLIMIT:
return "restartlimit"
elif stat == SCIP_STATUS_PRIMALLIMIT:
return "primallimit"
elif stat == SCIP_STATUS_DUALLIMIT:
return "duallimit"
else:
return "unknown"

Expand Down
17 changes: 17 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,20 @@ def test_version_external_codes():
scip = Model()
scip.printVersion()
scip.printExternalCodeVersions()

def test_primal_dual_limit():
from pyscipopt import SCIP_PARAMSETTING
scip = Model()
scip.readProblem("tests/data/10teams.mps")
scip.setParam("limits/primal", 1000000)
scip.setHeuristics(SCIP_PARAMSETTING.OFF)
scip.setSeparating(SCIP_PARAMSETTING.OFF)
scip.setPresolve(SCIP_PARAMSETTING.OFF)
scip.optimize()
assert(scip.getStatus() == "primallimit"), scip.getStatus()

scip = Model()
scip.readProblem("tests/data/10teams.mps")
scip.setParam("limits/dual", -10)
scip.optimize()
assert (scip.getStatus() == "duallimit"), scip.getStatus()

0 comments on commit feb38fd

Please sign in to comment.