https://jack.valmadre.net/notes/2020/12/08/non-perfect-linear-assignment/
\(G = (U,V,E)\)
- \(|U| = r\)
- \(|V| = n\)
- without loss of generality, assume \(r \leq n\)
- \(E(i,j) = \infty\) means no connection
- Missing edges
- \(E(i,j) = 0\) means cost is zero.
- however, given that cost can be either positive or negative, zero can be chosen.
In a matching problem, there will be \(\nu\) chosen edges.
Balanced
Balanced
means \(r = n\)
two subsets have equal cardinality
Perfect/Complete Matching
note that the problem is not actuallysolved using a general-purpose ILP(integer linear programming) solver, it is just a convenient framework in which to express the problem
Perfect/Complete matching = every vertex has a match
The constraint that the sum of each row and column is equal to one ensures that each element has exactly one match.
Unbalanced
assume \(r < n\)
an unbalanced probem cannot have a perfect matching, since there will be at least \(n-r\) unmatched elements in the larger set.
One-sided Perfect Matching
One-sided Perfect Matching
= every vertex in the smaller set has a match.
In one-sided perfect matching, \(\nu = r < n\)
What if there is no perfect matching?
Imperfect Matching(with given edge number)
- when there does not exist a (one-sided)perfect matching.
when \(\nu < r\), i.e. one-sided perfect matching cannot be achieved due to the lack of edges, all possible matchings are imperfect/incomplete.
[Note💡]: The algorithm need to achieve CERTAIN NUMBER(\(\nu\)) OF MATCHING
The constraints means that unmatched nodes on both part are allowed.
If \(\nu = r = n\), then perfect and imperfect matching coincide.
Minimum-Weight Matching(merely consider min cost)
no constraint on the size of the matching.
[Note💡]: It puts no constraint on the size of the matching.
Meeting the given \(\nu\) may force the algorithm to give up limiting the cost as small as possible, and choose a SUBOPTIMAL, yet bigger matching.
Tension between max matching-num and min cost
Add edges(imperfect -> perfect matching) may lead to bigger cost.
Transformations
Transform imperfect
and minimum-weight
matching problems into perfect
matching problems while preserving sparsity
Unbalanced/Imperfect to Balanced/Perfect
Adding $n-r$ rows of zeros
The resulting balanced graph has a perfect matching if and only if the original unbalanced graph had a matching of size \(r\)(in which every vertex in the smaller setis matched).
How to solve a Imperfect matching problem
replace the infinite edge weights with a large,finite cost
The resulting graph must contain a perfect matching since it is a completebipartite graph, and each high-cost edge is worth more than all original edges combined.
The high-cost edges(modified from nonexistent edges) can be excluded at the end.
A complete bipartite graph \(\mathbf{K}_{m,n}\) has a maximum matching of size \(\min(m,n)\).
Solve minimum-weight matching
replace all positive edges (including infinite edges) with zero
Minimum-weight matching will never select an edge with positive cost: it is better to simply leave it unselected.
Edges with zero cost have noimpact.
Behavior of scipy.optimize.linear_sum_assignment
It solved a one-sized perfect matching problem. Row/col with higher cardinality will be left partially matched.