-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08bd7fb
commit dbd67e6
Showing
9 changed files
with
655 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...how-to/solve-with-regret-minimization.rst → docs/how-to/use-regret-minimization.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
267 changes: 267 additions & 0 deletions
267
docs/text-book/solutions/.ipynb_checkpoints/best-responses-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
221 changes: 221 additions & 0 deletions
221
docs/text-book/solutions/.ipynb_checkpoints/normal-form-games-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "7779ca3d-99a8-4014-a001-4b4c9314e39f", | ||
"metadata": {}, | ||
"source": [ | ||
"> Obtain the full game representations $(A, B)$ for the zero sum games with row play payoff matrix given by:\n", | ||
"\n", | ||
" 1. $A =\\begin{pmatrix}1 & 3\\\\ -1 & 4\\end{pmatrix}\\qquad B =\\begin{pmatrix}-1 & -3\\\\ 1 & -4\\end{pmatrix}$" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "f365cfb4-38bb-4605-b5cd-e4476bd60978", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Zero sum game with payoff matrices:\n", | ||
"\n", | ||
"Row player:\n", | ||
"[[ 1 3]\n", | ||
" [-1 4]]\n", | ||
"\n", | ||
"Column player:\n", | ||
"[[-1 -3]\n", | ||
" [ 1 -4]]" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import nashpy as nash\n", | ||
"import numpy as np\n", | ||
"\n", | ||
"A = np.array(((1, 3), (-1, 4)))\n", | ||
"B = np.array(((-1, -3), (1, -4)))\n", | ||
"game = nash.Game(A, B)\n", | ||
"game" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "206da237-a337-434b-b5f6-0b29ef992687", | ||
"metadata": {}, | ||
"source": [ | ||
" 2. $A =\\begin{pmatrix}1 & -2\\\\ -1 & 2\\end{pmatrix}\\qquad B =\\begin{pmatrix}-1 & 2\\\\ 1 & -2\\end{pmatrix}$" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "a8698c05-a30b-40e9-864b-081fbd31da42", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Zero sum game with payoff matrices:\n", | ||
"\n", | ||
"Row player:\n", | ||
"[[ 1 -2]\n", | ||
" [-1 2]]\n", | ||
"\n", | ||
"Column player:\n", | ||
"[[-1 2]\n", | ||
" [ 1 -2]]" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"A = np.array(((1, -2), (-1, 2)))\n", | ||
"B = np.array(((-1, 2), (1, -2)))\n", | ||
"game = nash.Game(A, B)\n", | ||
"game" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "07878c15-fb5d-4840-9c0d-e3fe95f1226a", | ||
"metadata": {}, | ||
"source": [ | ||
" 3. $A =\\begin{pmatrix}1 & -2 & 4\\\\ 2 & -1 & 2\\\\ 7 & -7 & 6\\end{pmatrix}\\qquad B =\\begin{pmatrix}-1 & 2 & -4\\\\ -2 & 1 & -2\\\\ -7 & 7 & -6\\end{pmatrix}$" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "fc5f7b5a-91ba-4358-b9f6-0772033fcb8c", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Zero sum game with payoff matrices:\n", | ||
"\n", | ||
"Row player:\n", | ||
"[[ 1 -2 4]\n", | ||
" [ 2 -1 2]\n", | ||
" [ 7 -7 6]]\n", | ||
"\n", | ||
"Column player:\n", | ||
"[[-1 2 -4]\n", | ||
" [-2 1 -2]\n", | ||
" [-7 7 -6]]" | ||
] | ||
}, | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"A = np.array(((1, -2, 4), (2, -1, 2), (7, -7, 6)))\n", | ||
"B = np.array(((-1, 2, -4), (-2, 1, -2), (-7, 7, -6)))\n", | ||
"game = nash.Game(A, B)\n", | ||
"game" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "7bafa50e-ac87-4ad8-a5ed-17a5b550066c", | ||
"metadata": {}, | ||
"source": [ | ||
"> `3.` Consider the game described as follows:\n", | ||
"\n", | ||
" > An airline loses two suitcases belonging to two different travelers. Both suitcases have the same value. An airline manager tasked to settle the claims of both travelers explains that the airline is liable for a maximum of £5 per suitcase. \n", | ||
"\n", | ||
" > To determine an honest appraised value of the suitcases, the manager separates both travelers and asks them to write down the amount of their value at no less than £2 and no larger than £5 (to the single dollar):\n", | ||
" > - If both write down the same number, that number as the true dollar value of both suitcases and reimburse both travelers that amount. \n", | ||
" > - However, if one writes down a smaller number than the other, this smaller number will be taken as the true dollar value, and both travelers will receive that amount along with a bonus/malus: £2 extra will be paid to the traveler who wrote down the lower value and a £2 deduction will be taken from the person who wrote down the higher amount. \n", | ||
" \n", | ||
" > Represent this as a Normal Form Game.\n", | ||
" \n", | ||
" \n", | ||
"$$\n", | ||
"A = \\begin{pmatrix}\n", | ||
"2 & 4 & 4 & 4\\\\\n", | ||
"0 & 3 & 5 & 5\\\\\n", | ||
"0 & 1 & 4 & 6\\\\\n", | ||
"0 & 1 & 2 & 5\n", | ||
"\\end{pmatrix}\n", | ||
"\\qquad\n", | ||
"B = \\begin{pmatrix}\n", | ||
"2 & 0 & 0 & 0\\\\\n", | ||
"4 & 3 & 1 & 1\\\\\n", | ||
"4 & 5 & 4 & 2\\\\\n", | ||
"4 & 5 & 6 & 5\n", | ||
"\\end{pmatrix}\n", | ||
"$$" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"id": "f1922cd9-a1ca-40ca-b1ad-c09de6b46a9d", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Bi matrix game with payoff matrices:\n", | ||
"\n", | ||
"Row player:\n", | ||
"[[2 4 4 4]\n", | ||
" [0 3 5 5]\n", | ||
" [0 1 4 6]\n", | ||
" [0 1 2 5]]\n", | ||
"\n", | ||
"Column player:\n", | ||
"[[2 0 0 0]\n", | ||
" [4 3 1 1]\n", | ||
" [4 5 4 2]\n", | ||
" [4 5 6 5]]" | ||
] | ||
}, | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"A = np.array(((2, 4, 4, 4), (0, 3, 5, 5), (0, 1, 4, 6), (0, 1, 2,5)))\n", | ||
"B = np.array(((2, 0, 0, 0), (4, 3, 1, 1), (4, 5, 4, 2), (4, 5, 6, 5)))\n", | ||
"game = nash.Game(A, B)\n", | ||
"game" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.