Storing the output of an optimization model in a table for each iteration of a for loop
AnsweredI currently have an optimization model in a for loop, and with each iteration, I am getting the values of three decision variables. I would like to store these values in the form of a table, something along these lines -

I am not able to figure out how to do this!
Thank you in advance for your help!
Best Regards,
Pavithra
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Pavithra,
I am not sure if I understand you correctly.
Do you want to write out a table to a file or do you want to have some table data structure in your program to work with?
Do you have problems with retrieving the variable values after solving the problem with Gurobi?Best regards,
Mario0 -
Hi Mario,
I am able to retrieve the variable values after solving the problem with Gurobi(in each iteration). I want to write out these values(for each iteration/run of the loop) into a table so that I can have an overview of the variable values that are returned by Gurobi after each run.
Please do let me know if you would like me to clarify anything further.
Thank you in advance!
Best Regards,
Pavithra
0 -
Hi Pavithra,
Actually, this question is not really related to Gurobi, it is more a general programming question.
Gurobi has no built-in features for detailed solution analysis since this is usually highly problem specific.Here are some ideas where you could start: If you use Python, you could save your results in a Pandas dataframe or (independent of the programming language) write out the lines to a file in CSV format that you can finally analyze in some spreadsheet software. There are numerous ways to handle result tables.
Best regards,
Mario0 -
Hi Mario,
Thank you for your response! I was indeed wondering if Gurobi had a feature for solution analysis. Yes, since I am using Python, I will try the Pandas dataframe approach.
Best Regards,
Pavithra
0
Post is closed for comments.
Comments
5 comments