writeMPS()

I will add some documentation, but in the mean time:

using JuMP, MathOptFormat
jump_model = JuMP.Model()
@variable(jump_model, x)
@constraint(jump_model, con1, 2x <= 1)

mps_model = MathOptFormat.MPS.Model()
MOI.copy_to(mps_model, JuMP.backend(jump_model))
MOI.write_to_file(mps_model, "my_model.mps")

@mlubin If we wanted to streamline things, we could make MathOptFormat a dependency of JuMP, and then have an API like

JuMP.write_to_file(model::Model, filename::String)

We could detect the file extension and dispatch to the appropriate MathOptFormat model type.

1 Like