Skip to content

Commit e19851e

Browse files
authored
Merge branch 'master' into fix-updating-best-sol
2 parents 4f4817b + 5eecd95 commit e19851e

38 files changed

+1135
-220
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22

33
## Unreleased
44
### Added
5+
- More support for AND-Constraints
56
- 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
614
### Fixed
15+
- Raised an error when an expression is used when a variable is required
716
### Changed
17+
- MatrixExpr.sum() now supports axis arguments and can return either a scalar or MatrixExpr depending on the result dimensions
818
### Removed
919

1020
## 5.5.0 - 2025.05.06

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).

docs/build.rst

Lines changed: 9 additions & 0 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

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

docs/tutorials/branchrule.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ whose LP solution is most fractional.
5858
5959
return {"result": SCIP_RESULT.BRANCHED}
6060
61-
Let's talk about some features of this branching rule. Currently we only explicitly programmed
61+
Let's talk about some features of this branching rule. Currently, we only explicitly programmed
6262
a single function, which is called ``branchexeclp``. This is the function that gets called
6363
when branching on an LP optimal solution. While this is the main case, it is not the only
6464
case that SCIP handles. What if there was an LP error at the node, or you are given a set of external
@@ -108,7 +108,7 @@ strong branching or obtain some strong branching information.
108108

109109
- What happens if a new primal solution is found and the bound is larger than the cutoff bound?
110110
- What happens if the bound for one of the children is above a cutoff bound?
111-
- If probing is enabled then one would need to handle new found bounds appropriately.
111+
- If probing is enabled then one would need to handle new-found bounds appropriately.
112112

113113
.. code-block:: python
114114

docs/tutorials/constypes.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ constraint, you'd use the code:
134134
135135
SCIP also allows the creation of custom constraint handlers. These could be empty and just
136136
there to record data, there to provide custom handling of some user defined function, or they could be there to
137-
enforce a constraint that is incredibly inefficient to enforce via linear constraints.
137+
enforce a constraint that is incredibly inefficient to enforce via linear constraints.
138138
An example of such a constraint handler
139139
is presented in the lazy constraint tutorial for modelling the subtour elimination
140140
constraints :doc:`here </tutorials/lazycons>`
@@ -146,8 +146,8 @@ In a similar fashion to Variables with columns, see :doc:`this page </tutorials/
146146
constraints bring up an interesting feature of SCIP when used in the context of an LP.
147147
The context of an LP here means that we are after the LP relaxation of the optimization problem
148148
at some node. Is the constraint even in the LP?
149-
When you solve an optimization problm with SCIP, the problem is first transformed. This process is
150-
called presolve, and is done to accelerate the subsequent solving process. Therefore a constraint
149+
When you solve an optimization problem with SCIP, the problem is first transformed. This process is
150+
called presolve, and is done to accelerate the subsequent solving process. Therefore, a constraint
151151
that was originally created may have been transformed entirely, as the original variables that
152152
featured in the constraint have also been changed. Additionally, maybe the constraint was found to be redundant,
153153
i.e., trivially true, and was removed. The constraint is also much more general

0 commit comments

Comments
 (0)