Question about outputting the coefficient information from a mps file
回答済みDear professionals from Gurobi,
I want to do a case study where the cases are online in .mps file (like afiro.mps). However, I want to convert the model with the same coefficient set into a dual problem or robust problem, and I didn't find a way to output the coefficient information as well as the sign of inequalities out from the model via Python API. I am really appreciated if you can help me with this issue! Thanks a lot!
-
正式なコメント
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Yiqi,
You can first read the model files into Model() objects using the Global function read().
I am not sure what you exactly want to do. However, you might find the following methods relevant:
- You can call the method Model.getA() to get the linear matrix coefficients as a sparse matrix
- You can iterate through the linear constraints using the Model.getConstrs() method and query constraint attributes such as sense, rhs value, and name
- You can access the LHS of each constraint (row) via calling the method Model.getRow(constr)
You can also use the Model.write("dual.dua") method to write the dual formulation of an LP Model into a file.
Best regards,
Maliheh
0
投稿コメントは受け付けていません。
コメント
2件のコメント