pyscipopt-ml
Python interface to automatically formulate Machine Learning models into Mixed-Integer Programs
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.9%) to scientific vocabulary
Keywords
Repository
Python interface to automatically formulate Machine Learning models into Mixed-Integer Programs
Basic Info
- Host: GitHub
- Owner: Opt-Mucca
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://pyscipopt-ml.readthedocs.io/en/latest/
- Size: 2.55 MB
Statistics
- Stars: 32
- Watchers: 3
- Forks: 2
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md

PySCIPOpt-ML
PySCIPOpt-ML is a python interface to automatically formulate Machine Learning (ML) models into Mixed-Integer Programs (MIPs). PySCIPOPT-ML allows users to easily optimise MIPs with embedded ML constraints.
The package currently supports various ML objects from Scikit-Learn, XGBoost, LightGBM, PyTorch, Keras, and ONNX.

Documentation
The latest user manual is available on readthedocs.
Contact us
For reporting bugs, issues and feature requests please open an issue.
Installation
Dependencies
pyscipopt-ml requires the following:
- Python >= 3.8
- numpy >= 1.23.0
- pyscipopt >= 5.4.1
The current version supports the following ML packages:
- torch
- keras
- scikit-learn
- XGBoost
- LightGBM
- onnx
Installing these packages is only required if the predictor you want to insert uses them
(i.e. to insert a XGBoost based predictor you need to have xgboost installed).
Pip installation
The easiest way to install PySCIPOpt-ML is using pip.
It is recommended to always install packages in a virtual environment:
shell
(venv) pip install pyscipopt-ml
This will also install the numpy and pyscipopt dependencies.
Installation from source
An alternative way to install PySCIPOpt-ML is from source. First this repository
needs to be cloned. This can be achieved via HTTPS with:
shell
git clone https://github.com/Opt-Mucca/PySCIPOpt-ML/
and SHH with
shell
git clone git@github.com:Opt-Mucca/PySCIPOpt-ML.git
After cloning the repository entering the directory where it was cloned, one can run the command:
shell
(venv) python -m pip install .
Development
This project is completely open to any contributions. Feel free to implement your own functionalities.
Before committing anything, please install pytest, pre-commit, and all ML frameworks:
shell
pip install pytest
pip install scikit-learn
pip install torch
pip install tensorflow
pip install xgboost
pip install lightgbm
pip install onnx
pip install onnxruntime
pip install pre-commit
pre-commit install
Source code
You can clone the latest sources with the command:
shell
git clone git@github.com:Opt-Mucca/PySCIPOpt-ML.git
Documentation
You can build the documentation locally with the command
shell
pip install -r docs/requirements.txt
sphinx-build docs docs/_build
Às the documentation requires additional python packages, one should run the following command
before building the documentation for the first time:
shell
(venv) pip install -r docs/requirements.txt
Testing
After cloning the project, you can run the tests by invoking pytest. For this, you will need to create a virtual
environment and activate it. Please also make sure to append your python path:
shell
python -m venv venv
source venv/bin/activate
export PYTHONPATH="$(pwd):${PYTHONPATH}"
Then, you can install pytest and run a few basic tests:
shell
(venv) pip install pytest
(venv) pytest
How to cite this work
If this software was used for academic purposes, please cite our paper with the below information:
@misc{turner2024pyscipoptmlembeddingtrainedmachine,
title={PySCIPOpt-ML: Embedding Trained Machine Learning Models into Mixed-Integer Programs},
author={Mark Turner and Antonia Chmiela and Thorsten Koch and Michael Winkler},
year={2024},
eprint={2312.08074},
archivePrefix={arXiv},
primaryClass={math.OC},
url={https://arxiv.org/abs/2312.08074},
}
Acknowledgements
This code base was heavily inspired by Gurobi-MachineLearning. The API and general architecture was made to match, so that users could easily transfer between one to the other. If there is a feature missing here, or you are looking for alternatives, then give it a try!
Funding Acknowledgements
The work for this article has been conducted in the Research Campus MODAL funded by the German Federal Ministry of Education and Research (BMBF) (fund numbers 05M14ZAM, 05M20ZBM).
Owner
- Name: Mark Turner
- Login: Opt-Mucca
- Kind: user
- Location: Berlin
- Company: Zuse Institute Berlin
- Repositories: 7
- Profile: https://github.com/Opt-Mucca
Post-Doc at ZIB
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: PySCIPOpt-ML
url: https://github.com/Opt-Mucca/PySCIPOpt-ML
preferred-citation:
type: article
authors:
- family-names: "Turner"
given-names: "Mark"
orcid: "https://orcid.org/0000-0001-7270-1496"
- family-names: "Chmiela"
given-names: "Antonia"
orcid: "https://orcid.org/0000-0002-4809-2958"
- family-names: "Koch"
given-names: "Thorsten"
orcid: "https://orcid.org/0000-0002-1967-0077"
- family-names: "Winkler"
given-names: "Michael"
title: "PySCIPOpt-ML: Embedding Trained Machine Learning Models into Mixed-Integer Programs"
doi: 10.48550/arXiv.2312.08074
date-released: 2023-12-13
url: "https://arxiv.org/abs/2312.08074"
GitHub Events
Total
- Watch event: 8
- Push event: 4
- Fork event: 1
- Create event: 1
Last Year
- Watch event: 8
- Push event: 4
- Fork event: 1
- Create event: 1
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Mark Turner | t****r@z****e | 66 |
| Mark Turner | 6****a | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 0
- Total pull requests: 8
- Average time to close issues: N/A
- Average time to close pull requests: about 2 hours
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 19 hours
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- Opt-Mucca (13)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 176 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 11
- Total maintainers: 1
pypi.org: pyscipopt-ml
automatically formulate and embed ML models into MIPs with SCIP
- Documentation: https://pyscipopt-ml.readthedocs.io/en/stable/
- License: Apache-2.0
-
Latest release: 1.4.1
published 10 months ago
Rankings
Maintainers (1)
Dependencies
- sphinx *
- sphinx-rtd-theme *
- sphinxcontrib-bibtex *
- numpy *
- pyscipopt ==4.4.0