how to generate .mps file if using GAMS with gurobi solver?
AnsweredDear Sir/Madam,
I am currently using GAMS with the Gurobi solver but haven't been able to find a way to generate an .mps
file. I need this file to investigate the cause of ill-conditioning. Do you have any suggestions?
Best,
Yanda
-
Hi Yanda,
You can use the writeprob option in GAMS to generate an MPS file.
Alternatively, you can set the Gurobi parameter GURO_PAR_DUMP to 1 to export the model in an MPS file format. For more details, please see the article: How do I write an MPS model file from a third-party API?.
Regards,
Simran0 -
Hi Simranjit,
Thank you for your response. I tried both
writeprob
andGURO_PAR_DUMP
.I set them to 1 in the
gurobi.opt
file and also tested usingoption writeprob=1
andoption GURO_PAR_DUMP=1
.However, neither approach worked. Did I implement them incorrectly? I would appreciate your guidance.
Best regards,
Yanda
0 -
Hi Yanda,
Could you please try adding the line
writeprob model.mps
to your
gurobi.opt
options file? Please note use an options file with Gurobi, you will need to set theoptfile
model attribute or the optfile option to a positive value. Please see the GAMS documentation on using solver options file.I hope this helps.
Regards,
Simran0 -
Thanks, Simranjit. It works! By the way, do you know how to access the
model_analyzer
module? After runningpip install gurobi-modelanalyzer
, thegurobipy
module is available, but I can't find themodel_analyzer
module. Do you know why this might be happening?Best,
Yanda
0 -
It's great to know that you can export your model in an MPS file now!
Could it be the case that gurobi-modelanalyzer is installed in a different environment that gurobipy?
Also, once gurobi-modelanalyzer is installed, you should import gurobi_modelanalyzer module, not model_analyzer.
For more details, please see the installation and usage instructions on our Gurobi Model Analyzer github.
Best regards,
Simran0 -
Thanks, Simranjit. You are very helpful. I tried your suggestion, but ended up with this.
0 -
This error means that you are using Gurobi version 12, but the license you are using is valid only for versions 11.0 and below. To fix this, you need to update your Gurobi license to the latest version. Please follow the instructions in the article How do I resolve an "ERROR 10009: Version number is xx, license is for version yy"?.
0 -
Thanks, Simranjit. I move one step forward, but get stuck at a new place. Did I do anything wrong?
0 -
Never mind. I fixed it. Thanks a lot, Simranjit!!! Many thanks!
0 -
Good!
The issue was in perhaps in reading the model file. I assume you fixed it by moving the model.mps file to a folder so that the path to the file had no whitespaces.
Best regards,
Simran0 -
I used double backslash to replace single backslash and then it works.
0 -
Great! Good luck with your project.
Best regards,
Simran0
Please sign in to leave a comment.
Comments
12 comments