Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

hungarian algorithm python

>>> cost = np.array([[4, 1, 3], [2, 0, 5], [3, 2, 2]])
>>> from scipy.optimize import linear_sum_assignment
>>> row_ind, col_ind = linear_sum_assignment(cost)
>>> col_ind
array([1, 0, 2])
>>> cost[row_ind, col_ind].sum()
5
Source by docs.scipy.org #
 
PREVIOUS NEXT
Tagged: #hungarian #algorithm #python
ADD COMMENT
Topic
Name
6+9 =