1

我正在尝试解决与此处示例非常相似的问题: https ://pythonhosted.org/PuLP/CaseStudies/a_set_partitioning_problem.html

这使用称为 PuLP 的优化框架在婚礼上为客人分配座位。

为了提供一些背景信息,我有 N 位客人,T 桌,每桌最多 S 位。我有一个成本矩阵(N x N),它表示每位客人想与另一位客人坐在一起的程度。

在第一个代码部分,他们正在创建所有可能表的列表:

possible_tables = [tuple(c) for c in pulp.allcombinations(guests, max_table_size)]

这对我来说没有意义。我没想到候选表的生成会在算法之外完成。

这与仅仅N choose K生成候选者、使用成本矩阵对生成的表进行评分并选择最佳表有很大不同吗?

我不限于使用纸浆。I've looked at cvxpy, jump, mini-zinc, etc. I'm just having trouble how to formulate the objective and constraint when there is such interaction among elements of selected sets (it's as if items in the knap-sack problem hated或相爱!)

4

0 回答 0