Skip to content

Commit 91f1923

Browse files
committed
Merge branch 'master' of https://github.com/scipopt/PySCIPOpt into AND-constraints
2 parents 178a850 + bc0e229 commit 91f1923

32 files changed

Lines changed: 548 additions & 204 deletions

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
## Unreleased
44
### Added
5-
- Added support for knapsack constraints
65
- 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
79
### Fixed
10+
- Raised an error when an expression is used when a variable is required
811
### Changed
912
### Removed
1013

INSTALL.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ Installation from PyPI
5656

5757
python -m pip install pyscipopt
5858

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

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/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

docs/tutorials/cutselector.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ A cut selector in PySCIPOpt takes the following structure:
3333
"""
3434
:param cuts: the cuts which we want to select from. Is a list of scip Rows
3535
:param forcedcuts: the cuts which we must add. Is a list of scip Rows
36-
:param root: boolean indicating whether weare at the root node
36+
:param root: boolean indicating whether we are at the root node
3737
:param maxnselectedcuts: int which is the maximum amount of cuts that can be selected
3838
:return: sorted cuts and forcedcuts
3939
"""
@@ -58,14 +58,14 @@ To include a cut selector one would need to do something like the following code
5858
5959
The final argument of the ``includeCutsel`` function in the example above was the
6060
priority. If the priority is higher than all other cut selectors then it will be called
61-
first. In the case of some failure or non-success return code, then the second highest
61+
first. In the case of some failure or non-success return code, then the second-highest
6262
priority cut selector is called and so on.
6363

6464
Example Cut Selector
6565
======================
6666

6767
In this example we will program a cut selector that selects the 10 most
68-
efficacious cuts. Efficacy is the standard measure for cut quality and can be calcuated
68+
efficacious cuts. Efficacy is the standard measure for cut quality and can be calculated
6969
via SCIP directly.
7070

7171
.. code-block:: python

0 commit comments

Comments
 (0)