Load model from .lp file

693 views
Skip to first unread message

René

unread,
Dec 1, 2016, 10:35:49 AM12/1/16
to pyomo...@googlegroups.com
Hello,

I'm in the situation that I have two seperate programs that create ILPs:
The first program creates a large ILP and writes it out to a .lp file.
The second program creates an alternative formulation for a part of the large ILP using pyomo.

Now, I would like to read in the .lp file of the first ILP with pyomo and replace some of its constraints with constraints that are generated by the second program.

However, I haven't found any documentation on how to read a model from a .lp file, only this thread from 2012 which says that it is not possible: https://groups.google.com/forum/#!searchin/pyomo-forum/load$20lp|sort:relevance/pyomo-forum/suO4QuOzzuY/PeiRTor6VFIJ

Therefore, my questions are:
1.) Is it possible to load a model from a .lp file into pyomo, and do what I described?
2.) If not, is this supported with some other file format (note, that the first of my programs supports different solvers, but does not use pyomo).
3.) If neither of the above, can you suggest a different way to accomplish what I described?

Best,
René

Siirola, John D

unread,
Dec 1, 2016, 11:27:04 AM12/1/16
to pyomo...@googlegroups.com

René,

 

1)      Nope. That post is still correct.  LP files are “flat” representations of a model, and there really hasn’t been a strong motivation to import that into a structured system like Pyomo.  It’s not impossible to write an LP file reader, but none exist (nor are any under development).

2)      Not really.  Pyomo models are structured Python objects.  Solver interface formats tent to be “flat” representations (i.e., no sets) that are not terribly efficient to represent directly in a structured language like Pyomo.  As a result, we do not have “model importers” from other languages.  That said, GAMS provides a “GAMS to Pyomo” converter that will take a GAMS model and output a flat Pyomo model.

3)      Not really.  Of course, the best option would be for your programs to output Pyomo models directly (or potentially any another AML) – then you could use the AML to manipulate the models and combine them.  You might be able to do it directly using the LP files with a bit of scripting/programming, but that would require a lot assumptions about the compatibility of the two LP files (e.g., could you actually *find* the constraints that you are interested in, plus I would have concerns about correlating the variable names between the two files).

 

john

 

From: pyomo...@googlegroups.com [mailto:pyomo...@googlegroups.com] On Behalf Of René
Sent: Thursday, December 01, 2016 8:36 AM
To: Pyomo Forum <pyomo...@googlegroups.com>
Subject: [EXTERNAL] Load model from .lp file

 

Hello,

I'm in the situation that I have two seperate programs that create ILPs:
The first program creates a large ILP and writes it out to a .lp file.

The second program creates an alternative formulation for a part of the large ILP.



Now, I would like to read in the .lp file of the first ILP with pyomo and replace some of its constraints with constraints that are generated by the second program.

However, I haven't found any documentation on how to read a model from a .lp file, only this thread from 2012 which says that it is not possible: https://groups.google.com/forum/#!searchin/pyomo-forum/load$20lp|sort:relevance/pyomo-forum/suO4QuOzzuY/PeiRTor6VFIJ

Therefore, my questions are:
1.) Is it possible to load a model from a .lp file into pyomo, and do what I described?
2.) If not, is this supported with some other file format (note, that the first of my programs supports different solvers, but does not use pyomo).
3.) If neither of the above, can you suggest a different way to accomplish what I described?

Best,
René

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

René

unread,
Dec 1, 2016, 4:59:07 PM12/1/16
to Pyomo Forum
Thank you for the quick clarification!
Reply all
Reply to author
Forward
0 new messages