opencobra/cobrapy — pull request #14 by jlerman44 (2013-08-02 04:45:35+00:00)
Title: deterministic lp file writing

Writing LP files out starting from cobra_model structures is sometimes needed. But the LP files are not deterministically written.

Here is what I mean:

If you load any cobra model pickle and write the LP file (I'm talking about glpk here), you might see:
x1 + x2 = 0 as one of the constraints. if you do it again later, you might see x2 + x1 = 0 in the LP file. Now, these are mathematically equivalent.... but since the resulting LP files are not EXACTLY the same the solvers do not always perform the optimization the same way leading to confusing debugging sessions.

This pull requests sorts the dict during writing of LP files so that they are deterministically written.