分组数字的算法(制作团队) [英] Algorithm for Grouping Numbers (Making Teams)

查看:74
本文介绍了分组数字的算法(制作团队)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在编写一个应用程序,根据他们的辛苦

分数将人员分配给团队。球队有8人,有2支队伍。 (我希望它是灵活的,但这是一个开始)。我需要一个能够创建2个
团队的算法,以便每个团队的总得分尽可能接近。


任何想法?


谢谢!

We are writing an app that assigns people to teams based on their curent
score. Teams are 8 people, there are 2 teams. (i would like it to be
flexible, but this is a start). I need an algorithm that creates the 2
teams such that the total score for each team is as close as possible.

Any ideas??

Thanks!

推荐答案

有趣的问题!我们可能会得到多个结果。无论如何,一个

重要的排队,每个队伍应该有四个人,或者这个数字是无限制的吗?例如,一个大家伙VS七个小宝宝?


卢克

微软在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)

Interesting question! We may get multiple results for the it. Anyway, a
important queation, should each team have four people, or the number is
unlimited? For example, a big guy VS seven little babies?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


实际上,在这种情况下,我们是一个游戏中心,设置了Day of Defeat

锦标赛,所以它总是8 v 8.我们正在写一个字符串解析器

从中获取统计数据本轮的服务器日志,然后我们需要重新分配

团队,使他们尽可能。获胜者是获得最高分的

个人。


谢谢!


Kevin
< a rel =nofollowhref =http://www.thetek.comtarget =_ blank> www.thetek.com

" MSFT" <卢****** @ online.microsoft.com>在消息中写道

新闻:wR ************* @ cpmsftngxa06.phx.gbl ...
Actually, in this situation, we are a gaming center setting up Day of Defeat
tournament, so it will always be 8 v 8. We are writign a string parser that
pulls stats out of the Server Log for the round, then we need to re-assign
teams such that they are ''as even as possible''. The winner is the
individual with the best score.

Thanks!

Kevin
www.thetek.com
"MSFT" <lu******@online.microsoft.com> wrote in message
news:wR*************@cpmsftngxa06.phx.gbl...
有趣的问题!我们可能会得到多个结果。无论如何,一个重要的排队,每队应该有四个人,还是数量无限?例如,一个大家伙VS七个小宝宝?

卢克
微软在线支持

获得安全! www.microsoft.com/security
(此帖已提供按原样,没有保证,也没有授予
权利。)
Interesting question! We may get multiple results for the it. Anyway, a
important queation, should each team have four people, or the number is
unlimited? For example, a big guy VS seven little babies?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



a写道:
我们是编写一个应用程序,根据他们的科目分数将人员分配给团队。球队有8人,有2支队伍。 (我希望它是灵活的,但这是一个开始)。我需要一个能够创建2个团队的算法,以便每个团队的总分尽可能接近。

任何想法??
We are writing an app that assigns people to teams based on their curent
score. Teams are 8 people, there are 2 teams. (i would like it to be
flexible, but this is a start). I need an algorithm that creates the 2
teams such that the total score for each team is as close as possible.

Any ideas??



这是垃圾箱包装问题的变化,众所周知,它很难(NP)。

http://www.nist.gov/dads/HTML/binpacking.html


然而,您应该根据规则找到许多有用的算法

of thumb。


例如。订购人员从最高分到最低分,第一个分配给团队1,

接下来的两个团队2和从那里交替。


(或唱歌)对你自己说eanie meanie minie moe,......同时指着每个人b $ b的人......)


如果你问的话,你从16开始选择8(不考虑

顺序),可能的组合数量是组合16 C 8



16

C

8




(16)<
(8)


取决于你在学校的教学内容。


即16 * 15 * 14 * 13 * 12 * 11 * 10 * 9

除以8 * 7 * 6 * 5 * 4 * 3 * 2 * 1

即13 * 11 * 10 * 9 = 12870


所以分析所有12870组合(暴力)将在今天的b
计算机上运行。


当然,在一般情况下,你不需要更多的人r团队要求b $ b使暴力行为变得棘手。


-

问候,

Mark Hurd ,B.Sc。(Ma。)(荣誉)



That''s a variation on the bin packing problem, which is known to be hard (NP).

http://www.nist.gov/dads/HTML/binpacking.html

Nevertheless, you should find a number of useful algorithms based upon rules
of thumb.

Eg. Order the people from highest score to lowest, assign the first to team 1,
the next two to team 2 and alternate from there.

(Or sing to yourself "eanie meanie minie moe, ..." while pointing at each
person...)

In the case you ask about, you''re choosing 8 from 16 (without regard to
order), and the number of possible combinations is the combinatorical 16 C 8
or
16
C
8

or

(16)
( 8)

depending upon what you were taught at school.

That is 16 * 15 * 14 * 13 * 12 * 11 * 10 * 9
divided by 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1
which is 13 * 11 * 10 * 9 = 12870

So analysing all 12870 combinations ("brute force") will be fine on today''s
computers.

Of course, in the general case, you don''t need many more people or teams to
make brute force intractable.

--
Regards,
Mark Hurd, B.Sc.(Ma.) (Hons.)


这篇关于分组数字的算法(制作团队)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆