gurobi-logtools


Namegurobi-logtools JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/Gurobi/gurobi-logtools
SummaryGurobi log file tools for parsing and exploring data
upload_time2023-10-11 18:17:56
maintainer
docs_urlNone
authorGurobi Optimization, LLC
requires_python>=3.7
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gurobi-logtools

[![PyPI](https://img.shields.io/pypi/v/gurobi-logtools?label=PyPI)](https://pypi.python.org/pypi/gurobi-logtools)
[![License](https://img.shields.io/github/license/Gurobi/gurobi-logtools?color=blue&label=License)](https://github.com/Gurobi/gurobi-logtools/blob/master/LICENSE)
[![Test Python Package](https://github.com/Gurobi/gurobi-logtools/actions/workflows/python-tox.yml/badge.svg?branch=master)](https://github.com/Gurobi/gurobi-logtools/actions/workflows/python-tox.yml)

Extract information from Gurobi log files and generate [pandas DataFrames](https://pandas.pydata.org/) or Excel worksheets for further processing. Also includes a wrapper for out-of-the-box interactive visualizations using the plotting library [Plotly](https://plotly.com/python/).

> [!NOTE]
> We have renamed the project to `gurobi-logtools`, so please also adapt the import statement accordingly:
>
> `import gurobi_logtools as glt`

![performance plot](https://github.com/Gurobi/gurobi-logtools/raw/master/assets/performance-plot.png)

# Installation

```
python -m pip install gurobi-logtools
```

It is recommended to prepend the `pip install` command with `python -m` to ensure that the package is installed using the correct Python version currently active in your environment.

See [CHANGELOG](https://github.com/Gurobi/gurobi-logtools/blob/master/CHANGELOG.md) for added, removed or fixed functionality.

# Usage

First, you need a set of Gurobi log files to compare, e.g.,
  - results from several model instances
  - comparisons of different parameter settings
  - performance variability experiments involving multiple random seed runs
  - ...

You may also use the provided [gurobi-logtools.ipynb notebook](https://github.com/Gurobi/gurobi-logtools/blob/master/gurobi-logtools.ipynb) with the [example data set](https://github.com/Gurobi/gurobi-logtools/tree/master/data) to get started.
Additionally, there is a [Gurobi TechTalk demonstrating how to use it (YouTube)](https://youtu.be/wbg4Zr_A1s8):

[![](https://github.com/Gurobi/gurobi-logtools/raw/master/assets/youtube-thumbnail.png)](https://youtu.be/wbg4Zr_A1s8)

## Pandas/Plotly
1. parse log files:
    ```Python
    import gurobi_logtools as glt

    results = glt.parse(["run1/*.log", "run2/*.log"])
    summary = results.summary()
    nodelog_progress = results.progress("nodelog")
    ```
    Depending on your requirements, you may need to filter or modify the resulting DataFrames.

2. draw interactive charts, preferably in a [Jupyter Notebook](https://jupyter.org/):

    - final results from the individual runs:
    ```Python
    glt.plot(summary, type="box")
    ```

    - progress charts for the individual runs:
    ```Python
    glt.plot(nodelog_progress, y="Gap", color="Log", type="line")
    ```

    - progress of the norel heuristic (note, the time recorded here is since the start of norel, and does not include presolve + read time):
    ```Python
    glt.plot(results.progress("norel"), x="Time", y="Incumbent", color="Log", type="line")
    ```

    These are just examples using the [Plotly Python library](https://plotly.com/python/) - of course, any other plotting library of your choice can be used to work with these DataFrames.

## Excel
Convert your log files to Excel worksheets right on the command-line:

```
python -m gurobi_logtools myrun.xlsx data/*.log
```

List all available options and how to use the command-line tool:

```
python -m gurobi_logtools --help
```

## Rename log files
The command line tool can also rename log files according to the parameters set and model solved in a given run. This is useful if your log files do not have a consistent naming scheme, or if multiple runs are logged per file and you want to extract the individual runs.

For example:

```
python -m gurobi_logtools --write-to-dir nicenames summary.xlsx tests/assets/combined/*.log
```

separates logs for individual runs in the input files and writes copies to the 'nicenames' folder with a consistent naming scheme:

```
> ls nicenames
912-MIPFocus1-Presolve1-TimeLimit600-glass4-0.log
912-MIPFocus1-Presolve1-TimeLimit600-glass4-1.log
912-MIPFocus1-Presolve1-TimeLimit600-glass4-2.log
912-MIPFocus2-Presolve1-TimeLimit600-glass4-0.log
912-MIPFocus2-Presolve1-TimeLimit600-glass4-1.log
912-MIPFocus2-Presolve1-TimeLimit600-glass4-2.log
912-Presolve1-TimeLimit600-glass4-0.log
912-Presolve1-TimeLimit600-glass4-1.log
912-Presolve1-TimeLimit600-glass4-2.log
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Gurobi/gurobi-logtools",
    "name": "gurobi-logtools",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Gurobi Optimization, LLC",
    "author_email": "support@gurobi.com",
    "download_url": "https://files.pythonhosted.org/packages/74/01/ff059a0906f6898da07c28a78b95486874601ffa4c12f50123197117969c/gurobi-logtools-3.0.0.tar.gz",
    "platform": "any",
    "description": "# gurobi-logtools\n\n[![PyPI](https://img.shields.io/pypi/v/gurobi-logtools?label=PyPI)](https://pypi.python.org/pypi/gurobi-logtools)\n[![License](https://img.shields.io/github/license/Gurobi/gurobi-logtools?color=blue&label=License)](https://github.com/Gurobi/gurobi-logtools/blob/master/LICENSE)\n[![Test Python Package](https://github.com/Gurobi/gurobi-logtools/actions/workflows/python-tox.yml/badge.svg?branch=master)](https://github.com/Gurobi/gurobi-logtools/actions/workflows/python-tox.yml)\n\nExtract information from Gurobi log files and generate [pandas DataFrames](https://pandas.pydata.org/) or Excel worksheets for further processing. Also includes a wrapper for out-of-the-box interactive visualizations using the plotting library [Plotly](https://plotly.com/python/).\n\n> [!NOTE]\n> We have renamed the project to `gurobi-logtools`, so please also adapt the import statement accordingly:\n>\n> `import gurobi_logtools as glt`\n\n![performance plot](https://github.com/Gurobi/gurobi-logtools/raw/master/assets/performance-plot.png)\n\n# Installation\n\n```\npython -m pip install gurobi-logtools\n```\n\nIt is recommended to prepend the `pip install` command with `python -m` to ensure that the package is installed using the correct Python version currently active in your environment.\n\nSee [CHANGELOG](https://github.com/Gurobi/gurobi-logtools/blob/master/CHANGELOG.md) for added, removed or fixed functionality.\n\n# Usage\n\nFirst, you need a set of Gurobi log files to compare, e.g.,\n  - results from several model instances\n  - comparisons of different parameter settings\n  - performance variability experiments involving multiple random seed runs\n  - ...\n\nYou may also use the provided [gurobi-logtools.ipynb notebook](https://github.com/Gurobi/gurobi-logtools/blob/master/gurobi-logtools.ipynb) with the [example data set](https://github.com/Gurobi/gurobi-logtools/tree/master/data) to get started.\nAdditionally, there is a [Gurobi TechTalk demonstrating how to use it (YouTube)](https://youtu.be/wbg4Zr_A1s8):\n\n[![](https://github.com/Gurobi/gurobi-logtools/raw/master/assets/youtube-thumbnail.png)](https://youtu.be/wbg4Zr_A1s8)\n\n## Pandas/Plotly\n1. parse log files:\n    ```Python\n    import gurobi_logtools as glt\n\n    results = glt.parse([\"run1/*.log\", \"run2/*.log\"])\n    summary = results.summary()\n    nodelog_progress = results.progress(\"nodelog\")\n    ```\n    Depending on your requirements, you may need to filter or modify the resulting DataFrames.\n\n2. draw interactive charts, preferably in a [Jupyter Notebook](https://jupyter.org/):\n\n    - final results from the individual runs:\n    ```Python\n    glt.plot(summary, type=\"box\")\n    ```\n\n    - progress charts for the individual runs:\n    ```Python\n    glt.plot(nodelog_progress, y=\"Gap\", color=\"Log\", type=\"line\")\n    ```\n\n    - progress of the norel heuristic (note, the time recorded here is since the start of norel, and does not include presolve + read time):\n    ```Python\n    glt.plot(results.progress(\"norel\"), x=\"Time\", y=\"Incumbent\", color=\"Log\", type=\"line\")\n    ```\n\n    These are just examples using the [Plotly Python library](https://plotly.com/python/) - of course, any other plotting library of your choice can be used to work with these DataFrames.\n\n## Excel\nConvert your log files to Excel worksheets right on the command-line:\n\n```\npython -m gurobi_logtools myrun.xlsx data/*.log\n```\n\nList all available options and how to use the command-line tool:\n\n```\npython -m gurobi_logtools --help\n```\n\n## Rename log files\nThe command line tool can also rename log files according to the parameters set and model solved in a given run. This is useful if your log files do not have a consistent naming scheme, or if multiple runs are logged per file and you want to extract the individual runs.\n\nFor example:\n\n```\npython -m gurobi_logtools --write-to-dir nicenames summary.xlsx tests/assets/combined/*.log\n```\n\nseparates logs for individual runs in the input files and writes copies to the 'nicenames' folder with a consistent naming scheme:\n\n```\n> ls nicenames\n912-MIPFocus1-Presolve1-TimeLimit600-glass4-0.log\n912-MIPFocus1-Presolve1-TimeLimit600-glass4-1.log\n912-MIPFocus1-Presolve1-TimeLimit600-glass4-2.log\n912-MIPFocus2-Presolve1-TimeLimit600-glass4-0.log\n912-MIPFocus2-Presolve1-TimeLimit600-glass4-1.log\n912-MIPFocus2-Presolve1-TimeLimit600-glass4-2.log\n912-Presolve1-TimeLimit600-glass4-0.log\n912-Presolve1-TimeLimit600-glass4-1.log\n912-Presolve1-TimeLimit600-glass4-2.log\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Gurobi log file tools for parsing and exploring data",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/Gurobi/gurobi-logtools"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "736dca38e822c16873cb377ea8b6931a7e98385d33915b07d8333c2c39472765",
                "md5": "02018f6392d36e45745be2b405bd630b",
                "sha256": "3ffe1d8d0fc100cef9f475c8d5aae68282a397af98392a4392a6bd868efc5d9c"
            },
            "downloads": -1,
            "filename": "gurobi_logtools-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "02018f6392d36e45745be2b405bd630b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 44411,
            "upload_time": "2023-10-11T18:17:54",
            "upload_time_iso_8601": "2023-10-11T18:17:54.457887Z",
            "url": "https://files.pythonhosted.org/packages/73/6d/ca38e822c16873cb377ea8b6931a7e98385d33915b07d8333c2c39472765/gurobi_logtools-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7401ff059a0906f6898da07c28a78b95486874601ffa4c12f50123197117969c",
                "md5": "2603e9cf26c9087a69d1694b1f2957c6",
                "sha256": "9f1d038ff204f6d6f61dde86c6395aab7264f686d5ebef090c8821321f6e6ff4"
            },
            "downloads": -1,
            "filename": "gurobi-logtools-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2603e9cf26c9087a69d1694b1f2957c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 27089,
            "upload_time": "2023-10-11T18:17:56",
            "upload_time_iso_8601": "2023-10-11T18:17:56.503467Z",
            "url": "https://files.pythonhosted.org/packages/74/01/ff059a0906f6898da07c28a78b95486874601ffa4c12f50123197117969c/gurobi-logtools-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-11 18:17:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Gurobi",
    "github_project": "gurobi-logtools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "gurobi-logtools"
}
        
Elapsed time: 0.11784s