Minimum-weight perfect matchings and the matching bound for metric TSP #
A perfect matching on a duplicate-free list O of vertices is a list of edges M whose
endpoints (Cslib.Algorithms.Lean.VertexCover.endpoints) are a permutation of O: every vertex
of O is an endpoint of exactly one edge, and no other vertex is. Its weight under a cost δ is
(M.map fun e => δ e.1 e.2).sum.
A key combinatorial step after [WS11], proof of Theorem 2.13, is
two_mul_sum_le_cycleCost: under the triangle inequality, a minimum-weight perfect matching on
O costs at most half of any tour visiting every vertex of O. The tour, shortcut to O, has an
even number of edges, which alternate between two perfect matchings on O.
minPerfectMatching computes a minimum-weight perfect matching by exhaustive search.
Model #
Vertices form any type with decidable equality, and costs are natural numbers. Perfect matchings are lists of ordered pairs; for a symmetric cost the orientation of an edge does not matter.
Limitations #
minPerfectMatching tries every way to match the first vertex and recurses, so on 2k vertices
it examines (2k - 1)!! = (2k - 1) (2k - 3) ⋯ 1 matchings. A polynomial-time algorithm
(Edmonds' weighted blossom algorithm, [Edm65]) is not formalized (tracked in #2869 and
#3337); the results here certify optimality of exhaustive search, not polynomial running time.
Main definitions #
Cslib.Algorithms.Lean.TSP.minPerfectMatching: a minimum-weight perfect matching by exhaustive search.
Main results #
Cslib.Algorithms.Lean.Euler.degree_eq_count_endpoints: the degree of a vertex in a multigraph counts its occurrences among the endpoints.two_mul_sum_le_cycleCost: a minimum-weight perfect matching onOcosts at most half of any closed walk without repetitions that visits every vertex ofO.endpoints_minPerfectMatching_perm: exhaustive search returns a perfect matching on lists of even length.sum_minPerfectMatching_le: for a symmetric cost, it weighs at most any perfect matching.
References #
The degree of a vertex in a multigraph is its number of occurrences among the endpoints.
The matching bound #
Combinatorial matching bound (a step after [WS11], proof of Theorem 2.13):
under the triangle inequality, a minimum-weight perfect matching on the vertices of O, all
visited by a closed walk q without repetitions, costs at most half of q. Shortcut q to the
vertices of O; the resulting closed walk has an even number of edges, which split into two
perfect matchings on O. No symmetry of δ is needed.
Exhaustive search #
Minimum-weight perfect matching by exhaustive search: match the first vertex with each
other vertex in turn, match the rest recursively, and keep a lightest result (the first one among
ties). The recursion makes at most fuel rounds; fuel k suffices for lists of length at most
2 * k. On 2k vertices this examines (2k - 1)!! matchings and is not Edmonds'
polynomial-time weighted blossom algorithm ([Edm65], tracked in #2869 and #3337).
Optimality of exhaustive search: for symmetric δ and fuel for half the length of O,
minPerfectMatching weighs at most any perfect matching on O.