Python Linear Programming on Ubuntu

F

Fett

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.
 
A

Aaron \Castironpi\ Brady

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.
 
R

Robert Kern

Fett said:
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
 
F

Fett

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.
 
A

Aaron \Castironpi\ Brady

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.
 
F

Fett

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.
 
J

Joachim Dahl

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
 
H

Harold Fellermann

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 -
 
M

Martin Manns

# 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top