linearSumAssignment

Solves the linear sum assignment problem (also known as the minimum weight matching in bipartite graphs).

This implementation uses a modified Jonker-Volgenant algorithm with no initialization, based on the shortest augmenting path approach.

Return

An array containing two IntArrays: the first one contains row indices, and the second one contains corresponding column indices of the optimal assignment.

Parameters

costMatrix

A Matrix of costs, where costMatrixi, j is the cost of assigning row i to column j.