gurobi-machinelearning


Namegurobi-machinelearning JSON
Version 1.5.2 PyPI version JSON
download
home_pageNone
Summarypackage to insert ML models in Gurobi
upload_time2024-11-09 14:37:57
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 No requirements were recorded.
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%203.12-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": null,
    "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": null,
    "download_url": "https://files.pythonhosted.org/packages/22/e8/eea7bea9dd22663c3e4c0f30337b119f4a7eb010a358956874b7fd9d0834/gurobi_machinelearning-1.5.2.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%203.12-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.2",
    "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": "397c53487a457aeeb29454fc84624f2322790542262f56e67546e72348955026",
                "md5": "f6ae35a32a82970aff13c11d8b3ab58f",
                "sha256": "d179c1bbcb010e23926927a05d9546023376837bbcbf4402cc20cb50f151afd9"
            },
            "downloads": -1,
            "filename": "gurobi_machinelearning-1.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f6ae35a32a82970aff13c11d8b3ab58f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 72311,
            "upload_time": "2024-11-09T14:37:55",
            "upload_time_iso_8601": "2024-11-09T14:37:55.724961Z",
            "url": "https://files.pythonhosted.org/packages/39/7c/53487a457aeeb29454fc84624f2322790542262f56e67546e72348955026/gurobi_machinelearning-1.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22e8eea7bea9dd22663c3e4c0f30337b119f4a7eb010a358956874b7fd9d0834",
                "md5": "f8b31c2c57618524870624ab5fa23c28",
                "sha256": "13f2f8bd40550bbd3b2dce705b6829986456b5407d88a835a5af1ea4b892ab01"
            },
            "downloads": -1,
            "filename": "gurobi_machinelearning-1.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f8b31c2c57618524870624ab5fa23c28",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 39761,
            "upload_time": "2024-11-09T14:37:57",
            "upload_time_iso_8601": "2024-11-09T14:37:57.512246Z",
            "url": "https://files.pythonhosted.org/packages/22/e8/eea7bea9dd22663c3e4c0f30337b119f4a7eb010a358956874b7fd9d0834/gurobi_machinelearning-1.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-09 14:37:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Gurobi",
    "github_project": "gurobi-machinelearning",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "gurobi-machinelearning"
}
        
Elapsed time: 1.19118s