Skip to main content

grblogtools using example log files to create diagramms

Answered

Comments

9 comments

  • Harun Gül
    Gurobi-versary
    Conversationalist
    First Question

    I did copy the text of the logfile from github and saved it in a text data from windows editor. But where do I need to save the editor so that Python Gurobi API can find it. I tried it at C:\gurobi952 but it wont work, the same error with Version occurs

    1
  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Harun, 

    You first need to install the grblogtools package as explained in the Installation section of the grblogtools github. 

    You then need to run your models and save the results in log files before using the grblogtools to extract information from them. The error \(\texttt{KeyError: `Version'}\) occurs because the folders \(\texttt{run1/*.log}\) and \(\texttt{run2/*.log}\) do not exist on your machine. The input argument to the method \(\texttt{glt.parse()}\) is a single glob pattern or a list of globe patterns matching the path to log files.

    Let us consider your \(\texttt{gurobi.log}\) file, you need to change the script as below and run it from the directory where the file \(\texttt{gurobi.log}\) is located:

    results = glt.parse("gurobi.log")
    summary = results.summary()
    nodelog_progress = results.progress("nodelog")

    Best regards,

    Maliheh

    0
  • Harun Gül
    Gurobi-versary
    Conversationalist
    First Question

    Thanks Maliheh Aramon. Now the thing is I dont want to use my own log files but the log files from the grblogtools examples that are available at github. Therefore it would be usefull to know how I have to save the log files from github so that I can use them to evaluate. Is it even possible? And if yes how would I save them and how would I call them later on? Thanks 

    0
  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    Hi Harun, 

    Of course, you can use the log files in the \(\texttt{grblogtools}\) repo.

    You need to have a copy of the log files on your machine. 

    • If you are familiar with git, you can clone the repo into your machine. You can open your terminal, navigate to your home directory or any other directory, and then run the following command:
    git clone https://github.com/Gurobi/grblogtools.git

    This will create a folder named \(\texttt{grblogtools}\) in your current directory.

    • Instead of cloning the git repo, you can download the whole repo as a ZIP file and extract it. This will also create a folder named \(\texttt{grblogtools}\) in your current directory. To download the repo as a ZIP file, click on the green button Code on the github repo and then click on the Download ZIP option.

    After having a local copy of the repo on your machine, go to the \(\texttt{grblogtools}\) directory and you can run:

    results = glt.parse("data/*.log")
    summary = results.summary()
    nodelog_progress = results.progress("nodelog")

    Best regards,

    Maliheh

    0
  • Harun Gül
    Gurobi-versary
    Conversationalist
    First Question

    Thanks so much it worked well for me to download the zip file.

    0
  • Ankit Nadge
    Gurobi-versary
    First Comment
    First Question

    Hi ,

    You said, "You then need to run your models and save the results in log files before using the grblogtools to extract information from them."

    I have generated the output results and don't know how to convert them to logfiles, so if you could please guide me through it.

    This is how my output looks,I want to convert it in logfile

    https://www.youtube.com/watch?v=wbg4Zr_A1s8 

    as this guys are discussing in the video around 13:26 minutes

    0
  • Matthias Miltenberger
    Gurobi Staff Gurobi Staff

    Please refer to this section in our documentation about Logging. You just need to specify the LogFile parameter to write a dedicated log file for this optimization run. Consecutive runs will then be appended to this file until you change the LogFile parameter again.

    I hope that answers your question.

    Cheers,
    Matthias

    0
  • Tanmoy Das
    Gurobi-versary
    Investigator
    Collaborator

    How can I write the LogFile? Most documentations talks about how to read the file. 

    I installed grblogtool

    0
  • Tanmoy Das
    Gurobi-versary
    Investigator
    Collaborator

    I got the answer: write the below code between the line of model.write() & model.optimize()

    model2.Params.LogFile = "Outputs/model2.log" 
    0

Please sign in to leave a comment.