From 25b9832aeb549706ec6bdfc75fa65ce4662be46c Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Fri, 14 Feb 2025 16:07:51 +0100 Subject: [PATCH 1/4] Add major / minor / tech versions --- src/pyscipopt/scip.pxd | 3 +++ src/pyscipopt/scip.pxi | 42 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/pyscipopt/scip.pxd b/src/pyscipopt/scip.pxd index 7f2e87f14..4f6084e0a 100644 --- a/src/pyscipopt/scip.pxd +++ b/src/pyscipopt/scip.pxd @@ -560,6 +560,9 @@ cdef extern from "scip/scip.h": void SCIPmessageSetErrorPrinting(errormessagecallback, void* data) void SCIPsetMessagehdlrLogfile(SCIP* scip, const char* filename) SCIP_Real SCIPversion() + int SCIPmajorVersion() + int SCIPminorVersion() + int SCIPtechVersion() void SCIPprintVersion(SCIP* scip, FILE* outfile) void SCIPprintExternalCodes(SCIP* scip, FILE* outfile) SCIP_Real SCIPgetTotalTime(SCIP* scip) diff --git a/src/pyscipopt/scip.pxi b/src/pyscipopt/scip.pxi index db08f94ce..3e46208b6 100644 --- a/src/pyscipopt/scip.pxi +++ b/src/pyscipopt/scip.pxi @@ -1899,10 +1899,12 @@ cdef class Model: False if data can be safely shared between the source and target problem (default False) """ - if self.version() < MAJOR: + if self.getMajorVersion() < MAJOR: raise Exception("linked SCIP is not compatible to this version of PySCIPOpt - use at least version", MAJOR) - if self.version() < MAJOR + MINOR/10.0 + PATCH/100.0: - warnings.warn("linked SCIP {} is not recommended for this version of PySCIPOpt - use version {}.{}.{}".format(self.version(), MAJOR, MINOR, PATCH)) + if self.getMinorVersion(): + warnings.warn( + "linked SCIP {}.{} is not recommended for this version of PySCIPOpt - use version {}.{}.{}".format( + self.getMajorVersion(), self.getMinorVersion(), MAJOR, MINOR, PATCH)) self._freescip = True self._modelvars = {} @@ -2139,6 +2141,40 @@ cdef class Model: """ return SCIPversion() + def getMajorVersion(self): + """ + Retrieve SCIP major version. + + Returns + ------- + int + + """ + return SCIPmajorVersion() + + def getMinorVersion(self): + """ + Retrieve SCIP minor version. + + Returns + ------- + int + + """ + return SCIPminorVersion() + + + def getTechVersion(self): + """ + Retrieve SCIP technical version. + + Returns + ------- + int + + """ + return SCIPtechVersion() + def printVersion(self): """Print version, copyright information and compile mode.""" user_locale = locale.getlocale(category=locale.LC_NUMERIC) From d4b4b55c147f77693e302aa05e834fcc27bca744 Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Fri, 14 Feb 2025 16:09:00 +0100 Subject: [PATCH 2/4] Fix if statement --- src/pyscipopt/scip.pxi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyscipopt/scip.pxi b/src/pyscipopt/scip.pxi index 3e46208b6..9828a80cc 100644 --- a/src/pyscipopt/scip.pxi +++ b/src/pyscipopt/scip.pxi @@ -1901,7 +1901,7 @@ cdef class Model: """ if self.getMajorVersion() < MAJOR: raise Exception("linked SCIP is not compatible to this version of PySCIPOpt - use at least version", MAJOR) - if self.getMinorVersion(): + if self.getMinorVersion() < MINOR: warnings.warn( "linked SCIP {}.{} is not recommended for this version of PySCIPOpt - use version {}.{}.{}".format( self.getMajorVersion(), self.getMinorVersion(), MAJOR, MINOR, PATCH)) From 41c1d9dc68cc51b92767dae22c5a1a30200a288d Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Sat, 15 Feb 2025 13:26:21 +0100 Subject: [PATCH 3/4] Update SCIP version in coverage.yml --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b344ab396..4a39c3cdc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,6 +1,6 @@ name: Run tests with coverage env: - version: 9.1.0 + version: 9.2.1 on: push: From f69abddf197cddbcc6b3aff2cad6cd9f06f42605 Mon Sep 17 00:00:00 2001 From: Mark Turner Date: Sat, 15 Feb 2025 13:51:24 +0100 Subject: [PATCH 4/4] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 351f52ea2..f58c50b43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Added - Added cutoffNode and test +- Added getMajorVersion, getMinorVersion, and getTechVersion ### Fixed ### Changed ### Removed