使用可用的库求解最小组合封面 [英] Solving minimum set cover using available libraries
问题描述
我想解决一个实例的最小设置封面.作为一种可能,是否存在将问题表示为二部图并使用networkx的方法?
更新在评论中建议使用dlx(跳舞链接).谁能举一个小小的工作示例,说明如何使用dlx解决最小集覆盖问题?
设置覆盖可以映射到图形上的任何NP完全问题,但这并不意味着您将能够有效地解决它.您是否有理由不直接关注眼前的问题(即掩盖问题)?
也许是这样的: https://pypi.org/project/dlx/ >
可以使用以下命令进行安装:pip install dlx或easy_install dlx
I would like to solve an instance of minimum set cover. As one possibility, is there some way of formulating the problem as a bipartite graph and using networkx?
Update Using dlx (dancing links) was suggested in the comments. Can anyone give a small working example of how to solve the minimum set cover problem using dlx?
Set cover can be mapped to any NP-complete problem on a graph, but that doesn't mean you'll be able to solve it efficiently. Is there a reason you don't focus directly on the problem at hand (ie, set cover)?
Maybe something like: https://pypi.org/project/dlx/
This can be installed using: pip install dlx or easy_install dlx
这篇关于使用可用的库求解最小组合封面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!