如何用 LaTex 绘制博弈树,尤其是包含信息集的博弈树?

如何用 LaTex 绘制博弈树,尤其是包含信息集的博弈树?

我在创建这样的游戏树时遇到了麻烦。你能帮我解决吗?我将不胜感激! 在此处输入图片描述

答案1

正如@jlab所说,你可以使用森林包来对树结构进行建模。完成此操作后,您只需在相应的虚线节点之间绘制一条路径,并在右侧添加说明注释。

在此处输入图片描述

\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{trees,calc}

\begin{document}
    \begin{tikzpicture}
        % styling options
        [
        every path/.style={thick},
        round node/.style={fill=black,circle,draw,inner sep=1.5},
        level distance=15mm,
        level 1/.style={sibling distance=35mm},
        level 2/.style={sibling distance=15mm},
        level 3/.style={sibling distance=10mm},
        ]
        
        % general tree structure
        \node[round node] (level1) {}
        child {node[round node] (level2) {}
            child {node[round node] (level3) {}
                child {node[round node,label=below:{$1$}] {} edge from parent node[left] {$a_1$}}
                child {node[round node,label=below:{$0$}] {} edge from parent node[right] {$a_2$}}
                edge from parent node[above left] {$s_1$}
            }
            child {node[round node] (level32) {}
                child {node[round node,label=below:{$0$}] {} edge from parent node[left] {$a_1$}}
                child {node[round node,label=below:{$1$}] {} edge from parent node[right] {$a_2$}}
                edge from parent node[above right] {$s_2$}
            }
            edge from parent node[left] {$t_1$}
        }
        child {node[round node] {}
            child {node[round node] (level33) {}
                child {node[round node,label=below:{$1$}] {} edge from parent node[left] {$a_1$}}
                child {node[round node,label=below:{$0$}] {} edge from parent node[right] {$a_2$}}
                edge from parent node[above left] {$s_1$}
            }
            child {node[round node] (level34) {}
                child {node[round node,label=below:{$0$}] {} edge from parent node[left] {$a_1$}}
                child {node[round node,label=below:{$1$}] (lowright) {} edge from parent node[right] {$a_2$}}
                edge from parent node[above right] {$s_2$}
            }
            edge from parent node[right] {$t_2$}
        };
        
        % annotations to the right
        \coordinate (legendX) at ($(lowright)+(1.5,0)$);
        \node at (legendX|-level1) {Nature};
        \node at (legendX|-level2) {Sender};
        \node at (legendX|-level3) {Receiver};
        \node at (legendX) {Payoff};
        
        % dashed lines
        \path[draw, dashed, bend left, gray] (level3) to (level33);
        \path[draw, dashed, bend right, gray] (level32) to (level34);
    \end{tikzpicture}
\end{document}

答案2

istgame

在此处输入图片描述

\documentclass{standalone}

\usepackage{istgame}

\begin{document}

\begin{istgame}
\xtShowEndPoints
%% game tree
\xtdistance{20mm}{60mm}
\istroot(0)
  \istb{t_1}[al] \istb{t_2}[ar] \endist
\xtdistance{20mm}{30mm}
\istroot(1)(0-1)
  \istb{s_1}[al] \istb{s_2}[ar] \endist
\istroot(2)(0-2)
  \istb{s_1}[al] \istb{s_2}[ar] \endist
\xtdistance{20mm}{15mm}
\istroot(3)(1-1)
  \istb{a_1}[l]{1} \istb{a_2}[r]{0} \endist
\istroot(4)(1-2)
  \istb{a_1}[l]{1} \istb{a_2}[r]{0} \endist
\istroot(5)(2-1)
  \istb{a_1}[l]{1} \istb{a_2}[r]{0} \endist
\istroot(6)(2-2)
  \istb{a_1}[l]{1} \istb{a_2}[r]{0} \endist
%% information sets
\xtCInfoset(3)(5)
\xtCInfoset(6)(4)
%% right text
\xtTimeLineH[draw=none](0){0}{6}{Nature}
\xtTimeLineH[draw=none](1){0}{6}{Sender}
\xtTimeLineH[draw=none](3){0}{6}{Receiver}
\xtTimeLineH[draw=none](3-1){0}{6}{Payoff}    
\end{istgame}

\end{document}

相关内容