Search code examples
javascipyhungarian-algorithm

scipy.optimize.linear_sum_assignment equivalent in Java


I'm trying to re-write a python algorithm to Java for some needs.

In python algorithm I have the following code :

row_ind, col_ind = linear_sum_assignment(cost)

linear_sum_assignment is a scipy function

Do you guys know an equivalent of that function in java ? I found this one but I didn't get the row indice and column indice in this one.


Solution

  • I finaly managed to do it with this HungarianAlgorithms and the following code :

    // Using Hungarian Algorithm assign the correct detected measurements
    // to predicted tracks
    int[] assigmentL = new HungarianAlgorithm(cost).execute();
    List<Integer> assigment = Lists.newArrayList(Ints.asList(assigmentL));