Gurobi can export your model to several different file formats. This is done by invoking the write function of the appropriate API. The file name extension (.lp, .mps, .rew, etc.) of the string argument provided to the write function determines the type of model file that will be written. You can also append an extension to specify a compression algorithm (.bz2, .zip, etc.).
Using an API
The write functions for each supported programming language are listed below.
For example, in Python:
Using the command-line tool
The same export functionality can be achieved using the Gurobi command-line tool by setting the ResultFile parameter.
gurobi_cl ResultFile=model.rew model.mps
With this approach, the model file isn't written until the optimization completes. As such, you may want to solve the model with a very short TimeLimit so you don't have to wait for the model to solve to optimality.
Using the parameter GURO_PAR_DUMP
Please refer to the article How do I write an MPS model file from a third-party API?.
Please sign in to leave a comment.