Skip to main content

automatically formulate and embed ML models into MIPs with SCIP

Project description

Python versions Black PyPI

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, and Keras

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:

The current version supports the following ML packages:

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:

(venv) pip install pyscipopt-ml

This will also install the numpy, 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:

git clone https://github.com/Opt-Mucca/PySCIPOpt-ML/

and SHH with

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:

(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:

pip install pytest
pip install scikit-learn
pip install torch
pip install tensorflow
pip install xgboost
pip install lightgbm
pip install pre-commit
pre-commit install

Source code

You can clone the latest sources with the command:

git clone git@github.com:Opt-Mucca/PySCIPOpt-ML.git

Documentation

You can build the documentation locally with the command

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:

(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:

python -m venv venv
source venv/bin/activate
export PYTHONPATH="$(pwd):${PYTHONPATH}"

Then, you can install pytest and run a few basic tests:

(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:

@article{turner2023pyscipopt,
  title={PySCIPOpt-ML: Embedding Trained Machine Learning Models into Mixed-Integer Programs},
  author={Turner, Mark and Chmiela, Antonia and Koch, Thorsten and Winkler, Michael},
  journal={arXiv preprint arXiv:2312.08074},
  year={2023}
}

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyscipopt_ml-1.2.0.tar.gz (69.3 kB view details)

Uploaded Source

Built Distribution

PySCIPOpt_ML-1.2.0-py3-none-any.whl (70.4 kB view details)

Uploaded Python 3

File details

Details for the file pyscipopt_ml-1.2.0.tar.gz.

File metadata

  • Download URL: pyscipopt_ml-1.2.0.tar.gz
  • Upload date:
  • Size: 69.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for pyscipopt_ml-1.2.0.tar.gz
Algorithm Hash digest
SHA256 8a603ec6b298ad6a43239b547f2e498e4141a313212c104989f75576c243b3bf
MD5 5aa0da2632d4ea86ae09664a773a0d66
BLAKE2b-256 4719b63dc84fa1136834d4e79a0c410a5f62ee405505fbeb46f9f0bee4d7c919

See more details on using hashes here.

File details

Details for the file PySCIPOpt_ML-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: PySCIPOpt_ML-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 70.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for PySCIPOpt_ML-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09547692e119cca7f6c8b2be24695676397f6b6b296bfdd7561da25a1ef14e57
MD5 4be4ff971d6fb42cdb46f332bf8a961c
BLAKE2b-256 145c640e89946e6b223e25a6c720385e15ff34cf2d8f3dc76fbb0d114bcf8eb2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page