469,649 Members | 1,209 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

Python Linear Programming on Ubuntu

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, including http://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.
Sep 17 '08 #1
8 3102
On Sep 16, 8:50*pm, Fett <FettMan...@gmail.comwrote:
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/NumericA...ific/Libraries

Scroll down.
Sep 17 '08 #2
Fett 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).
No, scipy doesn't have such a wrapper, sorry.
I have tried many things, including http://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.
PuLP should be fairly easy to build against GLPK or COIN (provided you have them
installed; I'm pretty sure Ubuntu has a GLPK package but I'm not sure about
COIN), but you will have to edit the Makefile for your system:

http://www.jeannot.org/~js/code/index.en.html#PuLP

You can ask on scipy-users about OpenOpt, and hopefully Dmitrey will be able to
help you. If you want to get cvxopt or the Python wrappers in lp_solve itself
working, I suggest asking their mailing lists.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Sep 17 '08 #3
On Sep 16, 9:00 pm, "Aaron \"Castironpi\" Brady"
<castiro...@gmail.comwrote:
On Sep 16, 8:50 pm, Fett <FettMan...@gmail.comwrote:
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/NumericA...ific/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.
Sep 17 '08 #4
On Sep 16, 9:25*pm, Fett <FettMan...@gmail.comwrote:
On Sep 16, 9:00 pm, "Aaron \"Castironpi\" Brady"

<castiro...@gmail.comwrote:
On Sep 16, 8:50 pm, Fett <FettMan...@gmail.comwrote:
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/NumericA...ific/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.
Sep 17 '08 #5
On Sep 16, 9:44 pm, "Aaron \"Castironpi\" Brady"
<castiro...@gmail.comwrote:
On Sep 16, 9:25 pm, Fett <FettMan...@gmail.comwrote:
On Sep 16, 9:00 pm, "Aaron \"Castironpi\" Brady"
<castiro...@gmail.comwrote:
On Sep 16, 8:50 pm, Fett <FettMan...@gmail.comwrote:
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/NumericA...ific/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.
Ok, it seems that I have found one (although without an integer
programming component): upon searching for glpk in the package manager
in ubuntu I found a package called cvxopt, it is a bit clunky
(compared to the niceness of lp_solve), but I think I can figure this
one out. Thanks all who answered.
Sep 17 '08 #6
CVXOPT supports ILP via GLPK or MOSEK. Documentation is in the doc-
strings
for cvxopt.glkp.ilp and cvxopt.mosek.ilp.

The ILP interfaces are not mentioned otherwise in the documentation,
as the main
focus of CVXOPT is convex solvers.

For additional questions on CVXOPT please use the discussion forum:
http://groups.google.com/group/cvxopt

best regards
Joachim

On Sep 17, 5:57*am, Fett <FettMan...@gmail.comwrote:
On Sep 16, 9:44 pm, "Aaron \"Castironpi\" Brady"

<castiro...@gmail.comwrote:
On Sep 16, 9:25 pm, Fett <FettMan...@gmail.comwrote:
On Sep 16, 9:00 pm, "Aaron \"Castironpi\" Brady"
<castiro...@gmail.comwrote:
On Sep 16, 8:50 pm, Fett <FettMan...@gmail.comwrote:
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, andcvxopt. 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 groundthat
would be great.
Google says:
about 254,000 for linear programming python.
Link 3 is:
http://wiki.python.org/moin/NumericA...ific/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-supposedlyhas 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.

Ok, it seems that I have found one (although without an integer
programming component): upon searching for glpk in the package manager
in ubuntu I found a package calledcvxopt, it is a bit clunky
(compared to the niceness of lp_solve), but I think I can figure this
one out. Thanks all who answered.
Sep 17 '08 #7
http://wiki.python.org/moin/NumericA...ific/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.
You are right that this is an unsatisfying experience. Fortunately,
the referred site is a wiki. Why don't you edit it and delete the
broken
links or add the package that did the job for you to the list, so that
others do not need to go through the same hassle.

- harold -
Sep 17 '08 #8
On Tue, 16 Sep 2008 19:25:58 -0700 (PDT)
Fett <Fe********@gmail.comwrote:
# 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.
I found OpenOpt on the site:
http://scipy.org/scipy/scikits/wiki/MILP

I downloaded the svn version and installed it on my Debian box.
There were some error messages while installing. However, the example
seems to work anyways. I am using the solver glpk from the
package python-glpk.

I hope that this works on your Ubuntu system as well.
Sep 17 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by Hung Jung Lu | last post: by
8 posts views Thread by Martin Maney | last post: by
12 posts views Thread by Claudio Grondi | last post: by
15 posts views Thread by UrsusMaximus | last post: by
3 posts views Thread by jivelasquezt | last post: by
reply views Thread by wesley chun | last post: by
9 posts views Thread by Todd Whiteman | last post: by
reply views Thread by wesley chun | last post: by
20 posts views Thread by Mr.SpOOn | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.