# Question about write.to.file with .lp (JuMP context)

**URL:** <https://discourse.julialang.org/t/question-about-write-to-file-with-lp-jump-context/56892>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [March 10, 2021, 3:42pm UTC](https://discourse.julialang.org/t/question-about-write-to-file-with-lp-jump-context/56892 "2021-03-10T15:42:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![felcbd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/felcbd/32/37642_2.png) [@felcbd](https://discourse.julialang.org/u/felcbd)\
**Post date:** [March 10, 2021, 3:42pm UTC](https://discourse.julialang.org/t/question-about-write-to-file-with-lp-jump-context/56892/1 "2021-03-10T15:42:56Z")

</div>

Hi everyone,  
I had a question about a practice case I actually have with the write.to.file function.

I have my model writed with JuMP and I want to solve it with CPLEX directly from my .jl file with !optimize, and I have medium performance issues (i’m comparing it with a .lp file of the same model printed in C, that i’m solving in the cplex interactive terminal).  
So, I started to inspect this by writing the file in .lp format with write\_to\_file function : and the constraints are not in the same order that the flow of my @constraint in my .jl file.

I tried to manually switch the constraints in the .lp file and I get the performance of my C generated .lp file.

So my questions are :

- How can I know how the write.to.file() is working, and is the function actually switched my constraints?
- If the function doesn’t switch it, can I know how the @constraint use, change the constraint order in my model ?
- Am I understanding well what is going on, or do I miss some part of the global understanding ? 😅

Thanks in advance everyone !

---

<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 10, 2021, 7:40pm UTC](https://discourse.julialang.org/t/question-about-write-to-file-with-lp-jump-context/56892/2 "2021-03-10T19:40:35Z")

</div>

The LP file does not maintain the constraint ordering, and there is no way to achieve this from JuMP.
