-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Munkres' assignment algorithm (hungarian method) -- -- The Munkres algorithm solves the weighted minimum matching problem in -- a complete bipartite graph, in O(n^3) time. This problem is often -- called the 'assignment problem'. See eg. -- http://en.wikipedia.org/wiki/Hungarian_algorithm. @package Munkres @version 0.1 -- | The Munkres version of the Hungarian Method for weighted minimal -- bipartite matching. The implementation is based on Robert A. Pilgrim's -- notes, http://216.249.163.93/bob.pilgrim/445/munkres.html -- (mirror: -- http://www.public.iastate.edu/~ddoty/HungarianAlgorithm.html). module Data.Algorithm.Munkres -- | Needs a rectangular array of nonnegative weights, which encode -- the weights on the edges of a (complete) bipartitate graph. The -- indexing should start from (1,1). Returns a minimal matching, -- and the cost of it. -- -- Unfortunately, GHC is opposing hard the polymorphicity of this -- function. I think the main reasons for that is that the there is no -- Unboxed type class, and thus the contexts IArray UArray -- e and MArray (STUArray s) e (ST s) do not know about -- each other. (And I have problems with the forall s part, -- too). hungarianMethodInt :: UArray (Int, Int) Int -> ([(Int, Int)], Int) hungarianMethodFloat :: UArray (Int, Int) Float -> ([(Int, Int)], Float) hungarianMethodDouble :: UArray (Int, Int) Double -> ([(Int, Int)], Double) -- | The same as 'hungarianMethod<Type>', but uses boxed values (thus -- works with any data type which an instance of Real). The usage -- of one the unboxed versions is recommended where possible, for -- performance reasons. hungarianMethodBoxed :: (Real e, IArray a e) => a (Int, Int) e -> ([(Int, Int)], e)