Skip to content

Commit 01fb038

Browse files
Merge branch 'master' into print-names
2 parents 496dac4 + 3861380 commit 01fb038

File tree

6 files changed

+41
-9
lines changed

6 files changed

+41
-9
lines changed

INSTALL.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
Requirements
22
============
33

4+
From version 4.4.0 SCIP is automatically shipped when using PyPI for the following systems:
5+
6+
- CPython 3.6 / 3.7 / 3.8 / 3.9 / 3.10 / 3.11 for Linux (manylinux2014)
7+
- CPython 3.6 / 3.7 / 3.8 / 3.9 / 3.10 / 3.11 for MacOS for x86_64 (ARM i.e. Apple Silicon is currently unavailable)
8+
- CPython 3.8 / 3.9 / 3.10 / 3.11 for Windows
9+
10+
This work is currently ongoing, and is planned to encompass all Python and OS combinations.
11+
12+
Please note that to use any of these Python / OS combinations without the default SCIP, one must build PySCIPOpt from source and
13+
link against your own installation of SCIP. Such a scenario is common if the LP plugin should be Gurobi / Xpress / CPLEX instead of Soplex.
14+
15+
When installing from source or using PyPI with a python version and operating system combination that is not mentioned above,
416
PySCIPOpt requires a working installation of the [SCIP Optimization
517
Suite](https://www.scipopt.org/). Please, make sure that your SCIP installation works!
618

719
**Note that the latest PySCIPOpt version is usually only compatible with the latest major release of the SCIP Optimization Suite. See the table on the README.md page for details.**
820

9-
If SCIP is not installed in the global path
21+
If installing SCIP from source or using PyPI with a python and operating system that is not mentioned above, and SCIP is not installed in the global path,
1022
you need to specify the install location using the environment variable
1123
`SCIPOPTDIR`:
1224

@@ -29,19 +41,24 @@ contains the corresponding header files:
2941
> nlpi
3042
> ...
3143

32-
If you are not using the installer packages, you need to [install the
44+
If you install SCIP yourself and are not using the installer packages, you need to [install the
3345
SCIP Optimization Suite using CMake](https://www.scipopt.org/doc/html/md_INSTALL.php#CMAKE).
3446
The Makefile system is not compatible with PySCIPOpt!
3547

36-
On Windows it is highly recommended to use the [Anaconda Python
48+
When building SCIP from source using Windows it is highly recommended to use the [Anaconda Python
3749
Platform](https://www.anaconda.com/).
3850

3951
Installation from PyPI
4052
======================
4153

4254
python -m pip install pyscipopt
4355

44-
On Windows you may need to ensure that the `scip` library can be found
56+
Please note that if your Python version and OS version are in the combinations at the start of this INSTALL file then
57+
pip now automatically installs a pre-built version of SCIP. For these combinations, to use your own installation of SCIP,
58+
plese see the section on building from source. For unavailable combinations this pip command will automatically
59+
search your global installs or custom set paths as above.
60+
61+
On Windows for combinations not listed at the start of this file, you may need to ensure that the `scip` library can be found
4562
at runtime by adjusting your `PATH` environment variable:
4663

4764
- on Windows: `set PATH=%PATH%;%SCIPOPTDIR%\bin`

src/pyscipopt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '4.3.0'
1+
__version__ = '4.4.0'
22

33
# required for Python 3.8 on Windows
44
import os

src/pyscipopt/scip.pxd

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,6 @@ cdef extern from "scip/scip.h":
456456
ctypedef struct SCIP_HASHMAP:
457457
pass
458458

459-
#ctypedef struct SCIP_BOUNDTYPE:
460-
# pass
461-
462459
ctypedef struct SCIP_BDCHGIDX:
463460
pass
464461

src/pyscipopt/scip.pxi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,11 @@ cdef class Constraint:
962962
constype = bytes(SCIPconshdlrGetName(SCIPconsGetHdlr(self.scip_cons))).decode('UTF-8')
963963
return constype == 'nonlinear'
964964

965+
def getConshdlrName(self):
966+
"""Return the constraint handler's name"""
967+
constype = bytes(SCIPconshdlrGetName(SCIPconsGetHdlr(self.scip_cons))).decode('UTF-8')
968+
return constype
969+
965970
def __hash__(self):
966971
return hash(<size_t>self.scip_cons)
967972

@@ -1110,6 +1115,11 @@ cdef class Model:
11101115

11111116
def freeTransform(self):
11121117
"""Frees all solution process data including presolving and transformed problem, only original problem is kept"""
1118+
self._modelvars = {
1119+
var: value
1120+
for var, value in self._modelvars.items()
1121+
if value.isOriginal()
1122+
}
11131123
PY_SCIP_CALL(SCIPfreeTransform(self._scip))
11141124

11151125
def version(self):
@@ -5171,4 +5181,4 @@ def is_memory_freed():
51715181
return BMSgetMemoryUsed() == 0
51725182

51735183
def print_memory_in_use():
5174-
BMScheckEmptyMemory()
5184+
BMScheckEmptyMemory()

tests/test_cons.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def test_SOScons():
9696
assert m.isEQ(m.getVal(x[3]), 1)
9797
assert m.isEQ(m.getVal(x[4]), 1)
9898
assert m.isEQ(m.getVal(x[5]), 1)
99+
assert c1.getConshdlrName() == "SOS1"
100+
assert c2.getConshdlrName() == "SOS2"
99101

100102

101103
def test_cons_indicator():
@@ -112,6 +114,7 @@ def test_cons_indicator():
112114
assert m.isEQ(m.getVal(slack), 0)
113115
assert m.isEQ(m.getVal(binvar), 1)
114116
assert m.isEQ(m.getVal(x), 1)
117+
assert c.getConshdlrName() == "indicator"
115118

116119

117120
@pytest.mark.xfail(reason="addConsIndicator doesn't behave as expected when binary variable is False. See Issue #717.")

tests/test_pricer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ def test_cuttingstock():
158158
assert type(s.getNSols()) == int
159159
assert s.getNSols() == s.data["nSols"]
160160

161+
# Testing freeTransform
162+
s.freeTransform()
163+
for i in range(10):
164+
s.addVar()
165+
161166
def test_incomplete_pricer():
162167
class IncompletePricer(Pricer):
163168
pass

0 commit comments

Comments
 (0)