Skip to main content

Inverse Optimization with Python

Project description

InvOpt: Inverse Optimization with Python

InvOpt is a Python package for solving Inverse Optimization (IO) problems. In IO problems, our goal is to model the behavior of an expert agent, which given an exogenous signal, returns a response action. The underlying assumption of IO is that to compute its response, the expert agent solves an optimization problem parametric in the exogenous signal. We assume to know the constraints imposed on the expert, but not its cost function. Therefore, our goal is to model the cost function being optimized by the expert, using examples of exogenous signals and corresponding expert response actions. More concretely, given a dataset $\mathcal{D} = \{(\hat{s}_ i, \hat{x}_ i)\}_ {i=1}^N$ of exogenous signals $\hat{s}_ i$ and the respective expert's response $\hat{x}_ i$, our goal is to find a cost vector $\theta \in \mathbb{R}^p$ such that the Forward Optimization Problem (FOP) with feature mapping $\phi$ $$x_i \in \arg\min_ {x \in \mathbb{X}(\hat{s}_ i)} \ \theta^\top \phi(\hat{s}_ i,x)$$ reproduces (or in some sense approximates) the expert's action $\hat{x}_ i$. For a more detailed description of the IO problem and its modelling, please refer to Zattoni Scroccaro et al. (2023) and the references therein.

Installation

pip install invopt

InvOpt depends on NumPy. Moreover, some of its functions also depend on gurobipy or cvxpy. You can get a free academic license for Gurobi here.

Usage and examples

The following functions are available in the InvOpt package to solving IO problems:

  • discrete_model_consistent: for FOPs with dicrete decision spaces (e.g., binary), and when the dataset is consistent with some cost vector. Can be used to check if the data is consistent.
  • discrete_model: for FOPs with dicrete decision spaces (e.g., binary).
  • MIP_linear: for FOPs with mixed-integer decision spaces and cost functions linear w.r.t. the continuous part of the decision variable.
  • MIP_quadratic: for FOPs with mixed-integer decision spaces and cost functions quadratic w.r.t. the continuous part of the decision variable.
  • FOM: for general FOPs. Solves IO problem approximately using first-order methods.

Contributing

Contributions, pull requests and suggestions are very much welcome. The TODO file contains a number of ideas to possibly improve the InvOpt package.

Citing

If you use InvOpt for research, please cite our accompanying paper:

@article{zattoniscroccaro2023learning,
  title={Learning in Inverse Optimization: Incenter Cost, Augmented Suboptimality Loss, and Algorithms},
  author={Zattoni Scroccaro, Pedro and Atasoy, Bilge and Mohajerin Esfahani, Peyman},
  journal={https://arxiv.org/abs/2305.07730},
  year={2023}
}

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

invopt-0.0.3.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

invopt-0.0.3-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file invopt-0.0.3.tar.gz.

File metadata

  • Download URL: invopt-0.0.3.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for invopt-0.0.3.tar.gz
Algorithm Hash digest
SHA256 64894816f3988663dcf34457f900a88f42957abefa2c62f7d6afd71644b3c8dc
MD5 eb50d664df141526b9505e994797f7e1
BLAKE2b-256 4405b702ccff17286ed6a885d3bd0022232c0c91f518b195511ec6a723a73822

See more details on using hashes here.

File details

Details for the file invopt-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: invopt-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for invopt-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 76cc17d5e23f5ba3911c46237fdc5446d5ab72b6f353496ccd56e623a0c8c9d8
MD5 11c33cb2ca6320f1b56357339b1320d1
BLAKE2b-256 7fd2278fa6038e81cb5801873657e4aef7c7c2bb0f5607954b448c7d863c82dd

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