0

我在这里停留是在互联网上搜索了 3 天试图找到我确定已经存在的东西的结果,但我找不到它。

首先,我不是程序员。我是 35 年前,但不再是。

这就是问题所在:15 名男孩和 15 名女孩坐在男孩/女孩/男孩/女孩 6 到一张有 5 张桌子的桌子上,然后让每个人换成不同的男孩/女孩/男孩/女孩最多 4 次。

所以我的逻辑是:

  1. 数字 1 到 30,赔率是男孩,偶数是女孩——这些应该是可变但相等的,这意味着并不总是会有 30 个孩子,而是从 12 到 80 的任何地方(总是能被 2 整除,所以总会有一双)。
  2. 从男孩/女孩总数中随机将 1 个男孩与 1 个女孩配对,无需重复。
  3. 将结果分组为 5 组,每组 6 组。
  4. 然后再重复这个过程最多四次,同时永远不要匹配之前配对的相同的两个男孩/女孩组合。

有人知道这是否可能吗?如果是这样,它可以在 Excel 中完成吗?如果没有,独立的 Windows 程序的建议也会起作用。

我正在尝试为慈善活动做这件事,在这些活动中,青少年男孩和女孩在结识新朋友的同时进行社交活动。他们来自世界各地,我正在努力让他们认识每个人。

几年来我一直在手动执行此操作,但似乎永远无法使其始终成功。我的程序员认为必须有针对这个问题的编程解决方案。

我将不胜感激您能提供的任何建议。

4

1 回答 1

0

After doing a bit more digging, this appears to be a variation of the Social Golfer Problem. There are several algorithms out there, some relying on brute force or heuristics. It should absolutely be doable in VBA, but you can probably find existing code/apps out there to accomplish the task.

I'll continue looking into this, but let us know if you find an online "scheduler" that solves your problem.

Edit:

This could be one solution for 6 tables of 5 kids, but it won't ensure the half boy/girl constraint. According to this results page:

For m groups of n players where m < n, it is impossible to find a group of n players for week 2 who all come from different week 1 groups (since there are only m of them).

For m groups of n players, each player plays with n-1 other players each week. Since there are a total of mn-1 other players, this means a player runs out of partners after (mn-1)/(n-1) weeks.

Therefore 5 groups of 6 kids would have repeats. By the 2nd formula, a kid would run out of partners after 5 turns.

5 weeks play in 6 groups of 5 golfers

[ 1 2 3 4 5 | 6 7 8 9 10 | 11 12 13 14 15 | 16 17 18 19 20 | 21 22 23 24 25 | 26 27 28 29 30]

[ 1 6 11 16 21 | 2 7 12 17 26 | 3 8 13 22 27 | 4 9 18 23 28 | 5 14 19 24 29 | 10 15 20 25 30]

[ 1 8 12 20 28 | 2 6 14 22 30 | 3 9 11 17 24 | 4 7 16 25 29 | 5 15 18 21 27 | 10 13 19 23 26]

[ 1 14 17 25 27 | 2 9 13 20 21 | 3 10 12 18 29 | 4 6 15 24 26 | 5 8 16 23 30 | 7 11 19 22 28]

[ 1 9 15 22 29 | 2 10 16 24 27 | 3 7 14 20 23 | 4 12 19 21 30 | 5 6 13 17 28 | 8 11 18 25 26]

于 2012-07-24T20:59:49.790 回答