Hi folks,

In JuMP 0.19, has writeMPS been removed? This issue alludes to it : https://github.com/JuliaOpt/JuMP.jl/issues/1403

If so, why and is there a replacement?

And if not, where is the function documented - a google search returns very little.

Edit: I find writeMPS in the v. 0.18 docs http://www.juliaopt.org/JuMP.jl/v0.18/refmodel.html?highlight=writemps but not in later versions


Actually… I see that writers.jl is no longer part of the repo since v0.18. Is it just a matter of converting it to work with JuMP 0.19 and Julia 1.0 or is it gone forever?


These writers are now in https://github.com/odow/MathOptFormat.jl, although it doesn’t appear to be documented at the moment how to write an MPS file from a JuMP model.


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.

writeLP in JuMP 0.19?

Many thanks for this. The suggestion to streamline would be great. Is there a performance impact from the copy_to step for large models, or is this unavoidable?

By the way, if a variable has no coefficients in the objective function or constraints, it is skipped in the column section but the bounds are still reported leading to unknown column errors. I will raise an issue in github.


Is there a performance impact from the copy_to step for large models, or is this unavoidable?

If you have an example where the copy represents an unacceptable overhead, that would be interesting to analyse.

If you only want to use JuMP to write a file, you can load the MPS writer as a “solver” an avoid this overhead

model = Model(with_optimizer(MathOptFormat.MPS.Model))
# or
model = JuMP.direct_model(MathOptFormat.MPS.Model())
@variable(model, x)
@constraint(model,con1, 2x <= 1)
MOI.write_to_file(JuMP.backend(model), "my_model.mps")