- Notifications
You must be signed in to change notification settings - Fork19
Extract and visualize information from Gurobi log files
License
Gurobi/gurobi-logtools
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Extract information from Gurobi log files and generatepandas DataFrames or Excel worksheets for further processing. Also includes a wrapper for out-of-the-box interactive visualizations using the plotting libraryPlotly.
Note
We have renamed the project togurobi-logtools
, so please also adapt the import statement accordingly:
import gurobi_logtools as glt
python -m pip install gurobi-logtools
It is recommended to prepend thepip install
command withpython -m
to ensure that the package is installed using the correct Python version currently active in your environment.
SeeCHANGELOG for added, removed or fixed functionality.
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 providedgurobi-logtools.ipynb notebook with theexample data set to get started.Additionally, there is aGurobi TechTalk demonstrating how to use it (YouTube):
parse log files:
importgurobi_logtoolsasgltresults=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.
draw interactive charts, preferably in aJupyter Notebook:
- final results from the individual runs:
glt.plot(summary,type="box")
- progress charts for the individual runs:
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):
glt.plot(results.progress("norel"),x="Time",y="Incumbent",color="Log",type="line")
These are just examples using thePlotly Python library - of course, any other plotting library of your choice can be used to work with these DataFrames.
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
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 nicenames912-MIPFocus1-Presolve1-TimeLimit600-glass4-0.log912-MIPFocus1-Presolve1-TimeLimit600-glass4-1.log912-MIPFocus1-Presolve1-TimeLimit600-glass4-2.log912-MIPFocus2-Presolve1-TimeLimit600-glass4-0.log912-MIPFocus2-Presolve1-TimeLimit600-glass4-1.log912-MIPFocus2-Presolve1-TimeLimit600-glass4-2.log912-Presolve1-TimeLimit600-glass4-0.log912-Presolve1-TimeLimit600-glass4-1.log912-Presolve1-TimeLimit600-glass4-2.log
About
Extract and visualize information from Gurobi log files