views:

334

answers:

2

Since an assignment problem can be posed in the form of a single matrix, I am wandering if numpy has a function to solve such a matrix. So far I have found none. Maybe one of you guys know if numpy/scipy has an assignment-problem-solve function?

Edit: In the meanwhile I have found a python (not numpy/scipy) implementation at http://www.clapper.org/software/python/munkres/. Still I suppose a numpy/scipy implementation could be much faster, right?

A: 

No, NumPy contains no such function. Combinatorial optimization is outside of NumPy's scope. It may be possible to do it with one of the optimizers in scipy.optimize but I have a feeling that the constraints may not be of the right form.

NetworkX probably also includes algorithms for assignment problems.

dwf
A: 

There is an implementation of the Munkres' algorithm as a python extension module which has numpy support. I've used it successfully on my old laptop. However, it does not work on my new machine - I assume there is a problem with "new" numpy versions (or 64bit arch).

Peter Prettenhofer