Python 中的纳什均衡

发布于 2024-10-16 02:17:45 字数 243 浏览 10 评论 0原文

是否有一个 Python 库可以解决两人零博弈的纳什均衡?我知道解决方案可以用线性约束来写,理论上,scipy 应该能够优化它。然而,对于两人零博弈,解是精确且唯一的,但某些求解器对于某些问题无法收敛。

我不想在 Python 网站上的 线性编程 上列出任何库,而是想知道哪个库是什么在易用性和速度方面最有效。

Is there a Python library out there that solves for the Nash equilibrium of two-person zero-games? I know the solution can be written down in terms of linear constraints and, in theory, scipy should be able to optimize it. However, for two-person zero-games the solution is exact and unique, but some of the solvers fail to converge for certain problems.

Rather than listing any of the libraries on Linear programing on the Python website, I would like to know what library would be most effective in terms of ease of use and speed.

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

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

发布评论

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

评论(3

油饼 2024-10-23 02:17:45

Raymond Hettinger 写了解决零和支付矩阵的方法。它应该可以满足您的目的。

至于用于解决博弈论的更通用的库,没有专门为此设计的库。但是,就像你说的,scipy 可以解决这样的优化问题。您也许可以使用 GarlicSim 做一些事情,它声称适用于“任何模拟类型:物理、博弈论……”但我以前从未使用过它,所以我不能推荐它。

Raymond Hettinger wrote a recipe for solving zero-sum payoff matrices. It should serve your purposes alright.

As for a more general library for solving game theory, there's nothing specifically designed for that. But, like you said, scipy can tackle optimization problems like this. You might be able to do something with GarlicSim, which claims to be for "any kind of simulation: Physics, game theory..." but I've never used it before so I can't recommend it.

百善笑为先 2024-10-23 02:17:45

还有 Gambit,它设置起来有点困难,但是有一个 python API。

There is Gambit, which is a little difficult to set up, but has a python API.

挽手叙旧 2024-10-23 02:17:45

我刚刚开始编写一些博弈论Python代码: http://drvinceknight.github.com/Gamepy/< /a>

有这样的代码:

  • 解决匹配游戏,
  • 计算合作游戏中的 shapley 值,
  • 运行基于代理的模拟来识别正常形式游戏中的紧急行为,
  • (笨拙地 - 我的 python foo 仍在增长)使用 lrs 库(用 C 编写: http://cgm.cs.mcgill.ca/~avis/C/lrs .html)来计算正常形式游戏的解决方案(这就是我相信你想要的)。

这些代码都可以在 github 上找到,该网站(本答案开头的第一个链接)解释了代码的工作原理并提供了用户示例。

您可能还想看看我从未使用过的“Gambit”。

I've just started putting together some game theory python code: http://drvinceknight.github.com/Gamepy/

There's code which:

  • solves matching games,
  • calculates shapley values in cooperative games,
  • runs agent based simulations to identify emergent behaviour in normal form games,
  • (clumsily - my python foo is still growing) uses the lrs library (written in C: http://cgm.cs.mcgill.ca/~avis/C/lrs.html) to calculate the solutions to normal form games (this is I believe what you want).

The code is all available on github and that site (the first link at the beginning of this answer) explains how the code works and gives user examples.

You might also want to check out 'Gambit' which I've never used.

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