Python Linear Programming on Ubuntu

Aaron "Castironpi" Brady castironpi at gmail.com
Wed Sep 17 04:44:36 CEST 2008


On Sep 16, 9:25 pm, Fett <FettMan... at gmail.com> wrote:
> On Sep 16, 9:00 pm, "Aaron \"Castironpi\" Brady"
>
>
>
> <castiro... at gmail.com> wrote:
> > On Sep 16, 8:50 pm, Fett <FettMan... at gmail.com> wrote:
>
> > > I am trying to find a wrapper to do linear programming within python.
> > > I am using an ubuntu machine and I have apt-get'd lp_solve, which
> > > works just fine. If someone knows of a wrapper that will work with
> > > that that'd be great.
>
> > > I also heard that scipy has a wrapper, however, I can't find any
> > > documentation on it, nor can I seem to find it with dir(). If anyone
> > > knows where there is good documentation on this I would love to use
> > > that (the more native to python the better imo).
>
> > > I have tried many things, includinghttp://lpsolve.sourceforge.net/5.5/Python.htm,
> > > openopt, and cvxopt. I can't seem to find any with enough
> > > documentation to get me off the ground. Some I can't compile, some I
> > > can't even find out how to compile.
>
> > > If anyone knows of an LP package (preferably with IP as well, like
> > > lp_solve has), that interfaces well with python and has enough
> > > documentation to get a dependency newb like myself off the ground that
> > > would be great.
>
> > Google says:
>
> > about 254,000 for linear programming python.
>
> > Link 3 is:
>
> >http://wiki.python.org/moin/NumericAndScientific/Libraries
>
> > Scroll down.
>
> Yes, many of those seem to be deprecated, without destinations to
> links, most are poorly or not documented at all. The few that are, I
> still can't get running. Of those 254, I think I have tried at least
> 10 pages worth. Still no luck.
>
> # lpsolvpy - Can't get it to compile - dependency problems.
> # Lp_solve5 - NO python binding yet. Volunteers needed for python
> bindings.
> # pycplex - You need to compile the CPX.so module. Change the required
> paths to CPLEX, Python and numpy in the Makefile, and type "make". Not
> sure what to do here.
> # GLPK (GNU Linear Programming Kit) - Hrm... might be something here,
> I missed the second link to the python bindings, looked all over the
> glpk site for anything about python.
> # SciPy --http://www.scipy.org- supposedly has this, but as I said,
> I can't find any mention of it anywhere but on the site you linked.
> # pySimplex - (broken link)(broken link)
> # Simplex - link is broken, but nothing is mentioned
>
> I'll take a closer look at glpk's python bindings and if there is any
> documentation on them, maybe I'll have some luck. btw, I have been
> looking for something that works, I have over 5 packages on my desktop
> that I have tried to get up and running, but none of them seem to
> work. glpk makes 6.

If you can find one working in C, use ctypes to link into Python.  We
can help you with that part.  It lets you pass primitive types,
structs, arrays, pointers, to C modules and return values.  You need
to know the C signatures to set up the Pythonized signatures.



More information about the Python-list mailing list