Is there some standard Python (i.e., numarray/Numeric) mapping for some linear programming package out there? Might be rather useful... -- Magnus Lie Hetland Fall seven times, stand up eight http://hetland.org [Japanese proverb]
Magnus Lie Hetland wrote:
Is there some standard Python (i.e., numarray/Numeric) mapping for some linear programming package out there? Might be rather useful...
My Google-fu does not reveal an obvious one. There does seem to be a recent one in which the authors wrote their own matrix object! http://www.ee.ucla.edu/~vandenbe/cvxopt/ -- Robert Kern rkern@ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter
Robert Kern <rkern@ucsd.edu>:
Magnus Lie Hetland wrote:
Is there some standard Python (i.e., numarray/Numeric) mapping for some linear programming package out there? Might be rather useful...
My Google-fu does not reveal an obvious one.
Neither did mine ;) I did find pysimplex, though... But that's not really what I'm after, I guess.
There does seem to be a recent one in which the authors wrote their own matrix object!
Oh, no! 8-| Hm. Maybe this is a use-case for the new buffer stuff? Exposing the bytes of their arrays shouldn't be so hard... Easier than introducing numpy arrays of some sort, I should think ;)
Hm. They support sparse matrices too. Interesting. Thanks for the tip! -- Magnus Lie Hetland Fall seven times, stand up eight http://hetland.org [Japanese proverb]
On Tue, 29 Mar 2005, Magnus Lie Hetland wrote:
Is there some standard Python (i.e., numarray/Numeric) mapping for some linear programming package out there? Might be rather useful...
It is certainly not a standard one but some years ago I wrote a wrapper to cddlib: http://cens.ioc.ee/projects/polyhedron/ I haven't used it with recent versions of Numeric or Python though. Pearu
Em Ter, 2005-03-29 às 17:19 +0200, Magnus Lie Hetland escreveu:
Is there some standard Python (i.e., numarray/Numeric) mapping for some linear programming package out there? Might be rather useful...
Hello, I have written a very simple wrapper to COIN/CLP (www.coin-or.org) based on swig. I am using this code in my own research. It is simple, but it is good enough for me. I will clean it up a little and "release" it this week. Please enter in contact by Friday with me. Here is a sample code using the wrapper: --- Sample code --- from numarray import * import Coin s = Coin.OsiSolver() # Define objective and variables bounds ncols = 2 obj = array([-1.0, -1.0]) col_lb = array([0.0, 0.0]) col_ub = s.getInfinity()*array([1.0, 1.0]) # Define constraints nrows = 2 row_lb = -s.getInfinity()*array([1.0, 1.0]) row_ub = array([3.0, 3.0]) matrix = Coin.CoinPackedMatrix(0, 0, 0) matrix.setDimensions(0, ncols) row1 = Coin.CoinPackedVector() row1.insert(0, 1.0) row1.insert(1, 2.0) matrix.appendRow(row1) row2 = Coin.CoinPackedVector() row2.insert(0, 2.0) row2.insert(1, 1.0) matrix.appendRow(row2) # Load Problem s.loadProblem(matrix, col_lb, col_ub, obj, row_lb, row_ub) # Write mps model. s.writeMps('example') # Solve problem s.initialSolve() # Print optimal value. print 'Optimal value: ', s.getObjValue() print 'Solution: ', s.getColSolution() --- End sample --- Note that I am using the COIN's sparce matrix and vector so as to use sparcity in the CLP solver. Best, Paulo -- Paulo José da Silva e Silva Professor Assistente do Dep. de Ciência da Computação (Assistant Professor of the Computer Science Dept.) Universidade de São Paulo - Brazil e-mail: pjssilva@ime.usp.br Web: http://www.ime.usp.br/~pjssilva Teoria é o que não entendemos o (Theory is something we don't) suficiente para chamar de prática.(understand well enough to call practice)
participants (4)
-
Magnus Lie Hetland
-
Paulo J. S. Silva
-
pearu@cens.ioc.ee
-
Robert Kern