梦幻足球优化算法的想法

发布于 2024-12-07 06:34:15 字数 445 浏览 4 评论 0原文

所以,这与标准的梦幻足球有点不同。我拥有的是球员名单、他们的平均“每场得分”(PPG)和他们的薪水。我想在我的球队不超过工资帽的情况下最大化每场比赛的得分。一支球队由 1 个 QB、1 个 TE、3 个 WR 和 2 个 RB 组成。因此,如果每个位置有 15 个,我们就有 15X15 X(15 c 3)X(15 c 2) = 10749375 个可能的团队。

计算相当复杂。我可以使用一些分支定界,即一旦团队超过工资上限,我就可以修剪树,但即使这样,算法仍然相当慢。我尝试了另一种选择,我使用“遗传算法”,即随机组成 10 支球队,选择最好的一支并将其“变异”(随机改变一些球员)为另外 10 支球队,然后挑选这些球队,然后循环一组直到“最佳球队”的场均得分不再进步。

必须有更好的方法来做到这一点。我不是计算机科学家,我只学过算法学入门课程。程序员——你的想法是什么?我有一种感觉,动态规划的某种应用可能会有所帮助。

谢谢

So, this is a bit different than standard fantasy football. What I have is a list of players, their average "points per game" (PPG) and their salary. I want to maximize points per game under the constraint that my team does not exceed a salary cap. A team consists of 1 QB, 1 TE, 3 WRs, and 2 RBs. So, if we have 15 of each position we have 15X15 X(15 c 3)X(15 c 2) = 10749375 possible teams.

Pretty computationally complex. I can use a bit of branch and bound i.e. once a team has surpassed the salary cap I can trim the tree, but even with that the algorithm is still pretty slow. I tried another option where I used a "genetic algorithm" i.e. made 10 random teams, picked the best one and "mutated" it (randomly changing some of the players) into another 10 teams and then picked of those and then looped through a bunch of times until the points per game of the "best team" stopped getting better.

There must be a better way to do this. I'm not a computer scientist and I've only taken an intro course in algorithmics. Programmers - what are your thoughts? I have a feeling that some sort of application of dynamic programming could help.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

面犯桃花 2024-12-14 06:34:15

我认为智能实施的遗传算法将为您带来可接受的结果。您可能想要使用每美元薪水点数等指标而不是直接 PPG 来决定最佳团队。通过这种方式,您本质上是在衡量附加值。此外,您应该考虑多次运行完整的算法/突变以令人满意地完成,以便您可以识别最终结果中一致出现的玩家。那么这些球员应该比其他球员更受重视。

当然,genec 方法的问题是您需要一个好的变异算法,并且这对于您想要如何实现它来说是高度个人化的。

I think a genetic algorithm, intelligently implemented, will yield an acceptable result for you. You might want to use a metric like points per salary dollar rather than straight PPG to decide the best team. This way you are inherently measuring value added. Also, you should consider running the full algorithm/mutation to satisfactory completion numerous times so that you can identity what players consistently show up in the final outcomes. These players then should be valued above others.

Of course the problem with the genetc approach Is that you need a good mutation algorithm and that is highly personal for how you want to implement it.

请帮我爱他 2024-12-14 06:34:15

取i为n名球员中当前的球员人数,j为当前剩余的工资。取 m[i, j] 为动态解集。

Then m[i, 0] = 0, m[0, j] = 0
and

m[i, j] = m[i - 1, j] if salary for player i is greater than j

else

m[i, j] = max ( m[i - 1, j], m[i - 1, j - salary of player i] + PPG of player i)

抱歉,我不懂 R,但我很擅长算法,所以我希望这会有所帮助。

您可以进行的进一步优化是,您实际上只需要 2 行 m[i, j],因为 DP 解决方案仅使用当前行和最后一行(这样可以节省内存)

Take i as the current number of players out of n players and j to be the current remaining salary that is left. Take m[i, j] to be the dynamic set of solutions.

Then m[i, 0] = 0, m[0, j] = 0
and

m[i, j] = m[i - 1, j] if salary for player i is greater than j

else

m[i, j] = max ( m[i - 1, j], m[i - 1, j - salary of player i] + PPG of player i)

Sorry that I don't know R but I'm good with algorithms so I hope this helps.

A further optimization you can make is that you really only need 2 rows of m[i, j] because the DP solution only uses the current row and the last row (you can save memory this way)

安静被遗忘 2024-12-14 06:34:15

首先,您提供的变体不应该是正确的。组建球队的最佳方式是通过有限的方式限制位置,而且绝对没有在他们之间移动 3 个相似位置的球员的感觉。

克里斯蒂安·罗纳尔多、苏亚雷斯和梅西在任何阵容中都会给你同等的幻想积分,例如:
克里斯蒂安·罗纳尔多、苏亚雷斯和梅西
或者
苏亚雷斯、克里斯蒂安·罗纳尔多和梅西
或者
梅西、苏亚雷斯、罗纳尔多

第一步——简化变化的可能性。
下一步——计算平均价格,并通过添加工资较低但价格较高的球员来逐一组建球队。当达到工资限制时,删除昂贵的并添加更便宜但具有相同幻想点的 - 等等。不要建立变化,通过工资和幻想点的结合来评估每个球员的权重。

First of all, the variation you have provided should not be right. Best way to build team is limit positions by limited plus there is absolutely no sense of moving 3 similar positions players between themselves.

Christian Ronaldo, Suarez and Messi will give you the equal sum of fantasy points in any line-up, like:
Christian Ronaldo, Suarez and Messi
or
Suarez, Christian Ronaldo and Messi
or
Messi, Suarez, Ronaldo

First step - simplify the variation possibility.
Next step - calculate the average price, and build the team one by one by adding player with lower salary but higher price. When reach salary limit, remove expensive one and add cheaper but with same fantasy points - and so on. Don't build the variation, value the weight of each player by combination of salary and fantasy points.

眼泪也成诗 2024-12-14 06:34:15

这有帮助吗?它设置了约束并最大化分数。

您可以进行调整以从 Excel 中获取数据

http:// pena.lt/y/2014/07/24/mathematically-optimising-fantasy-football-teams
24/07/14/数学优化幻想足球队

Does this help? It sets up the constraints and maximises points.

You could adapt to get data out of excel

http://pena.lt/y/2014/07/24/mathematically-optimising-fantasy-football-teams
14/07/24/mathematically-optimising-fantasy-football-teams

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文