# Trying to use FileFormats with JuMP

**URL:** <https://discourse.julialang.org/t/trying-to-use-fileformats-with-jump/96144>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [March 15, 2023, 7:06pm UTC](https://discourse.julialang.org/t/trying-to-use-fileformats-with-jump/96144 "2023-03-15T19:06:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shakedregev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shakedregev/32/45821_2.png) [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Post date:** [March 15, 2023, 7:06pm UTC](https://discourse.julialang.org/t/trying-to-use-fileformats-with-jump/96144/1 "2023-03-15T19:06:34Z")

</div>

Following the example [here](https://docs.juliahub.com/MathOptInterface/tyub8/0.9.18/apimanual/#File-formats-1), I’m trying to use JuMP to write a model to a file.

```julia
src = JuMP.Model(Clarabel.Optimizer)
filename = "my_model.lp"
dest = FileFormats.Model(filename = filename)
MOI.copy_to(dest, src)
MOI.write_to_file(dest, filename)

```

I get a “no method matching” error for MOI.write\_to\_file with suggestions of other inputs. So I’m pretty sure src, and by extension dest are not the correct format, but how do I get them into the correct format?

---

<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:** [March 15, 2023, 7:35pm UTC](https://discourse.julialang.org/t/trying-to-use-fileformats-with-jump/96144/2 "2023-03-15T19:35:17Z")

</div>

See [Models · JuMP](https://jump.dev/JuMP.jl/stable/manual/models/#Write-a-model-to-file)

It’s just:

```julia
model = Model(Clarabel.Optimizer)
write_to_file(model, "my_model.lp")

```

p.s., You’ve somehow found an old version of the MathOptInterface documentation 😄 Here’s a link to the official JuMP documentation:

[https://jump.dev/JuMP.jl/stable/](https://jump.dev/JuMP.jl/stable/)

You can also get there by going to [https://jump.dev](https://jump.dev) and clicking the “Documentation” link at the top.
