A list with two entries: score, the score of the optimal matching;
and matching, the columns matched to each row of the matrix in turn.
Details
The Linear Assignment Problem seeks to match each row of a matrix with a
column, such that the cost of the matching is minimized.
The Jonker & Volgenant approach is a faster alternative to the Hungarian
algorithm (Munkres 1957), which is implemented in clue::solve_LSAP().
Note: the JV algorithm expects integers. In order to apply the function
to a non-integer n, as in the tree distance calculations in this package,
each n is multiplied by the largest available integer before applying
the JV algorithm. If two values of n exhibit a trivial difference --
e.g. due to floating point errors -- then this can lead to interminable
run times. (If numbers of the magnitude of billions differ only in their
last significant digit, then the JV algorithm may undergo billions of
iterations.) To avoid this, integers over 2^22 that differ by a value of
8 or less are treated as equal.
NB. At present, only square matrices are supported; if you need support for
non-square matrices, drop a note at
issue #25
and I'll prioritize development.