gurobi-machinelearning


Namegurobi-machinelearning JSON
Version 1.5.0 PyPI version JSON
download
home_page
Summarypackage to insert ML models in Gurobi
upload_time2024-03-06 14:47:27
maintainerPierre Bonami
docs_urlNone
authorGurobi Optimization LLC
requires_python>=3.9
licenseApache-2.0
keywords mathematical optimization gurobi scikit-learn pytorch tensorflow ml
VCS
bugtrack_url
requirements gurobipy numpy pandas scikit-learn seaborn
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![build and test](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/push.yml/badge.svg?branch=main)](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/push.yml?query=branch%3Amain++)
[![build wheel](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/build_wheel.yml/badge.svg?branch=main)](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/build_wheel.yml?query=branch%3Amain++)
![Python versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11-blue)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI](https://img.shields.io/pypi/v/gurobi-machinelearning)](https://pypi.org/project/gurobi-machinelearning)
[![ReadTheDocs](https://readthedocs.com/projects/gurobi-optimization-gurobi-machine-learning/badge/?version=stable)](https://gurobi-optimization-gurobi-machine-learning.readthedocs-hosted.com)
[![Gurobi-forum](https://img.shields.io/badge/Help-Gurobi--Forum-red)](https://support.gurobi.com/hc/en-us/community/topics/10373864542609-GitHub-Projects)

[![Gurobi](https://raw.githubusercontent.com/Gurobi/gurobi-machinelearning/main/docs/source/_static/gurobi_light.png)](https://www.gurobi.com)


# Gurobi Machine Learning

Gurobi Machine Learning is an [open-source](https://gurobi-machinelearning.readthedocs.io/en/latest/meta/license.html) python package to formulate trained regression models in a [`gurobipy`](https://pypi.org/project/gurobipy/) model to be solved with the Gurobi solver.

The package currently supports various [scikit-learn](https://scikit-learn.org/stable/) objects. It has limited support for the [Keras](https://keras.io/) API of [TensorFlow](https://www.tensorflow.org/), [PyTorch](https://pytorch.org/) and [XGBoost](https://www.xgboost.ai). Only neural networks with ReLU activation can be used with Keras and PyTorch.

# Documentation

The latest user manual is available on [readthedocs](https://gurobi-machinelearning.readthedocs.io/).

# Contact us

For questions related to using Gurobi Machine Learning please use [Gurobi's Forum](https://support.gurobi.com/hc/en-us/community/topics/10373864542609-GitHub-Projects).

For reporting bugs, issues and feature requests please
[open an issue](https://github.com/Gurobi/gurobi-machinelearning/issues).

If you encounter issues with Gurobi or ``gurobipy`` please contact
[Gurobi Support](https://support.gurobi.com/hc/en-us).

# Installation

## Dependencies

`gurobi-machinelearning` requires the following:
- Python >= 3.9
- [`numpy`](https://pypi.org/project/numpy/) >= 1.23.0
- [`gurobipy`](https://pypi.org/project/gurobipy/) >= 10.0
- [`scipy`](https://pypi.org/project/scipy/) >= 1.9.3

The current version supports the following ML packages:
- [`torch`](https://pypi.org/project/torch/)
- [`scikit-learn`](https://pypi.org/project/scikit-learn)
- [`tensorflow`](https://pypi.org/project/tensorflow)
- [`XGBoost`](https://pypi.org/project/xgboost/)

Installing these packages is only required if the predictor you want to insert uses them
(i.e. to insert a Keras based predictor you need to have `tensorflow` installed).

The up to date supported and tested versions of each package for the last release can be
[found in the documentation](https://gurobi-machinelearning.readthedocs.io/en/stable/user/start.html#id7).

## Pip installation

The easiest way to install `gurobi-machinelearning` is using `pip` in a virtual environment:
```shell
(.venv) pip install gurobi-machinelearning
```
This will also install the `numpy`, `scipy` and `gurobipy` 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.

# Getting a Gurobi License
Alternatively to the bundled limited license, there are licenses that can handle models of all sizes.

As a student or staff member of an academic institution you qualify for a free, full product license.
For more information, see:

* https://www.gurobi.com/academia/academic-program-and-licenses/

For a commercial evaluation, you can
[request an evaluation license](https://www.gurobi.com/free-trial/?utm_source=internal&utm_medium=documentation&utm_campaign=fy21_pipinstall_eval_pypipointer&utm_content=c_na&utm_term=pypi).

Other useful resources to get started:
* https://www.gurobi.com/documentation/
* https://support.gurobi.com/hc/en-us/community/topics/

# Development
We value any level of experience in using Gurobi Machine Learning and would like to encourage you to
contribute directly to this project. Please see the [Contributing Guide](CONTRIBUTING.md) for more information.

## Source code
You can clone the latest sources with the command:
```shell
git clone git@github.com:Gurobi/gurobi-machinelearning.git
```

## Testing
After cloning the project, you can run the tests by invoking `tox`. For this, you will need to create a virtual
environment and activate it:
```shell
python3.10 -m venv .venv
. .venv/bin/activate
```
Then, you can install `tox` (>= 3.26.0) and run a few basic tests:
```shell
(.venv) pip install tox
(.venv) tox -e py310,pre-commit,docs
```
`tox` will install, among others, the aforementioned ML packages into a separate `venv`. These packages can be quite
large, so this might take a while.

### Running the full test set
In the above command, we only ran a subset of tests. Running the full set of tests requires having a Gurobi license
installed, and is done by running just the `tox` command without the `-e` parameter:

```shell
(.venv) pip install tox
(.venv) tox
```

If you don't have a Gurobi license, you can still run the subset of tests, open a PR, and Github Actions will run the
tests with a full Gurobi license.

## Submitting a Pull Request
Before opening a Pull Request, have a look at the full [Contributing page](CONTRIBUTING.md) to make sure your code
complies with our guidelines.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "gurobi-machinelearning",
    "maintainer": "Pierre Bonami",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "bonami@gurobi.com",
    "keywords": "mathematical optimization,gurobi,scikit-learn,pytorch,tensorflow,ml",
    "author": "Gurobi Optimization LLC",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/be/cb/90c9a8723195cd89dbf3a9e00ab41c57305bae8b6854cbad41849a369298/gurobi-machinelearning-1.5.0.tar.gz",
    "platform": null,
    "description": "[![build and test](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/push.yml/badge.svg?branch=main)](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/push.yml?query=branch%3Amain++)\n[![build wheel](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/build_wheel.yml/badge.svg?branch=main)](https://github.com/Gurobi/gurobi-machinelearning/actions/workflows/build_wheel.yml?query=branch%3Amain++)\n![Python versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11-blue)\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![PyPI](https://img.shields.io/pypi/v/gurobi-machinelearning)](https://pypi.org/project/gurobi-machinelearning)\n[![ReadTheDocs](https://readthedocs.com/projects/gurobi-optimization-gurobi-machine-learning/badge/?version=stable)](https://gurobi-optimization-gurobi-machine-learning.readthedocs-hosted.com)\n[![Gurobi-forum](https://img.shields.io/badge/Help-Gurobi--Forum-red)](https://support.gurobi.com/hc/en-us/community/topics/10373864542609-GitHub-Projects)\n\n[![Gurobi](https://raw.githubusercontent.com/Gurobi/gurobi-machinelearning/main/docs/source/_static/gurobi_light.png)](https://www.gurobi.com)\n\n\n# Gurobi Machine Learning\n\nGurobi Machine Learning is an [open-source](https://gurobi-machinelearning.readthedocs.io/en/latest/meta/license.html) python package to formulate trained regression models in a [`gurobipy`](https://pypi.org/project/gurobipy/) model to be solved with the Gurobi solver.\n\nThe package currently supports various [scikit-learn](https://scikit-learn.org/stable/) objects. It has limited support for the [Keras](https://keras.io/) API of [TensorFlow](https://www.tensorflow.org/), [PyTorch](https://pytorch.org/) and [XGBoost](https://www.xgboost.ai). Only neural networks with ReLU activation can be used with Keras and PyTorch.\n\n# Documentation\n\nThe latest user manual is available on [readthedocs](https://gurobi-machinelearning.readthedocs.io/).\n\n# Contact us\n\nFor questions related to using Gurobi Machine Learning please use [Gurobi's Forum](https://support.gurobi.com/hc/en-us/community/topics/10373864542609-GitHub-Projects).\n\nFor reporting bugs, issues and feature requests please\n[open an issue](https://github.com/Gurobi/gurobi-machinelearning/issues).\n\nIf you encounter issues with Gurobi or ``gurobipy`` please contact\n[Gurobi Support](https://support.gurobi.com/hc/en-us).\n\n# Installation\n\n## Dependencies\n\n`gurobi-machinelearning` requires the following:\n- Python >= 3.9\n- [`numpy`](https://pypi.org/project/numpy/) >= 1.23.0\n- [`gurobipy`](https://pypi.org/project/gurobipy/) >= 10.0\n- [`scipy`](https://pypi.org/project/scipy/) >= 1.9.3\n\nThe current version supports the following ML packages:\n- [`torch`](https://pypi.org/project/torch/)\n- [`scikit-learn`](https://pypi.org/project/scikit-learn)\n- [`tensorflow`](https://pypi.org/project/tensorflow)\n- [`XGBoost`](https://pypi.org/project/xgboost/)\n\nInstalling these packages is only required if the predictor you want to insert uses them\n(i.e. to insert a Keras based predictor you need to have `tensorflow` installed).\n\nThe up to date supported and tested versions of each package for the last release can be\n[found in the documentation](https://gurobi-machinelearning.readthedocs.io/en/stable/user/start.html#id7).\n\n## Pip installation\n\nThe easiest way to install `gurobi-machinelearning` is using `pip` in a virtual environment:\n```shell\n(.venv) pip install gurobi-machinelearning\n```\nThis will also install the `numpy`, `scipy` and `gurobipy` dependencies.\n\nPlease note that `gurobipy` is commercial software and requires a license. When installed via pip or conda,\n`gurobipy` ships with a free license which is only for testing and can only solve models of limited size.\n\n# Getting a Gurobi License\nAlternatively to the bundled limited license, there are licenses that can handle models of all sizes.\n\nAs a student or staff member of an academic institution you qualify for a free, full product license.\nFor more information, see:\n\n* https://www.gurobi.com/academia/academic-program-and-licenses/\n\nFor a commercial evaluation, you can\n[request an evaluation license](https://www.gurobi.com/free-trial/?utm_source=internal&utm_medium=documentation&utm_campaign=fy21_pipinstall_eval_pypipointer&utm_content=c_na&utm_term=pypi).\n\nOther useful resources to get started:\n* https://www.gurobi.com/documentation/\n* https://support.gurobi.com/hc/en-us/community/topics/\n\n# Development\nWe value any level of experience in using Gurobi Machine Learning and would like to encourage you to\ncontribute directly to this project. Please see the [Contributing Guide](CONTRIBUTING.md) for more information.\n\n## Source code\nYou can clone the latest sources with the command:\n```shell\ngit clone git@github.com:Gurobi/gurobi-machinelearning.git\n```\n\n## Testing\nAfter cloning the project, you can run the tests by invoking `tox`. For this, you will need to create a virtual\nenvironment and activate it:\n```shell\npython3.10 -m venv .venv\n. .venv/bin/activate\n```\nThen, you can install `tox` (>= 3.26.0) and run a few basic tests:\n```shell\n(.venv) pip install tox\n(.venv) tox -e py310,pre-commit,docs\n```\n`tox` will install, among others, the aforementioned ML packages into a separate `venv`. These packages can be quite\nlarge, so this might take a while.\n\n### Running the full test set\nIn the above command, we only ran a subset of tests. Running the full set of tests requires having a Gurobi license\ninstalled, and is done by running just the `tox` command without the `-e` parameter:\n\n```shell\n(.venv) pip install tox\n(.venv) tox\n```\n\nIf you don't have a Gurobi license, you can still run the subset of tests, open a PR, and Github Actions will run the\ntests with a full Gurobi license.\n\n## Submitting a Pull Request\nBefore opening a Pull Request, have a look at the full [Contributing page](CONTRIBUTING.md) to make sure your code\ncomplies with our guidelines.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "package to insert ML models in Gurobi",
    "version": "1.5.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/Gurobi/gurobi-machinelearning/issues",
        "Documentation": "https://gurobi-optimization-gurobi-machine-learning.readthedocs-hosted.com",
        "Repository": "https://github.com/Gurobi/gurobi-machinelearning"
    },
    "split_keywords": [
        "mathematical optimization",
        "gurobi",
        "scikit-learn",
        "pytorch",
        "tensorflow",
        "ml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27a156379675c1aa126d5ee6640c430b4b68c2d5aa3fb846f9d3fc8b42332bd9",
                "md5": "fbe79bf63eaa9f79e72f3596aeeca64c",
                "sha256": "cddaee3ec245e7e6855a27ed787cc7044cae0be0f9b5c1c0246fe5633cdfca2a"
            },
            "downloads": -1,
            "filename": "gurobi_machinelearning-1.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fbe79bf63eaa9f79e72f3596aeeca64c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 70850,
            "upload_time": "2024-03-06T14:47:25",
            "upload_time_iso_8601": "2024-03-06T14:47:25.713593Z",
            "url": "https://files.pythonhosted.org/packages/27/a1/56379675c1aa126d5ee6640c430b4b68c2d5aa3fb846f9d3fc8b42332bd9/gurobi_machinelearning-1.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "becb90c9a8723195cd89dbf3a9e00ab41c57305bae8b6854cbad41849a369298",
                "md5": "9d6b3971c3c0e1eb73024561573ecabc",
                "sha256": "59ad1e3ac116f14f484740d6a679e51ee2067b5b571289d31d72659d8d2621c8"
            },
            "downloads": -1,
            "filename": "gurobi-machinelearning-1.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9d6b3971c3c0e1eb73024561573ecabc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 38837,
            "upload_time": "2024-03-06T14:47:27",
            "upload_time_iso_8601": "2024-03-06T14:47:27.707975Z",
            "url": "https://files.pythonhosted.org/packages/be/cb/90c9a8723195cd89dbf3a9e00ab41c57305bae8b6854cbad41849a369298/gurobi-machinelearning-1.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-06 14:47:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Gurobi",
    "github_project": "gurobi-machinelearning",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "gurobipy",
            "specs": [
                [
                    "==",
                    "11.0.1"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.26.4"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "2.2.1"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    "==",
                    "1.4.1.post1"
                ]
            ]
        },
        {
            "name": "seaborn",
            "specs": [
                [
                    "==",
                    "0.13.2"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "gurobi-machinelearning"
}
        
Elapsed time: 0.22749s