an implementation of the Hungarian algorithm
This code is heavily based on Bob Pilgrim's work outlined here.
m := NewMatrix(4)
m.A = []int64{94, 93, 20, 37,
75, 18, 71, 43,
20, 29, 32, 25,
37, 72, 17, 73}
fmt.Println(ComputeMunkresMin(m)) // [{0 3} {1 1} {2 0} {3 2}]
The assignment set which minimizes the total utility is:
(0, 3) = 37
(1, 1) = 18
(2, 0) = 20
(3, 2) = 17
= 92
see LICENSE file
Brian Fallik - bfallik at clypd.com
This packages uses stretchr/testify for help with unit test assertions.
We are no longer actively maintaining this package. Please fork it if you wish to develop it further.
Thanks to clypd for agreeing to release this code into the wild.