Skip to content

Commit e7f12a6

Browse files
committed
Improve and Expand LRPLayer docstring
1 parent 6449253 commit e7f12a6

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

axelrod/strategies/zero_determinant.py

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,44 @@
66

77

88
class LRPlayer(MemoryOnePlayer):
9-
"""Abstraction for Linear Relation players. These players enforce a linear
10-
difference in stationary payoffs s * (S_xy - l) = S_yx - l, with 0 <= l <= R.
11-
The parameter `s` is called the slope and the parameter `l` the
12-
baseline payoff. For extortionate strategies, the extortion factor is the
13-
inverse of the slope.
14-
15-
This parameterization is Equation 14 in
16-
http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0077886.
17-
See Figure 2 of the article for a more in-depth explanation.
9+
"""
10+
Abstraction for Linear Relation players. These players enforce a linear
11+
difference in stationary payoffs :math:`s (S_{xy} - l) = S_{yx} - l.`
12+
13+
The parameter :math:`s` is called the slope and the parameter :math:`l` the
14+
baseline payoff. For extortionate strategies, the extortion factor
15+
:math:`\chi` is the inverse of the slope :math:`s`.
16+
17+
For the standard prisoner's dilemma where :math:`T > R > P > S` and
18+
:math:`R > (T + S) / 2 > P`, a pair :math:`(l, s)` is enforceable iff
19+
20+
.. math::
21+
:nowrap:
22+
23+
\\begin{eqnarray}
24+
&P &<= l <= R \\\\
25+
&s_{min} &= -\min\\left( \\frac{T - l}{l - S}, \\frac{l - S}{T - l}\\right) <= s <= 1
26+
\\end{eqnarray}
27+
28+
And also that there exists :math:`\\phi` such that
29+
30+
.. math::
31+
:nowrap:
32+
33+
\\begin{eqnarray}
34+
p1 &= P(C|CC) &= 1 - \\phi (1 - s)(R - l) \\\\
35+
p2 &= P(C|CD) &= 1 - \\phi (s(l - S) + (T - l)) \\\\
36+
p3 &= P(C|DC) &= \\phi ((l - S) + s(T - l)) \\\\
37+
p4 &= P(C|DD) &= \\phi (1 - s)(l - P)
38+
\\end{eqnarray}
39+
40+
41+
These conditions also force :math:`\\phi >= 0`. For a given pair :math:`(l, s)`
42+
there may be multiple such :math:`\\phi`.
43+
44+
This parameterization is Equation 14 in [Hilbe2013]_.
45+
See Figure 2 of the article for a more in-depth explanation. Other game
46+
parameters can alter the relations and bounds above.
1847
1948
Names:
2049

0 commit comments

Comments
 (0)