我在制作 tkiz 和三名(或更多)玩家的游戏树(尤其是收益)时遇到了麻烦。对于双人游戏,我使用:
child{node[solidnode,label=below:{$\displaystyle\binom{1st payoff}{2nd payoff}$}]}
以二项式方式互相收取报酬。
但是,三人“三项式”风格怎么样?是否有任何 LaTeX/Tikz 命令可以使三人互相之间有三种结果?
这是我的完整代码,但收益是并列的,而不是相互之间的。
\documentclass[a4paper,11pt]{scrartcl}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{calc}
\usepackage{multirow}
\pagestyle{scrheadings}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1.5]
\tikzset{solidnode/.style={circle,draw,inner sep=1.5,fill=black},hollownode/.style={circle,draw,inner sep=1.5}}
\tikzstyle{level 1}=[level distance=10mm,sibling distance=50mm]
\tikzstyle{level 2}=[level distance=10mm,sibling distance=20mm]
\tikzstyle{level 3}=[level distance=10mm,sibling distance=10mm]
\tikzstyle arrowstyle=[scale=1]
\tikzstyle directed=[postaction={decorate,decoration={markings,mark=at position .5 with {\arrow[arrowstyle]{stealth}}}}]
\node(0)[hollownode,label=above:{Player 1}]{}
child{node(1)[solidnode,label=left:{Player 3}]{}
child{node[solidnode,label=below:{$(2,0,1)$}]{}edge from parent node[left]{$a$}}
child{node[solidnode,label=below:{$(-1,5,6)$}]{} edge from parent node[right]{$b$}}
edge from parent node[left,xshift=-10]{$L$}}
child{node(2)[solidnode,label=right:{Player 2}]{}
child{node(3)[solidnode,label=right:{Player 3}]{}
child{node[solidnode,label=below:{$(3,1,2)$}]{}edge from parent node[left]{$l$}}
child{node[solidnode,label=below:{$(5,4,4)$}]{} edge from parent node[right]{$r$}}
edge from parent node[left,level distance=30mm]{$a$}}
child{node(4)[solidnode,label=right:{Player 3}]{}
child{node[solidnode,label=below:{$(0,-1,7)$}]{}edge from parent node[left]{$l$} }
child{node[solidnode,label=below:{$(-2,2,0)$}]{} edge from parent node[right]{$r$}}
edge from parent node[right]{$b$}}
edge from parent node[right,xshift=10,level distance=30mm]{$R$}};
\end{tikzpicture}
\end{center}
\end{document}
非常感谢您的帮助!
答案1
这游戏该包提供了 tikz 树代码的缩写集合以及一些更方便的宏。
对我来说,没有 tikz-qtree 包看起来更好。
\documentclass[a4paper,11pt]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
%\usepackage{tikz-qtree}
%\usetikzlibrary{calc}
\usepackage{multirow}
%\pagestyle{scrheadings}
\newcommand\vpay[1]{\begin{pmatrix}#1\end{pmatrix}}
\usepackage{istgame}
\begin{document}
\begin{istgame}[scale=1.5]
\setistSolidNodeStyle{4pt} % size of solid nodes
\setistInitialNodeStyle{4pt} % size of initial nodes
\xtShowEndPoints % to show all end points
%\xtShowMidArrows % to show all middle arrows for branches
\xtdistance{10mm}{50mm} %% level 1
\istroot(0)[initial node]{Player 1} % \node(0)[hollownode,label=above:{Player 1}]{}
\istb{L}[left,xshift=-10] % edge from parent node[left,xshift=-10]{$L$}}
\istb{R}[right,xshift=10] % edge from parent node[right,xshift=10,level distance=30mm]{$R$}}
\endist
\xtdistance{10mm}{20mm} %% level 2
\istroot(1)(0-1)<left>{Player 3} % child{node(1)[solidnode,label=left:{Player 3}]{}
\istb{a}[left]{\vpay{2\\0\\1}} % child{node[solidnode,label=below:{$(2,0,1)$}]{} edge from parent node[left]{$a$}}
\istb{b}[right]{\vpay{-1\\5\\6}} % child{node[solidnode,label=below:{$(-1,5,6)$}]{} edge from parent node[right]{$b$}}
\endist
\istroot(2)(0-2)<right>{Player 2} % child{node(2)[solidnode,label=right:{Player 2}]{}
\istb{a}[left] % edge from parent node[left,level distance=30mm]{$a$}}
\istb{b}[right] % edge from parent node[right]{$b$}}
\endist
\xtdistance{10mm}{10mm} %% level 3
\istroot(3)(2-1)<left>{Player 3} % child{node(3)[solidnode,label=right:{Player 3}]{}
\istb{l}[left]{\vpay{3\\1\\2}} % child{node[solidnode,label=below:{$(3,1,2)$}]{}edge from parent node[left]{$l$}}
\istb{r}[right]{\vpay{5\\4\\4}} % child{node[solidnode,label=below:{$(5,4,4)$}]{} edge from parent node[right]{$r$}}
\endist
\istroot(4)(2-2)<right>{Player 3} % child{node(4)[solidnode,label=right:{Player 3}]{}
\istb{l}[left]{\vpay{0\\-1\\7}} % child{node[solidnode,label=below:{$(0,-1,7)$}]{}edge from parent node[left]{$l$} }
\istb{r}[right]{\vpay{-2\\2\\0}} % child{node[solidnode,label=below:{$(-2,2,0)$}]{} edge from parent node[right]{$r$}}
\endist
\end{istgame}
\end{document}
答案2
好的,我找到了一个解决方案(如果其他人遇到类似的问题):只需使用一列向量(带有pmatrix
)来表示多名玩家的大型游戏中的回报,以节省彼此之间回报的空间。
此示例代码可能有帮助:
child{node[solidnode,label=below:{$\begin{pmatrix} 2\\0\\1\\3\\4 \end{pmatrix}$}]{}edge from parent node[left]{$a$}}