Skip to content

Commit 7aefc8d

Browse files
authored
Add major / minor / tech versions (#956)
* Add major / minor / tech versions * Fix if statement * Update SCIP version in coverage.yml * Update CHANGELOG
1 parent cc0695f commit 7aefc8d

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Run tests with coverage
22
env:
3-
version: 9.1.0
3+
version: 9.2.1
44

55
on:
66
push:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44
### Added
55
- Added cutoffNode and test
6+
- Added getMajorVersion, getMinorVersion, and getTechVersion
67
### Fixed
78
### Changed
89
### Removed

src/pyscipopt/scip.pxd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ cdef extern from "scip/scip.h":
560560
void SCIPmessageSetErrorPrinting(errormessagecallback, void* data)
561561
void SCIPsetMessagehdlrLogfile(SCIP* scip, const char* filename)
562562
SCIP_Real SCIPversion()
563+
int SCIPmajorVersion()
564+
int SCIPminorVersion()
565+
int SCIPtechVersion()
563566
void SCIPprintVersion(SCIP* scip, FILE* outfile)
564567
void SCIPprintExternalCodes(SCIP* scip, FILE* outfile)
565568
SCIP_Real SCIPgetTotalTime(SCIP* scip)

src/pyscipopt/scip.pxi

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,10 +1899,12 @@ cdef class Model:
18991899
False if data can be safely shared between the source and target problem (default False)
19001900
19011901
"""
1902-
if self.version() < MAJOR:
1902+
if self.getMajorVersion() < MAJOR:
19031903
raise Exception("linked SCIP is not compatible to this version of PySCIPOpt - use at least version", MAJOR)
1904-
if self.version() < MAJOR + MINOR/10.0 + PATCH/100.0:
1905-
warnings.warn("linked SCIP {} is not recommended for this version of PySCIPOpt - use version {}.{}.{}".format(self.version(), MAJOR, MINOR, PATCH))
1904+
if self.getMinorVersion() < MINOR:
1905+
warnings.warn(
1906+
"linked SCIP {}.{} is not recommended for this version of PySCIPOpt - use version {}.{}.{}".format(
1907+
self.getMajorVersion(), self.getMinorVersion(), MAJOR, MINOR, PATCH))
19061908

19071909
self._freescip = True
19081910
self._modelvars = {}
@@ -2139,6 +2141,40 @@ cdef class Model:
21392141
"""
21402142
return SCIPversion()
21412143

2144+
def getMajorVersion(self):
2145+
"""
2146+
Retrieve SCIP major version.
2147+
2148+
Returns
2149+
-------
2150+
int
2151+
2152+
"""
2153+
return SCIPmajorVersion()
2154+
2155+
def getMinorVersion(self):
2156+
"""
2157+
Retrieve SCIP minor version.
2158+
2159+
Returns
2160+
-------
2161+
int
2162+
2163+
"""
2164+
return SCIPminorVersion()
2165+
2166+
2167+
def getTechVersion(self):
2168+
"""
2169+
Retrieve SCIP technical version.
2170+
2171+
Returns
2172+
-------
2173+
int
2174+
2175+
"""
2176+
return SCIPtechVersion()
2177+
21422178
def printVersion(self):
21432179
"""Print version, copyright information and compile mode."""
21442180
user_locale = locale.getlocale(category=locale.LC_NUMERIC)

0 commit comments

Comments
 (0)