pub fn hungarian_algorithm(
cost: &Array2<f64>,
) -> AssignmentResult<(Vec<usize>, f64)>Expand description
Solve the minimum-cost assignment problem using the Hungarian algorithm.
Given an n × m cost matrix, finds an assignment of n workers to jobs
(one each) that minimises total cost. For non-square matrices the smaller
dimension is padded with zeros.
Returns (assignment, total_cost) where assignment[i] = j means row i
is assigned to column j.
Time complexity: O(n³) in the square case.
§Errors
Returns an error if the cost matrix is empty.