GithubHelp home page GithubHelp logo

cozad-gurobi / gurobi-logtools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gurobi/gurobi-logtools

0.0 0.0 0.0 1.14 MB

Extract and visualize information from Gurobi log files

License: Apache License 2.0

Python 85.90% Jupyter Notebook 14.10%

gurobi-logtools's Introduction

gurobi-logtools

PyPI License Test Python Package

Extract information from Gurobi log files and generate pandas DataFrames or Excel worksheets for further processing. Also includes a wrapper for out-of-the-box interactive visualizations using the plotting library Plotly.

Note

We have renamed the project to gurobi-logtools, so please also adapt the import statement accordingly:

import gurobi_logtools as glt

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

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 with the example data set to get started. Additionally, there is a Gurobi TechTalk demonstrating how to use it (YouTube):

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, 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 the Plotly Python library - 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

gurobi-logtools's People

Contributors

erodriguezheck avatar maliheha avatar mattmilten avatar ronaldvdv-gurobi avatar siefen avatar simonbowly avatar torressa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.