def visualize_forward_induction():
"""Illustration graphique de l'induction avant."""
fig, axes = plt.subplots(1, 2, figsize=(14, 5))
# Gauche: Arbre de jeu
ax1 = axes[0]
# Positions
positions = {
'root': (2, 3),
'out': (0, 2),
'game': (4, 2),
'j2_s': (3, 1),
'j2_h': (5, 1),
'ss': (2.5, 0),
'sh': (3.5, 0),
'hs': (4.5, 0),
'hh': (5.5, 0)
}
labels = {
'root': 'J1\n(In/Out)',
'out': f'({outside},{outside})',
'game': 'J1\n(S/H)',
'j2_s': 'J2',
'j2_h': 'J2',
'ss': '(4,4)',
'sh': '(0,3)',
'hs': '(3,0)',
'hh': '(3,3)'
}
colors = {
'root': 'lightblue',
'out': 'lightgray',
'game': 'lightblue',
'j2_s': 'lightgreen',
'j2_h': 'lightgreen',
'ss': 'gold',
'sh': 'lightgray',
'hs': 'lightgray',
'hh': 'lightyellow'
}
# Dessiner les noeuds
for node, pos in positions.items():
ax1.scatter(*pos, s=1500, c=colors[node], zorder=5, edgecolors='black')
ax1.annotate(labels[node], pos, ha='center', va='center', fontsize=9, zorder=6)
# Aretes
edges = [
('root', 'out', 'Out'),
('root', 'game', 'In'),
('game', 'j2_s', 'S'),
('game', 'j2_h', 'H'),
('j2_s', 'ss', 'S'),
('j2_s', 'sh', 'H'),
('j2_h', 'hs', 'S'),
('j2_h', 'hh', 'H')
]
for n1, n2, label in edges:
x1, y1 = positions[n1]
x2, y2 = positions[n2]
ax1.plot([x1, x2], [y1, y2], 'k-', linewidth=1.5)
ax1.annotate(label, ((x1+x2)/2, (y1+y2)/2 + 0.15), fontsize=9)
# Ellipse infoset J2
from matplotlib.patches import Ellipse
ellipse = Ellipse((4, 1), 3, 0.8, fill=False, linestyle='--',
edgecolor='red', linewidth=2)
ax1.add_patch(ellipse)
ax1.annotate('Infoset J2', (4, 0.3), ha='center', color='red', fontsize=10)
ax1.set_xlim(-0.5, 6.5)
ax1.set_ylim(-0.5, 3.5)
ax1.axis('off')
ax1.set_title('Arbre de jeu', fontsize=12)
# Droite: Raisonnement
ax2 = axes[1]
ax2.axis('off')
text = f"""
INDUCTION AVANT : SIGNAL CONDITIONNEL
1. J1 choisit In au lieu de Out ({outside}).
2. Gain maximal de Hare : {max_hare}.
Gain maximal de Stag : {max_stag}.
3. Seul Stag peut dépasser Out. Sous une
hypothèse de rationalité stricte, J2
infère Stag et répond Stag.
4. Ce calcul ne détermine pas les croyances
ni tous les équilibres du jeu complet.
"""
ax2.text(0.1, 0.95, text, transform=ax2.transAxes, fontsize=11,
verticalalignment='top', fontfamily='monospace')
ax2.set_title('Raisonnement par induction avant', fontsize=12)
plt.tight_layout()
plt.show()
visualize_forward_induction()
2.2 Comment Rendre une Menace Credible?