gurobi-modelanalyzer


Namegurobi-modelanalyzer JSON
Version 2.1.0 PyPI version JSON
download
home_pageNone
SummaryModel analysis tools for explaining ill-conditioning and analyzing solutions.
upload_time2024-11-12 13:27:33
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords optimization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Gurobi Model Analyzer

Gurobi Model Analyzer is an
[open-source](https://gurobi-modelanalyzer.readthedocs.io/en/stable/license.html) python package that provides
detailed analysis of model solutions and model characteristics.
It consists of a results_analyzer module that calculates
explanations of ill-conditioned basis matrices and a solcheck module that analysizes a given solution.


# Documentation

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


# Contact us

For questions related to using Gurobi Model Analyzer, 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.

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


# Installation

## Dependencies

- Python >= 3.9
- [`numpy`](https://pypi.org/project/numpy/)  >= 1.21.5    (although earlier
  versions compatible with python 3.7 will probably work).
- [questionary](https://pypi.org/project/questionary/) for the (optional) interactive version

## Pip installation

The easiest way to install gurobi-modelanalyzer is using pip in a
virtual environment:

```
(.venv) pip install gurobi-modelanalyzer
```

This will also install the numpy and gurobipy dependencies.  One of the
advanced functions makes use of matplotlib; if you haven't already installed
that and plan to use this function (matrix_bitmap), you can either install
the matplotlib package directly, or install it with the gurobi-modelanalyzer
package via "pip install gurobi-modelanalyzer matplotlib".

Please note that gurobipy is commercial software and requires a
license. When installed via pip or conda, gurobipy ships with a free
license for testing and can only solve models of limited size.


## Example usage
### Using the explainer functions

```python
import gurobipy as gp
import gurobi_modelanalyzer as gma

model = gp.read("myillconditionedmodel.mps")
model.optimize()
gma.kappa_explain(model)

# row-based explanation (default)
gma.kappa_explain(model, expltype="ROWS")

# column-based explanation
gma.kappa_explain(model, expltype="COLS")

# angle-based explanation (only looks for pairs of rows or columns
# that cause ill-conditioning.
gma.angle_explain(model)
```

Use `help(gma.kappa_explain)` or `help(gma.angle_explain)` for information
on more advanced usage.

### Using the solution checker

Testing a suboptimal solution

```python
import gurobipy as gp
import gurobi_modelanalyzer as gma

m = gp.read("examples/data/afiro.mps")

sol = {m.getVarByName("X01"): 78, m.getVarByName("X22"): 495}
sc = gma.SolCheck(m)

sc.test_sol(sol)
print(f"Solution Status: {sc.Status}")
sc.optimize()
for v in sol.keys():
    print(f"{v.VarName}: Fixed value: {sol[v]}, Computed value: {v.X}")
```

Testing an infeasible solution

```python
m = gp.read("examples/data/misc07.mps")

sol = {m.getVarByName("COL260"): 2400.5}
sc = gma.sol_check(m)

sc.test_sol(sol)

print(f"Solution Status: {sc.Status}")
sc.inf_repair()
for c in m.getConstrs():
    if abs(c._Violation) > 0.0001:
        print(f"{c.ConstrName}: RHS: {c.RHS}, Violation: {c._Violation}")
```


# 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 Model Analyzer and would like to encourage you to
contribute directly to this project. Please see the [Contributing Guide](CONTRIBUTING.md) for more information.


## 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-modelanalyzer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "optimization",
    "author": null,
    "author_email": "Ed Klotz <klotz@gurobi.com>, Greg Glockner <glockner@gurobi.com>",
    "download_url": "https://files.pythonhosted.org/packages/6f/31/5c3ff559008969f8884d51d0a7f748221454597af8bec5ad9876a94fbe61/gurobi_modelanalyzer-2.1.0.tar.gz",
    "platform": null,
    "description": "# Gurobi Model Analyzer\n\nGurobi Model Analyzer is an\n[open-source](https://gurobi-modelanalyzer.readthedocs.io/en/stable/license.html) python package that provides\ndetailed analysis of model solutions and model characteristics.\nIt consists of a results_analyzer module that calculates\nexplanations of ill-conditioned basis matrices and a solcheck module that analysizes a given solution.\n\n\n# Documentation\n\nThe latest user manual is available on\n[readthedocs](https://gurobi-modelanalyzer.readthedocs.io/en/latest/).\n\n\n# Contact us\n\nFor questions related to using Gurobi Model Analyzer, please use\n[Gurobi's Forum](https://support.gurobi.com/hc/en-us/community/topics/10373864542609-GitHub-Projects).\n\nFor reporting bugs, issues, and feature requests please open an issue.\n\nIf you encounter issues with Gurobi or gurobipy please contact\n[Gurobi Support](https://support.gurobi.com/hc/en-us).\n\n\n# Installation\n\n## Dependencies\n\n- Python >= 3.9\n- [`numpy`](https://pypi.org/project/numpy/)  >= 1.21.5    (although earlier\n  versions compatible with python 3.7 will probably work).\n- [questionary](https://pypi.org/project/questionary/) for the (optional) interactive version\n\n## Pip installation\n\nThe easiest way to install gurobi-modelanalyzer is using pip in a\nvirtual environment:\n\n```\n(.venv) pip install gurobi-modelanalyzer\n```\n\nThis will also install the numpy and gurobipy dependencies.  One of the\nadvanced functions makes use of matplotlib; if you haven't already installed\nthat and plan to use this function (matrix_bitmap), you can either install\nthe matplotlib package directly, or install it with the gurobi-modelanalyzer\npackage via \"pip install gurobi-modelanalyzer matplotlib\".\n\nPlease note that gurobipy is commercial software and requires a\nlicense. When installed via pip or conda, gurobipy ships with a free\nlicense for testing and can only solve models of limited size.\n\n\n## Example usage\n### Using the explainer functions\n\n```python\nimport gurobipy as gp\nimport gurobi_modelanalyzer as gma\n\nmodel = gp.read(\"myillconditionedmodel.mps\")\nmodel.optimize()\ngma.kappa_explain(model)\n\n# row-based explanation (default)\ngma.kappa_explain(model, expltype=\"ROWS\")\n\n# column-based explanation\ngma.kappa_explain(model, expltype=\"COLS\")\n\n# angle-based explanation (only looks for pairs of rows or columns\n# that cause ill-conditioning.\ngma.angle_explain(model)\n```\n\nUse `help(gma.kappa_explain)` or `help(gma.angle_explain)` for information\non more advanced usage.\n\n### Using the solution checker\n\nTesting a suboptimal solution\n\n```python\nimport gurobipy as gp\nimport gurobi_modelanalyzer as gma\n\nm = gp.read(\"examples/data/afiro.mps\")\n\nsol = {m.getVarByName(\"X01\"): 78, m.getVarByName(\"X22\"): 495}\nsc = gma.SolCheck(m)\n\nsc.test_sol(sol)\nprint(f\"Solution Status: {sc.Status}\")\nsc.optimize()\nfor v in sol.keys():\n    print(f\"{v.VarName}: Fixed value: {sol[v]}, Computed value: {v.X}\")\n```\n\nTesting an infeasible solution\n\n```python\nm = gp.read(\"examples/data/misc07.mps\")\n\nsol = {m.getVarByName(\"COL260\"): 2400.5}\nsc = gma.sol_check(m)\n\nsc.test_sol(sol)\n\nprint(f\"Solution Status: {sc.Status}\")\nsc.inf_repair()\nfor c in m.getConstrs():\n    if abs(c._Violation) > 0.0001:\n        print(f\"{c.ConstrName}: RHS: {c.RHS}, Violation: {c._Violation}\")\n```\n\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\n# Development\nWe value any level of experience in using Gurobi Model Analyzer and would like to encourage you to\ncontribute directly to this project. Please see the [Contributing Guide](CONTRIBUTING.md) for more information.\n\n\n## Submitting a Pull Request\nBefore opening a Pull Request, have a look at the full\n[Contributing page](CONTRIBUTING.md) to make sure your code complies with\nour guidelines.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Model analysis tools for explaining ill-conditioning and analyzing solutions.",
    "version": "2.1.0",
    "project_urls": {
        "Documentation": "https://gurobi-modelanalyzer.readthedocs.io/en/latest/",
        "Issues": "https://github.com/Gurobi/gurobi-modelanalyzer/issues",
        "Source": "https://github.com/Gurobi/gurobi-modelanalyzer"
    },
    "split_keywords": [
        "optimization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84f53489ecd4ae4bdfc3b16a9d2d4122a4ba792cfe8fa145a46e146d4b3231de",
                "md5": "cc25d98795174c6c9224abebcbc9af87",
                "sha256": "cc6754a545953a727dd6897eafcb6a48c678fd3d87f4f1661cb777e556b876d4"
            },
            "downloads": -1,
            "filename": "gurobi_modelanalyzer-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cc25d98795174c6c9224abebcbc9af87",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 44341,
            "upload_time": "2024-11-12T13:27:32",
            "upload_time_iso_8601": "2024-11-12T13:27:32.244091Z",
            "url": "https://files.pythonhosted.org/packages/84/f5/3489ecd4ae4bdfc3b16a9d2d4122a4ba792cfe8fa145a46e146d4b3231de/gurobi_modelanalyzer-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6f315c3ff559008969f8884d51d0a7f748221454597af8bec5ad9876a94fbe61",
                "md5": "e4fd2e937b84849f1403cb0ca903d940",
                "sha256": "6cbf564be36120a2ad5d9a4c658a143a90513ae4b20cebb52b9ab5e079fce8fc"
            },
            "downloads": -1,
            "filename": "gurobi_modelanalyzer-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e4fd2e937b84849f1403cb0ca903d940",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 2830453,
            "upload_time": "2024-11-12T13:27:33",
            "upload_time_iso_8601": "2024-11-12T13:27:33.363538Z",
            "url": "https://files.pythonhosted.org/packages/6f/31/5c3ff559008969f8884d51d0a7f748221454597af8bec5ad9876a94fbe61/gurobi_modelanalyzer-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-12 13:27:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Gurobi",
    "github_project": "gurobi-modelanalyzer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gurobi-modelanalyzer"
}
        
Elapsed time: 0.38750s