Expand description
Rectangular linear assignment problem (LAP).
Shortest augmenting path method of Jonker–Volgenant, in the rectangular form
described by Crouse (2016), “On implementing 2D rectangular assignment
algorithms”, IEEE TAES 52(4). This is the same algorithm as
scipy.optimize.linear_sum_assignment.
For an nr x nc matrix, min(nr, nc) pairs are returned, so every row (or
every column, whichever side is smaller) is matched. Costs are widened to an
accumulator type (Cost::Acc): f64 for floating-point input, i64 for
integer input. Integer arithmetic is checked: unrepresentable intermediate
values or total costs return LapError::Overflow. If JV dual updates
overflow, solving restarts with the shortest augmenting path method.
For floating-point input, +inf marks a forbidden pair; NaN and -inf
are rejected (+inf when maximizing is rejected too, -inf marks a
forbidden pair instead).
Square matrices without forbidden entries are first reduced with the
Jonker–Volgenant (1987) initialisation (column reduction, reduction
transfer, augmenting row reduction); the remaining rows are augmented by
shortest paths. The optimum is the same either way, but ties may be broken
differently from scipy; use LapSolver::with_jv_init(false) to
reproduce scipy’s assignment exactly.
Structs§
- Duals
- Dual potentials of the last solve, in the original orientation and sign.
- LapSolution
- An optimal assignment.
- LapSolver
- Reusable solver: keeps its buffers between calls, which matters for the many small LAPs of the k-assignment heuristics.
- Matrix
View - Read-only 2-D view with arbitrary (possibly negative) element strides.
Enums§
- LapError
- Errors returned by the solver and by
MatrixViewconstructors. - Sense
- Optimization direction.
Traits§
Functions§
- linear_
sum_ assignment - Solve one LAP. Use
LapSolverto reuse buffers across many calls.