gurobi-logtools is an official Python package developed by Gurobi that allows you to parse, analyze, and visualize Gurobi log files. It is particularly helpful when profiling and comparing solver runs, tuning model performance, and sharing reproducible benchmarks.
Whether you're comparing tuning results or identifying bottlenecks in large optimization problems, gurobi-logtools provides you with an efficient, consistent way to extract insights from solver logs.
The package is actively maintained on GitHub at https://github.com/Gurobi/gurobi-logtools and provides comprehensive documentation and tutorials.
Key Features
The package provides several main capabilities:
- Log File Parsing: Extract structured data from Gurobi log files into pandas DataFrames
- Interactive Visualization: Generate interactive charts using plotly.express with ipywidgets dashboards
- Progress Tracking: Analyze optimization progress over time and summarize statistics
- Compare multiple logs: Side by side comparisons for parameter tuning or algorithm selection
- Excel Export: Convert log files directly to Excel worksheets via command-line
- File Management: Rename and organize log files with consistent naming schemes
Installation
You can install gurobi-logtools using pip:
python -m pip install gurobi-logtoolsBasic Usage
Here's how to use the package:
import gurobi_logtools as glt
# Parse log files from multiple runs
results = glt.parse(["run1/*.log", "run2/*.log"])
# Get summary information
summary = results.summary()
# Get progress information for nodelog
nodelog_progress = results.progress("nodelog")
# Create interactive plots
glt.plot(summary) # Final results
glt.plot(nodelog_progress, x="Time", y="Gap", color="Log", type="line") # Progress chartsCommand-Line Usage
You can also use it directly from the command line to convert log files to Excel:
python -m gurobi_logtools myrun.xlsx data/*.log
python -m gurobi_logtools --help # Show all optionsUse Cases
This tool is particularly useful for:
- Comparing results from multiple model instances
- Analyzing different parameter settings
- Performance variability experiments with multiple random seeds
- Creating detailed reports and visualizations of optimization runs
Example: Comparing Two Solver Runs
python -m gurobi_logtools compare.xlsx compare baseline.log tuned.logThis will produce a table showing:
- Time to optimality
- Best bound and gap evolution
- Number of explored nodes
- Whether tuning improved performance