# Writing a multi-objective MPS file

**URL:** <https://discourse.julialang.org/t/writing-a-multi-objective-mps-file/73058>\
**Category:** Optimization (Mathematical)\
**Created:** [December 14, 2021, 4:17am UTC](https://discourse.julialang.org/t/writing-a-multi-objective-mps-file/73058 "2021-12-14T04:17:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gleyland](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gleyland/32/15339_2.png) [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Post date:** [December 14, 2021, 4:17am UTC](https://discourse.julialang.org/t/writing-a-multi-objective-mps-file/73058/1 "2021-12-14T04:17:52Z")

</div>

Hi,

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

```julia
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)
end

write_to_file(model, "model.mps")

```

Thanks!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [December 14, 2021, 4:24am UTC](https://discourse.julialang.org/t/writing-a-multi-objective-mps-file/73058/2 "2021-12-14T04:24:19Z")

</div>

`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

```nohighlight
GRBwrite(grb, "model.mps")

```

---

<div class="post-metadata">

**Author:** ![gleyland](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gleyland/32/15339_2.png) [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Post date:** [December 14, 2021, 5:59am UTC](https://discourse.julialang.org/t/writing-a-multi-objective-mps-file/73058/3 "2021-12-14T05:59:29Z")

</div>

Thanks @odow (as always!)
