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

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 ? :sweat_smile:

Thanks in advance everyone !

1 Like

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

1 Like