grblogtools using example log files to create diagramms
AnsweredHi, I want to implement the log files from the grblogtools example datasets to do some experiments with it. I did read the github post for it and I see the log files but I dont know how I install or implement the log files. I just want all of the examples so that I can use it, I dont need to implement my own examples. How can I do it? Here is my code so far:
import gurobipy as gp
from gurobipy import GRB
import grblogtools as glt
! gurobi_cl Logfile=gurobi.log .mps # how do I get mps file and do I need it?
summary = glt.get_dataframe(["gurobi.log"])
glt.plot(summary)
When I try it with the following code from github:
results = glt.parse(["run1/*.log", "run2/*.log"])
summary = results.summary()
nodelog_progress = results.progress("nodelog")
I get the error:
KeyError: 'Version'
-
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 -
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 -
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 -
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 -
Thanks so much it worked well for me to download the zip file.
0 -
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 -
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,
Matthias0 -
How can I write the LogFile? Most documentations talks about how to read the file.
I installed grblogtool
0 -
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.
Comments
9 comments