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: 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 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..9828a80cc 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() < MINOR: + 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)