Writing a multi-objective MPS file


We’re using JuMP with Gurobi, and specifically Gurobi’s multi-objective support (which is more sequential objectives than multi-objective, but that works because in this case that’s what we want).

It would be handy to write out an MPS file with multiple objectives and I think that MPS (or an extension to it) does support that, but when I write the MPS file, I just get the first objective.

Can I write them all?

The code I’m using is roughly

grb = backend(model)
for (i, o) in enumerate(objectives)
    MOI.set(grb, Gurobi.MultiObjectiveFunction(i), moi_function(o))
    MOI.set(grb, Gurobi.MultiObjectivePriority(i), -i)

write_to_file(model, "model.mps")


1 Like

write_to_file uses the MPS writer in MathOptInterface.FileFormats.MPS. It doesn’t know about Gurobi’s multi objective attributes.

You can use instead

GRBwrite(grb, "model.mps")

Thanks @odow (as always!)

1 Like