MatrixGamePlot[mgame]
生成 MatrixGame mgame 的图表.
MatrixGamePlot[mgame,strat]
突出显示博弈策略 strat.
MatrixGamePlot
MatrixGamePlot[mgame]
生成 MatrixGame mgame 的图表.
MatrixGamePlot[mgame,strat]
突出显示博弈策略 strat.
更多信息和选项
- MatrixGamePlot 通常用于交流和理解矩阵博弈.
- 在双人博弈中,有一个收益向量矩阵. 每个向量代表每个玩家的收益.
- 以下是双人博弈的图表,其中收益以图表形式绘制,并根据玩家标注不同颜色:
- 策略也可以通过玩家行或列上线条的粗细来表示. 玩家动作的顺序是从上到下、从左到右:
- 当行或列上有多个玩家时,行或列用于玩家动作的每个组合:
- MatrixGamePlot 具有与 Graphics 相同的选项,但有以下添加和更改: [所有选项的列表]
-
ColorFunction Automatic 如何为每个玩家的收益着色 ColorFunctionScaling False 是否缩放 ColorFunction 的参数 GameActionLabels Automatic 用于动作的标签 GamePlayerLabels Automatic 用于玩家的标签 PlotLayout Automatic 指定方块和行的布局 PlotLegends Automatic 收益值的图例 - ColorData["DefaultPlotColors"] 给出 ColorFunction 使用的默认颜色序列.
- PlotLayout 的可能设置包括:
-

"BarChart" 将各收益方格绘制为 BarChart 
"SplitSquare" 将各收益方格绘制为分割方格 
{{r1,…,rk},{c1,…,cn-k}} 更改行玩家和列玩家 
{"SplitSquare",{{…},{…}}} 合并前两个选项 - 请注意,收益数组可以重组为一个矩阵,其中玩家 {r1,…,rk} 为行玩家, {c1,…,cn-k} 为列玩家. 例如,如果有 5 个玩家,则默认顺序可能会将前两名玩家 ({1,2}) 划分为行,将其他三个玩家 ({3,4,5}) 划分为列. 使用此选项可以更改此顺序.
所有选项的列表
范例
打开所有单元 关闭所有单元基本范例 (4)
game = MatrixGame[{{{2, 2}, {2, 1}}, {{0, 1}, {1, 2}}}]MatrixGamePlot[game]game = GameTheoryData["PrisonersDilemma"]MatrixGamePlot[game]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]game = GameTheoryData["PrisonersDilemma"]使用与 GameActionLabels 数组相同维度的数组显示策略:
MatrixGamePlot[game, {{1, 0}, {0.7, 0.3}}, PlotLayout -> "SplitSquare"]game = GameTheoryData["NashPoker"]MatrixGamePlot[game]MatrixGamePlot[game, PlotLayout -> {{1, 3}, {2}}]范围 (5)
双人博弈 (3)
game = MatrixGame[{{1, -1}, {-1, 1}}]MatrixGamePlot[game, PlotLayout -> {"SplitSquare", {{2}, {1}}}]game = MatrixGame[{{{1, 2}, {7, 3}}, {{4, 4}, {6, 3}}}]MatrixGamePlot[game]game = GameTheoryData["StagHunt"]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]多人博弈 (2)
game = MatrixGame[{{{{{1, 2, 3, 4}, {4, 3, 2, 1}}, {{4, 3, 1, 2}, {3, 1, 4, 2}}}, {{{2, 4, 3, 1}, {1, 4, 2, 3}}, {{2, 3, 1, 4}, {1, 2, 3, 4}}}}, {{{{2, 1, 4, 3}, {3, 4, 1, 2}}, {{1, 3, 4, 2}, {2, 1, 4, 3}}}, {{{3, 4, 2, 1}, {2, 4, 1, 3}}, {{4, 2, 1, 3}, {3, 1, 2, 4}}}}}]MatrixGamePlot[game]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]game = GameTheoryData["VolunteersDilemma", 4]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]选项 (6)
ColorFunction (1)
game = GameTheoryData["PrisonersDilemma"]指定 ColorData 中所示的配色方案:
MatrixGamePlot[game, ColorFunction -> 96]ColorFunctionScaling (1)
GameActionLabels (1)
GamePlayerLabels (1)
PlotLayout (1)
game = GameTheoryData["3Coordination"]MatrixGamePlot[game, {{1}, {2, 3}}, PlotLayout -> "BarChart"]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]使用玩家索引列表 {{r1,…,rk},{c1,…,cn-k}} 将 n 名玩家分组为行玩家 {r1,…,rk} 和列玩家 {c1,…,cn-k}:
MatrixGamePlot[game, PlotLayout -> {{3, 1}, {2}}]MatrixGamePlot[game, PlotLayout -> {"SplitSquare", {{3, 1}, {2}}}]PlotLegends (1)
game = GameTheoryData["PrisonersDilemma"]MatrixGamePlot[game]MatrixGamePlot[game, PlotLegends -> None]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]MatrixGamePlot[game, PlotLayout -> "SplitSquare", PlotLegends -> None]应用 (9)
休闲游戏 (2)
石头剪刀布游戏是零和博弈,要么一个玩家赢,另一个玩家输,要么平局. 绘图样式 "SplitSquare" 最适合双人博弈:
MatrixGamePlot[GameTheoryData["RockPaperScissors"], PlotLayout -> "SplitSquare", PlotLegends -> Automatic]该图使用灰色表示失败的玩家(最低值),使用鲜艳的蓝色或橙色表示获胜的玩家(最高值),使用淡橙色或淡蓝色表示平局(平均值).
通过使用图设置优势顺序,将“石头剪刀布”推广为“石头剪刀布火水”:
game = MatrixGame[Normal[# - Transpose[#]]&@WeightedAdjacencyMatrix[Graph[{"rock""scissors", "scissors""paper", "paper""rock", "scissors""water", "fire""scissors", "fire""rock", "paper""water", "rock""water", "fire""paper", "water""fire"}]]]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]社会学博弈 (1)
志愿者困境博弈描述了这样一种情况,即每个玩家都可以成为志愿者,或逃避. 如果至少有一名玩家成为志愿者,那么所有其他玩家都会从逃避中略微获益. 如果没有玩家是志愿者,那么所有玩家的收益都很低. 生成一个有四名玩家的志愿者困境博弈:
game = GameTheoryData["VolunteersDilemma", 4]对于大多数博弈来说,如果玩家在两人以上,则可视化博弈的最佳方式是使用默认的 "BarChart" 样式. 绘制博弈图:
MatrixGamePlot[game]然而,在 "SplitSquare" 样式中,玩家根据他们的选择会发生什么并不明确:
MatrixGamePlot[game, PlotLayout -> "SplitSquare"]MatrixGamePlot[game, PlotLayout -> {"SplitSquare", {{1}, {2, 3, 4}}}]MatrixGamePlot[game, PlotLayout -> {"SplitSquare", {{1}, {2, 3, 4}}}]囚徒困境 (2)
game = GameTheoryData["PrisonersDilemma"]game["Dataset"]VerifyMatrixGameStrategy[game, {{0, 1}, {0, 1}}]MatrixGamePlot[game, {{0, 1}, {0, 1}}]game = GameTheoryData["OptionalPrisonersDilemma"]MatrixGamePlot[game, PlotLayout -> "SplitSquare"]FindMatrixGameStrategies[game]FindMatrixGameStrategies[game, Method -> {"FindInstance", 5}]玩家策略 {0,0,1} 不是一个主导策略,这一点可以验证:
VerifyMatrixGameStrategy[game, {{a, b, c}, {0, 0, 1}}]然而,策略 {{0,0,1},{0,0,1}} 是纳什均衡:
VerifyMatrixGameStrategy[game, {{0, 0, 1}, {0, 0, 1}}]经济学博弈 (3)
三个饿汉去餐馆吃饭,决定在点餐之前平摊账单. 餐厅有便宜、普通和昂贵三种餐点可供选择. 将这种情况表示为 MatrixGame:
game = GameTheoryData["DinersDilemma", 3]MatrixGamePlot[game]FindMatrixGameStrategies[game]古诺寡头垄断博弈(Cournot Oligopoly game)描述了这样一种情况,一组企业生产相同商品,其中每家企业都必须考虑生产成本和其他企业的产量. 只有价格最低的企业才能卖出商品.
game = GameTheoryData["CournotOligopoly"]FindMatrixGameStrategies[game]这是符合直觉的,因为考虑到对于所有玩家来说,第二个动作的收益最大:
MatrixGamePlot[game]价格战是指这样一种博弈:多个企业都有兴趣提供最低价格,但每个企业的收益都与其选择的价格直接相关. 考虑三家企业之间的价格战,其中每家企业都可以在低价和高价之间做出选择:
game = MatrixGame[{{{{2, 2, 2}, {(8/3), (8/3), (5/3)}}, {{(8/3), (5/3), (8/3)}, {(10/3), (7/3), (7/3)}}}, {{{(5/3), (8/3), (8/3)}, {(7/3), (10/3), (7/3)}}, {{(7/3), (7/3), (10/3)}, {3, 3, 3}}}}]MatrixGamePlot[game]尽管各方的共同利益都在于尽可能提高价格,但竞争最终会在低价位形成纳什均衡:
FindMatrixGameStrategies[game]博弈中的对称性 (1)
可视化玩家收益之间对称性或差异的一种简单方法是,使用不同的行玩家和列玩家来绘制它们. 例如,考虑纯协调博弈和危险协调博弈之间的差异. 前者中玩家有相同的收益:
MatrixGamePlot[GameTheoryData["PureCoordination"], PlotLayout -> {{1}, {2}}]如果对玩家来说博弈是对称的,那么任何保持图形状的排列都应该显示出相等的收益:
MatrixGamePlot[GameTheoryData["PureCoordination"], PlotLayout -> {{2}, {1}}]相关指南
-
▪
- 博弈论
文本
Wolfram Research (2025),MatrixGamePlot,Wolfram 语言函数,https://reference.wolfram.com/language/ref/MatrixGamePlot.html.
CMS
Wolfram 语言. 2025. "MatrixGamePlot." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/MatrixGamePlot.html.
APA
Wolfram 语言. (2025). MatrixGamePlot. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/MatrixGamePlot.html 年
BibTeX
@misc{reference.wolfram_2026_matrixgameplot, author="Wolfram Research", title="{MatrixGamePlot}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixGamePlot.html}", note=[Accessed: 03-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_matrixgameplot, organization={Wolfram Research}, title={MatrixGamePlot}, year={2025}, url={https://reference.wolfram.com/language/ref/MatrixGamePlot.html}, note=[Accessed: 03-November-2026]}