Skip to content

Commit 401f629

Browse files
committed
Merge branch 'master' of https://github.com/scipopt/PySCIPOpt into SOS-1-constraints
2 parents c7af8c2 + ffbcfe8 commit 401f629

51 files changed

Lines changed: 1987 additions & 472 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/coverage.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ jobs:
4040
4141
- name: Install PySCIPOpt
4242
run: |
43-
export CFLAGS="-O0 -ggdb" # disable compiler optimizations for faster builds
44-
python -m pip install .
43+
export CFLAGS="-O0 -ggdb -Wall -Wextra -Werror" # Debug mode. More warnings. Warnings as errors.
44+
python -m pip install . -v 2>&1 | tee build.log
45+
grep -i "warning" build.log || true
4546
4647
- name: Run pyscipopt tests
4748
run: |

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,35 @@
22

33
## Unreleased
44
### Added
5-
- Added support for SOS1-constraints
5+
- More support for AND-Constraints
6+
- Added support for knapsack constraints
7+
- Added isPositive(), isNegative(), isFeasLE(), isFeasLT(), isFeasGE(), isFeasGT(), isHugeValue(), and tests
8+
- Added SCIP_LOCKTYPE, addVarLocksType(), getNLocksDown(), getNLocksUp(), getNLocksDownType(), getNLocksUpType(), and tests
9+
- Added addMatrixConsIndicator(), and tests
10+
- Added SCIPvarMarkRelaxationOnly, SCIPvarIsRelaxationOnly, SCIPvarMarkDeletable, SCIPvarIsDeletable, and tests
11+
- Wrapped SCIPgetNLPBranchCands
12+
- Added getConsVals() to get coefficients of any linear type constraint
13+
- Generalized getLhs() and getRhs() to additionally support any linear type constraint
14+
- Added recipe for getting local constraints
15+
- Added enableDebugSol() and disableDebugSol() for controlling the debug solution mechanism if DEBUGSOL=true
16+
### Fixed
17+
- Raised an error when an expression is used when a variable is required
18+
- Fixed some compile warnings
19+
### Changed
20+
- MatrixExpr.sum() now supports axis arguments and can return either a scalar or MatrixExpr depending on the result dimensions
21+
### Removed
22+
23+
## 5.5.0 - 2025.05.06
24+
### Added
25+
- Wrapped SCIPgetChildren and added getChildren and test (also test getOpenNodes)
26+
- Wrapped SCIPgetLeaves, SCIPgetNLeaves, and added getLeaves, getNLeaves and test
27+
- Wrapped SCIPgetSiblings, SCIPgetNSiblings, and added getSiblings, getNSiblings and test
28+
- Wrapped SCIPdeactivatePricer, SCIPsetConsModifiable, and added deactivatePricer, setModifiable and test
629
- Added getLinearConsIndicator
730
- Added SCIP_LPPARAM, setIntParam, setRealParam, getIntParam, getRealParam, isOptimal, getObjVal, getRedcost for lpi
831
- Added isFeasPositive
32+
- Added SCIP function SCIProwGetDualsol and wrapper getDualsol
33+
- Added SCIP function SCIProwGetDualfarkas and wrapper getDualfarkas
934
### Fixed
1035
- Fixed bug when accessing matrix variable attributes
1136
### Changed

INSTALL.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ If installing SCIP from source or using PyPI with a python and operating system
2626
you need to specify the install location using the environment variable
2727
`SCIPOPTDIR`:
2828

29-
- on Linux and OS X:\
29+
- on Linux and MacOS:\
3030
`export SCIPOPTDIR=<path_to_install_dir>`
3131
- on Windows:\
3232
`set SCIPOPTDIR=<path_to_install_dir>` (**cmd**, **Cmder**, **WSL**)\
@@ -45,8 +45,9 @@ contains the corresponding header files:
4545
> nlpi
4646
> ...
4747

48-
Please note that some Mac configurations require adding the library installation path to `DYLD_LIBRARY_PATH` when using a locally installed version of SCIP.
48+
On MacOS, to ensure that the SCIP dynamic library can be located at runtime by PySCIPOpt, you should add your SCIP installation path to the ``DYLD_LIBRARY_PATH`` environment variable by running:
4949

50+
`export DYLD_LIBRARY_PATH="<path_to_install_dir>/lib:$DYLD_LIBRARY_PATH"`
5051

5152
When building SCIP from source using Windows it is highly recommended to use the [Anaconda Python
5253
Platform](https://www.anaconda.com/).
@@ -56,6 +57,15 @@ Installation from PyPI
5657

5758
python -m pip install pyscipopt
5859

60+
To avoid interfering with system packages, it's best to use a [virtual environment](https://docs.python.org/3/library/venv.html).<br>
61+
<span style="color:orange">**Warning!**</span> This is mandatory in some newer configurations.
62+
63+
```bash
64+
python3 -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate pip install pyscipopt
65+
pip install pyscipopt
66+
```
67+
Remember to activate the environment (`source venv/bin/activate`) in each terminal session where you use PySCIPOpt.
68+
5969
Please note that if your Python version and OS version are in the combinations at the start of this INSTALL file then
6070
pip now automatically installs a pre-built version of SCIP. For these combinations, to use your own installation of SCIP,
6171
please see the section on building from source. For unavailable combinations this pip command will automatically
@@ -66,7 +76,7 @@ at runtime by adjusting your `PATH` environment variable:
6676

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

69-
On Linux and OS X this is encoded in the generated PySCIPOpt library and
79+
On Linux and MacOS this is encoded in the generated PySCIPOpt library and
7080
therefore not necessary.
7181

7282
Building everything from source

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,21 @@ See [CHANGELOG.md](https://github.com/scipopt/PySCIPOpt/blob/master/CHANGELOG.md
2323
Installation
2424
------------
2525

26-
The recommended installation method is via PyPI
26+
The recommended installation method is via [PyPI](https://pypi.org/project/PySCIPOpt/):
27+
28+
```bash
29+
pip install pyscipopt
30+
```
31+
32+
To avoid interfering with system packages, it's best to use a [virtual environment](https://docs.python.org/3/library/venv.html):
33+
2734
```bash
35+
python3 -m venv venv # creates a virtual environment called venv
36+
source venv/bin/activate # activates the environment. On Windows use: venv\Scripts\activate
2837
pip install pyscipopt
2938
```
39+
Remember to activate the environment (`source venv/bin/activate` or equivalent) in each terminal session where you use PySCIPOpt.
40+
Note that some configurations require the use of virtual environments.
3041

3142
For information on specific versions, installation via Conda, and guides for building from source,
3243
please see the [online documentation](https://pyscipopt.readthedocs.io/en/latest/install.html).

RELEASE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Release Checklist
22
The following are the steps to follow to make a new PySCIPOpt release. They should mostly be done in order.
33
- [ ] Check if [scipoptsuite-deploy](https://github.com/scipopt/scipoptsuite-deploy) needs a new release, if a new SCIP version is released for example, or new dependencies (change symmetry dependency, add support for papilo/ parallelization.. etc). And Update release links in `pyproject.toml`
4-
- [ ] Check if the table in [readme](https://github.com/scipopt/PySCIPOpt#installation) needs to be updated.
4+
- [ ] Check if the table in the [documentation](https://pyscipopt.readthedocs.io/en/latest/build.html#building-from-source) needs to be updated.
55
- [ ] Update version number according to semantic versioning [rules](https://semver.org/) in `src/pyscipopt/_version.py` and `setup.py`
6-
- [ ] Update `CHANGELOG.md`; Change the `Unlreased` to the new version number and add an empty unreleased section.
6+
- [ ] Update `CHANGELOG.md`; Change the `Unreleased` to the new version number and add an empty unreleased section.
77
- [ ] Create a release candidate on test-pypi by running the workflow “Build wheels” in Actions->build wheels, with these parameters `upload:true, test-pypi:true` 
88
- [ ] If the pipeline passes, test the released pip package on test-pypi by running and checking that it works
99
```bash
1010
pip install -i https://test.pypi.org/simple/ PySCIPOpt
1111
```
1212
- [ ] If it works, release on pypi.org with running the same workflow but with `test-pypi:false`.
13-
- [ ] Then create a tag wit the new version (from the master branch)
13+
- [ ] Then create a tag with the new version (from the master branch)
1414
```bash
1515
git tag vX.X.X
1616
git push origin vX.X.X

docs/build.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ For Linux and MacOS systems set the variable with the following command:
100100
101101
export SCIPOPTDIR=<path_to_install_dir>
102102
103+
.. note::
104+
105+
For macOS users, to ensure that the SCIP dynamic library can be found at runtime by PySCIPOpt,
106+
you should add your SCIP installation path to the ``DYLD_LIBRARY_PATH`` environment variable by running:
107+
108+
.. code-block::
109+
110+
export DYLD_LIBRARY_PATH="<path_to_install_dir>/lib:$DYLD_LIBRARY_PATH"
111+
103112
For Windows use the following command:
104113

105114
.. code-block:: bash
@@ -159,8 +168,10 @@ Build with Debug
159168
To use debug information in PySCIPOpt you need to build it with the following command:
160169

161170
.. code-block::
162-
163-
python -m pip install --install-option="--debug" .
171+
172+
export CFLAGS="-UNDEBUG"
173+
export CXXFLAGS="-UNDEBUG"
174+
python -m pip install .
164175
165176
.. note:: Be aware that you will need the debug library of the SCIP Optimization Suite for this to work
166177
(cmake .. -DCMAKE_BUILD_TYPE=Debug).

docs/extend.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Code contributions are very welcome and should comply to a few rules:
4444
- Before implementing a new PySCIPOpt feature, check whether the
4545
feature exists in SCIP. If so, implement it as a pure wrapper,
4646
mimicking SCIP whenever possible. If the new feature does not exist
47-
in SCIP but it is close to an existing one, consider if implementing
47+
in SCIP, but it is close to an existing one, consider if implementing
4848
that way is substantially convenient (e.g. Pythonic). If it does
4949
something completely different, you are welcome to pull your request
5050
and discuss the implementation.
@@ -77,7 +77,7 @@ API. By design, we distinguish different functions in PySCIPOPT:
7777
Ideally speaking, we want every SCIP function to be wrapped in PySCIPOpt.
7878

7979
**Convenience functions** are additional, non-detrimental features meant
80-
to help prototyping the Python way. Since these functions are not in
80+
to help prototype the Python way. Since these functions are not in
8181
SCIP, we wish to limit them to prevent difference in features between
8282
SCIP and PySCIPOPT, which are always difficult to maintain. A few
8383
convenience functions survive in PySCIPOpt when keeping them is

docs/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ is not automatically deleted, and thus stops a new optimization call.
6060
Why can I not add a non-linear objective?
6161
=========================================
6262

63-
SCIP does not support non-linear objectives, however, an equivalent optimization
63+
SCIP does not support non-linear objectives. However, an equivalent optimization
6464
problem can easily be constructed by introducing a single new variable and a constraint.
6565
Please see :doc:`this page <tutorials/expressions>` for a guide.

docs/install.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ To install PySCIPOpt simply run the command:
2121
2222
pip install pyscipopt
2323
24+
To avoid interfering with system packages, it's best to use a `virtual environment <https://docs.python.org/3/library/venv.html>`.
25+
26+
.. warning::
27+
28+
Using a virtual environment is **mandatory** in some newer Python configurations
29+
to avoid permission and package conflicts.
30+
31+
.. code-block:: bash
32+
python3 -m venv venv
33+
source venv/bin/activate # On Windows use: venv\Scripts\activate
34+
pip install pyscipopt
35+
36+
Remember to activate the environment (``source venv/bin/activate``) in each terminal session where you use PySCIPOpt.
37+
2438
.. note:: For Linux users: PySCIPOpt versions newer than 5.1.1 installed via PyPI now require glibc 2.28+
2539

2640
For our build infrastructure we use `manylinux <https://github.com/pypa/manylinux>`_.

docs/similarsoftware.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Alternate MIP Solvers (with Python interfaces)
99

1010
In the following we will give a list of other mixed-integer optimizers with available python interfaces.
1111
As each solver has its own set of problem classes that it can solve we will use a table with reference
12-
keys to summarise these problem classes.
12+
keys to summarize these problem classes.
1313

1414
.. note:: This table is by no means complete.
1515

@@ -87,8 +87,8 @@ This is software that is built on PySCIPOpt
8787

8888
- `PyGCGOpt <https://github.com/scipopt/PyGCGOpt>`_: An extension of SCIP, using generic decompositions for solving MIPs
8989
- `GeCO <https://github.com/CharJon/GeCO>`_: Generators for Combinatorial Optimization
90-
- `scip-routing <https://github.com/mmghannam/scip-routing>`_: An exact VRPTW solver in Python
91-
- `PySCIPOpt-ML <https://github.com/Opt-Mucca/PySCIPOpt-ML>`_: Python interface to automatically formulate Machine Learning models into Mixed-Integer Programs
90+
- `scip-routing <https://github.com/mmghannam/scip-routing>`_: An exact VRPTW solver in Python
91+
- `PySCIPOpt-ML <https://github.com/Opt-Mucca/PySCIPOpt-ML>`_: Python interface to automatically formulate Machine Learning models into Mixed-Integer Programs
9292
- `SCIP Book <https://scipbook.readthedocs.io/en/latest/>`_: Mathematical Optimization: Solving Problems using SCIP and Python
9393

9494
Additional SCIP Resources

0 commit comments

Comments
 (0)