How to code the maximum set packing algorithm?

前端 未结 2 1880
名媛妹妹
名媛妹妹 2020-12-09 12:21

Suppose we have a finite set S and a list of subsets of S. Then, the set packing problem asks if some k subsets in the list are pairwise disjoint . The optimization version

2条回答
  •  心在旅途
    2020-12-09 13:20

    You can solve the set packing problem searching a Maximum independent set. You encode your problem as follows:

    • for each set you put a vertex
    • you put an edge between two vertex if they share a common number.

    Then you wan't a maximum set of vertex without two having two related vertex. Unfortunately this is a NP-Hard problem. Any know algorithm is exponential.

提交回复
热议问题