- Notifications
You must be signed in to change notification settings - Fork20
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
Withgurobi-logtools you can extract information from Gurobi log files and generatepandas DataFrames or Excel worksheets for further processing. We also include a plot method which combines the power of interactive dashboards throughipywidgets
and plotting functions fromplotly.express
, making it easy to explore your data and results!
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
- ...
For a description of the plotting dashboard please see the following link:Gurobi-logtools plotting dashboard
We provide aTUTORIAL in the form of agurobi-logtools.ipynb notebook with theexample data set to get started.Additionally, there is aGurobi 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):
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)
- 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 thePlotly Python library - of course, any other plotting library of your choice can be used to work with these DataFrames.
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 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
, andFigure.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 be needed to be installed depending on the filetype.
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.
About
Extract and visualize information from Gurobi log files
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors9
Uh oh!
There was an error while loading.Please reload this page.