Skip to main content

With gurobi-logtools, you can extract information from Gurobi log files and generate pandas DataFrames or Excel worksheets for further processing. We also include a plot method which combines the power of interactive dashboards through ipywidgets and plotting functions from plotly.express, making it easy to explore your data and results!

performance plot

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 for added, removed, or fixed functionality.

Usage and tutorial

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
  • ...

For a description of the plotting dashboard, please see the following link: Gurobi-logtools plotting dashboard

We provide a TUTORIAL in the form of a gurobi-logtools.ipynb notebook with the example data set to get started. Additionally, there is a Gurobi TechTalk demonstrating how to use it (YouTube), but please note it presents a version of gurobi-logtools that is several years old (but the big ideas remain the same):

Pandas/Plotly

  1. Parse log files:

    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:

    • final results from the individual runs:
    glt.plot(summary)
    
    • progress charts for the individual runs:
    glt.plot(nodelog_progress, x="Time", 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):
    glt.plot(results.progress("norel"), x="Time", y="Incumbent", color="Log", type="line")
    

    These are just examples using the Plotly Python library - of course, any other plotting library of your choice can be used to work with these DataFrames.

Other top-level functions

  • glt.register_custom_palette(name, colors): Use this function to add custom palettes to the "Custom" group in the palette type field. The arguments should be a string and a list/tuple of hex strings, respectively.

  • glt.reset_custom_palettes(): clears all custom palettes added

  • glt.show_palettes(): displays a colorful guide to Plotly's built-in palettes

  • glt.get_plotly_fig(): use this function to access the underlying Plotly figure. You can use this figure object to perform detailed customizations via the Figure.update_layout, Figure.update_traces, Figure.update_xaxes, and Figure.update_yaxes functions.

  • glt.save_plot(filepath): use this function to save the plot to a range of formats, including PNG, SVG, PDF, and HTML. The filetype is inferred from the extension of the filepath. Note that additional packages may need to be installed depending on the filetype.

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.

Metadata

Release files for gurobi-logtools 4.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gurobi-logtools 4.0.1
File Size Uploaded
gurobi_logtools-4.0.1.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gurobi-logtools 4.0.1
File Interpreter ABI Platform
gurobi_logtools-4.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 103.0 kB

Release files / gurobi_logtools-4.0.1.tar.gz

Download URL gurobi_logtools-4.0.1.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
06e2246f886fa7d635678b91ca3ddea54ab2b1fafc15531242d7df4dd42cd0fc
BLAKE2b-256 checksum
How to use checksums
b2b2c521a55ddb7b5f54dd5703966a157c4934c07b842655b1bb0d2d370cfe35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.10

Release files / gurobi_logtools-4.0.1-py3-none-any.whl

Download URL gurobi_logtools-4.0.1-py3-none-any.whl
Size 71.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc75fa6cc60fcfb37c42c95a8c97836ea158b2ae9105205ecb85e49d7fa92955
BLAKE2b-256 checksum
How to use checksums
7742a677e3bba55f4cce8360f807b2ed1b98693e16acc1f4b9e47d1014d89f63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.10

Release history Release notifications | RSS feed

This release

4.0.1 This release

2 release files

4.0.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page