Skip to content

Commit 2ea1716

Browse files
Merge branch 'scipopt:master' into add-set-logfile
2 parents 7f08d35 + 2ba9089 commit 2ea1716

File tree

14 files changed

+187
-68
lines changed

14 files changed

+187
-68
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,4 @@ model.lp
126126

127127
# VSCode
128128
.vscode/
129+
.devcontainer/

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ language: python
66

77
matrix:
88
include:
9-
- python: 3.5
109
- python: 3.6
1110
- python: 3.7
1211
- python: 3.8
12+
- python: 3.9
1313
env: TRAVIS_BUILD_DOCS=$TRAVIS_TAG
1414
addons:
1515
apt:

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,29 @@
22

33
## Unreleased
44
### Added
5-
- add more SCIP functions: `getNSols`
5+
### Fixed
6+
### Changed
7+
### Removed
8+
9+
## 3.1.4 - 2021-04-25
10+
### Fixed
11+
- check for correct stage when querying solution values (raise warning otherwise)
12+
13+
## 3.1.3 - 2021-04-23
14+
### Fixed
15+
- check for NULL pointers when creating Solution objects (will return None): [#494](https://github.com/scipopt/PySCIPOpt/pull/494)
16+
17+
## 3.1.2 - 2021-04-07
18+
### Added
19+
- add `Model.getNReaders` that returns the number of available readers
20+
21+
## 3.1.1 - 2021-03-10
22+
### Added
23+
- add evaluation of `Expr` in `Solution`.
24+
25+
## 3.1.0 - 2020-12-17
26+
### Added
27+
- add more SCIP functions: `getNSols`, `createPartialSol`
628

729
### Fixed
830
- consistent handling of filenames for reading/writing

INSTALL.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ The following table summarizes which version of PySCIPOpt is required for a give
99

1010
|SCIP| PySCIPOpt |
1111
|----|----|
12-
7.0 | 3.0
13-
6.0 | 2.2, 2.1, 2.0
12+
7.0 | 3.x
13+
6.0 | 2.x
1414
5.0 | 1.4, 1.3
1515
4.0 | 1.2, 1.1
1616
3.2 | 1.0
@@ -48,7 +48,7 @@ Platform](https://www.anaconda.com/).
4848
Installation from PyPI
4949
======================
5050

51-
`pip install pyscipopt`
51+
python -m pip install pyscipopt
5252

5353
On Windows you may need to ensure that the `scip` library can be found
5454
at runtime by adjusting your `PATH` environment variable:
@@ -61,24 +61,39 @@ therefore not necessary.
6161
Building everything from source
6262
===============================
6363

64-
PySCIPOpt requires [Cython](http://cython.org/), at least version 0.21
65-
(`pip install cython`). Furthermore, you need to have the Python
64+
Recommended is to install in a virtual environment (e.g. `python3 -m venv <DIR_PATH>`).
65+
Please note that a globally installed version of PySCIPOpt on your machine might lead to problems.
66+
67+
After setting up and activating your virtual environment (`source <DIR_PATH>/bin/activate`) make sure you have [Cython](http://cython.org/) installed, at least version 0.21
68+
69+
pip install cython
70+
71+
Note you will also need the `wheel` package, which usually is already installed:
72+
73+
pip install wheel
74+
75+
Furthermore, you need to have the Python
6676
development files installed on your system (error message "Python.h not
6777
found"):
6878

6979
sudo apt-get install python-dev # for Python 2, on Linux
7080
sudo apt-get install python3-dev # for Python 3, on Linux
7181

72-
After setting up `SCIPOPTDIR` as specified above, please run
82+
After setting up `SCIPOPTDIR` as specified above install pyscipopt
7383

74-
pip install [-e] .
84+
export SCIPOPTDIR=/path/to/scip/install/dir
85+
python -m pip install [-e] .
86+
87+
For recompiling the source in the current directory `.` use
88+
89+
python -m pip install --compile .
7590

7691
Building with debug information
7792
===============================
7893

7994
To use debug information in PySCIPOpt you need to build it like this:
8095

81-
pip install [-e] --install-option="--debug" .
96+
python -m pip install [-e] --install-option="--debug" .
8297

8398
Be aware that you will need the **debug library** of the SCIP
8499
Optimization Suite for this to work
@@ -88,7 +103,11 @@ Testing new installation
88103
========================
89104

90105
To test your brand-new installation of PySCIPOpt you need
91-
[pytest](https://pytest.org/) on your system. Here is the [installation
106+
[pytest](https://pytest.org/) on your system.
107+
108+
pip install pytest
109+
110+
Here is the complete [installation
92111
procedure](https://docs.pytest.org/en/latest/getting-started.html).
93112

94113
Tests can be run in the `PySCIPOpt` directory with: :

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PySCIPOpt
22
=========
33

44
This project provides an interface from Python to the [SCIP Optimization
5-
Suite](http://scip.zib.de).
5+
Suite](https://www.scipopt.org/).
66

77
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PySCIPOpt/Lobby)
88
[![PySCIPOpt on PyPI](https://img.shields.io/pypi/v/pyscipopt.svg)](https://pypi.python.org/pypi/pyscipopt)
@@ -13,13 +13,25 @@ Suite](http://scip.zib.de).
1313
Documentation
1414
-------------
1515

16-
Please consult the [online documentation](http://scipopt.github.io/PySCIPOpt/docs/html) or use the `help()` function directly in Python or `?` in IPython/Jupyter.
16+
Please consult the [online documentation](https://scipopt.github.io/PySCIPOpt/docs/html) or use the `help()` function directly in Python or `?` in IPython/Jupyter.
1717

1818
See [CHANGELOG.md](CHANGELOG.md) for added, removed or fixed functionality.
1919

2020
Installation
2121
------------
2222

23+
**Using Conda**
24+
25+
[![Conda version](https://img.shields.io/conda/vn/conda-forge/pyscipopt?logo=conda-forge)](https://anaconda.org/conda-forge/pyscipopt)
26+
[![Conda platforms](https://img.shields.io/conda/pn/conda-forge/pyscipopt?logo=conda-forge)](https://anaconda.org/conda-forge/pyscipopt)
27+
28+
Conda will install SCIP automatically, hence everything can be installed in a single command:
29+
```bash
30+
conda install --channel conda-forge pyscipopt
31+
```
32+
33+
**Using PyPI and from Source**
34+
2335
See [INSTALL.md](INSTALL.md) for instructions.
2436
Please note that the latest PySCIPOpt version is usually only compatible with the latest major release of the SCIP Optimization Suite.
2537
Information which version of PySCIPOpt is required for a given SCIP version can also be found in [INSTALL.md](INSTALL.md).

appveyor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ environment:
2323
PIP: C:\Python38-x64\Scripts\pip
2424
PYTEST: C:\Python38-x64\Scripts\pytest
2525
TWINE: C:\Python38-x64\Scripts\twine
26+
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
27+
# PYTHON: C:\Python39-x64
28+
# PIP: C:\Python39-x64\Scripts\pip
29+
# PYTEST: C:\Python39-x64\Scripts\pytest
30+
# TWINE: C:\Python39-x64\Scripts\twine
2631

2732

2833
install:

setup.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
extra_compile_args.append('-UNDEBUG')
4242
sys.argv.remove("--debug")
4343

44-
cythonize = True
44+
use_cython = True
4545

4646
packagedir = os.path.join('src', 'pyscipopt')
4747

@@ -55,12 +55,12 @@
5555
if not os.path.exists(os.path.join(packagedir, 'scip.c')):
5656
print('Cython is required')
5757
quit(1)
58-
cythonize = False
58+
use_cython = False
5959

6060
if not os.path.exists(os.path.join(packagedir, 'scip.pyx')):
61-
cythonize = False
61+
use_cython = False
6262

63-
ext = '.pyx' if cythonize else '.c'
63+
ext = '.pyx' if use_cython else '.c'
6464

6565
extensions = [Extension('pyscipopt.scip', [os.path.join(packagedir, 'scip'+ext)],
6666
include_dirs=[includedir],
@@ -70,33 +70,33 @@
7070
extra_link_args=extra_link_args
7171
)]
7272

73-
if cythonize:
74-
extensions = cythonize(extensions, compiler_directives = {'language_level': 3})
75-
# extensions = cythonize(extensions, compiler_directives={'linetrace': True})
73+
if use_cython:
74+
extensions = cythonize(extensions, compiler_directives={'language_level': 3})
7675

7776
with open('README.md') as f:
7877
long_description = f.read()
7978

8079
setup(
81-
name = 'PySCIPOpt',
82-
version = version,
83-
description = 'Python interface and modeling environment for SCIP',
84-
long_description = long_description,
80+
name='PySCIPOpt',
81+
version=version,
82+
description='Python interface and modeling environment for SCIP',
83+
long_description=long_description,
8584
long_description_content_type='text/markdown',
86-
url = 'https://github.com/SCIP-Interfaces/PySCIPOpt',
87-
author = 'Zuse Institute Berlin',
88-
author_email = 'scip@zib.de',
89-
license = 'MIT',
85+
url='https://github.com/SCIP-Interfaces/PySCIPOpt',
86+
author='Zuse Institute Berlin',
87+
author_email='scip@zib.de',
88+
license='MIT',
9089
classifiers=[
91-
'Development Status :: 4 - Beta',
92-
'Intended Audience :: Science/Research',
93-
'Intended Audience :: Education',
94-
'License :: OSI Approved :: MIT License',
95-
'Programming Language :: Python :: 3',
96-
'Programming Language :: Cython',
97-
'Topic :: Scientific/Engineering :: Mathematics'],
98-
ext_modules = extensions,
99-
packages = ['pyscipopt'],
100-
package_dir = {'pyscipopt': packagedir},
101-
package_data = {'pyscipopt': ['scip.pyx', 'scip.pxd', '*.pxi']}
90+
'Development Status :: 4 - Beta',
91+
'Intended Audience :: Science/Research',
92+
'Intended Audience :: Education',
93+
'License :: OSI Approved :: MIT License',
94+
'Programming Language :: Python :: 3',
95+
'Programming Language :: Cython',
96+
'Topic :: Scientific/Engineering :: Mathematics'],
97+
ext_modules=extensions,
98+
install_requires=['wheel'],
99+
packages=['pyscipopt'],
100+
package_dir={'pyscipopt': packagedir},
101+
package_data={'pyscipopt': ['scip.pyx', 'scip.pxd', '*.pxi']}
102102
)

src/pyscipopt/__init__.py

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

33
# required for Python 3.8 on Windows
44
import os

src/pyscipopt/conshdlr.pxi

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ cdef SCIP_RETCODE PyConsSepasol (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS*
259259
cdef constraints = []
260260
for i in range(nconss):
261261
constraints.append(getPyCons(conss[i]))
262-
solution = Solution()
263-
solution.sol = sol
262+
solution = Solution.create(scip, sol)
264263
result_dict = PyConshdlr.conssepasol(constraints, nusefulconss, solution)
265264
result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
266265
return SCIP_OKAY
@@ -280,8 +279,7 @@ cdef SCIP_RETCODE PyConsEnforelax (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLR* con
280279
cdef constraints = []
281280
for i in range(nconss):
282281
constraints.append(getPyCons(conss[i]))
283-
solution = Solution()
284-
solution.sol = sol
282+
solution = Solution.create(scip, sol)
285283
result_dict = PyConshdlr.consenforelax(solution, constraints, nusefulconss, solinfeasible)
286284
result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
287285
return SCIP_OKAY
@@ -302,8 +300,7 @@ cdef SCIP_RETCODE PyConsCheck (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS**
302300
cdef constraints = []
303301
for i in range(nconss):
304302
constraints.append(getPyCons(conss[i]))
305-
solution = Solution()
306-
solution.sol = sol
303+
solution = Solution.create(scip, sol)
307304
result_dict = PyConshdlr.conscheck(constraints, solution, checkintegrality, checklprows, printreason, completely)
308305
result[0] = result_dict.get("result", <SCIP_RESULT>result[0])
309306
return SCIP_OKAY

src/pyscipopt/expr.pxi

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,7 @@ class Term:
109109
def __repr__(self):
110110
return 'Term(%s)' % ', '.join([str(v) for v in self.vartuple])
111111

112-
def _evaluate(self, point):
113-
'''computes the value of the term in the given variable-value mapping.'''
114-
prod = 1
115-
for var in self.vartuple:
116-
prod *= point[var]
117-
return prod
118-
112+
119113
CONST = Term()
120114

121115
# helper function
@@ -289,10 +283,6 @@ cdef class Expr:
289283
else:
290284
return max(len(v) for v in self.terms)
291285

292-
def _evaluate(self, point):
293-
'''computes the value of the expression in the given variable-value mapping.'''
294-
return sum(term._evaluate(point)*coeff for term, coeff in self.terms.items() if coeff != 0)
295-
296286

297287
cdef class ExprCons:
298288
'''Constraints with a polynomial expressions and lower/upper bounds.'''

0 commit comments

Comments
 (0)