automatically formulate and embed ML models into MIPs with SCIP
Project description
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, and PyTorch
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.
Please note that gurobipy
is commercial software and requires a license. When installed via pip or conda,
gurobipy
ships with a free license which is only for testing and can only solve models of limited size.
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 MLframeworks:
pip install pytest
pip install scikit-learn
pip install torch
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PySCIPOpt_ML-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f10b21d1c23495124dc3a7d19d4d5c51e1452de6fb13ac95642915d1a1abc30a |
|
MD5 | 2b54090d2a70fc62dac1dc34dd0a1848 |
|
BLAKE2b-256 | 2ff6323e1bdcc4108a2e151f912c8d0f40a635b9afdc4ba6df8d1cafdb26b191 |