Skip to main content

Embed tensorflow ReLU neural networks in MIP optimization problems.

Project description

reluMIP

Embed ReLU neural networks into mixed-integer programs.

About

With this package, you can generate mixed-integer linear programming (MIP) models of trained artificial neural networks (ANNs) using the rectified liner unit (ReLU) activation function. At the moment, only TensorFlow sequential models are supported. Interfaces to either the Pyomo or Gurobi modelling environments are offered.

ReLU ANNs can be used to approximate complex functions from data. In order to embed these functions into optimization problems, strong formulations of the network are needed. This package employs progressive bound tightening procedures to produce MIP encodings for ReLU networks. This allows the user to embed complex and nonlinear functions into mixed-integer programs. Note that the training of ReLU ANNs is not part of this package and has to be done by the user beforehand. A number of illustrative examples are provided to showcase the functionality of this package. For more detailed information, see the slide show in the docs/ folder of the reluMIP Git repository.

Installation

This package is part of PyPI. It can be installed through pip:

pip install reluMIP

After installing, you can use the examples provided in the examples/ folder to become familiar with the package.

Alternatively, you can clone the github repository:

git clone https://github.com/ChemEngAI/ReLU_ANN_MILP.git

You can install all requirements from the project root folder by calling:

pip install -r requirements.txt

You can add the root folder of the repository to your PYTHON_PATH, so that the package can be accessed from anywhere.

Note that in order to use the package, a compatible solver has to be installed. This can be Gurobi (with a valid license) or any MIP solver compatible with Pyomo (we recommend glpk). In our experience, the best performance is obtained when using the Gurobi interface.

Example usages

Two jupyter notebooks describing the use of the package are supplied in the examples/ folder of the Git repository. There, an MIP formulation of a ReLU ANN - trained on a nonliner, nonconvex function - is used to find the global minimum of the network response surface. If you installed the package through pip, you can simply download the example files that you are interested in.

Related work on NLP formulations of ANNs

In this tool, ReLU ANNs are formulated as MILPs. Notably, ANNs can also be formulated as nonlinear problems (NLPs) and solved through deterministic gloabl optimization (Schweidtmann and Mitsos (2019)). Please visit the MeLOn toolbox for more information.

How to cite this work

Please cite our Zenodo DOI if you use this code:

@software{reluMIP.2021,
  title={reluMIP: Open Source Tool for MILP Optimization of ReLU Neural Networks},
  author={Lueg, Laurens and Grimstad, Bjarne and Mitsos, Alexander and Schweidtmann, Artur M.},
  year={2021},
  doi={https://doi.org/10.5281/zenodo.5601907},
  url = {https://github.com/ChemEngAI/ReLU_ANN_MILP},
  version = {1.0.0}
}

References

Grimstad, B., Andersson, H. (2019). ReLU networks as surrogate models in mixed-integer linear programs. Computers & Chemical Engineering (Volume 131, 106580).

Schweidtmann, A. M., & Mitsos, A. (2019). Deterministic global optimization with artificial neural networks embedded. Journal of Optimization Theory and Applications (Volume 180(3), 925-948).

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

reluMIP-1.0.0.tar.gz (229.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reluMIP-1.0.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file reluMIP-1.0.0.tar.gz.

File metadata

  • Download URL: reluMIP-1.0.0.tar.gz
  • Upload date:
  • Size: 229.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for reluMIP-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cb016417b0bba2a8dd526acb33357d462be6615d3b5e7a74d76c560781bf260b
MD5 d7ae616239263cdd5fe15ac8c626dd5d
BLAKE2b-256 7b4be400e0224ce4202f6aa3e2c35a76abd8658d79c2427580c6e4fddb2a88fe

See more details on using hashes here.

File details

Details for the file reluMIP-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: reluMIP-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for reluMIP-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea89c36b98f06bbbbe351645564900fe2fda282395394789e15456b4c57ca042
MD5 6b95e68ac8c055ea1fa6e59efe243645
BLAKE2b-256 c0c318554574b3578f049d0105e1240012c166f692cf0050068feb3a2eaf3fd6

See more details on using hashes here.

Supported by

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