|
59 | 59 | "outputs": [], |
60 | 60 | "source": [ |
61 | 61 | "g = gbt.Game.new_tree(\n", |
62 | | - " players=[\"Alice\", \"Bob\"], \n", |
| 62 | + " players=[\"Alice\", \"Bob\"],\n", |
63 | 63 | " title=\"One card poker\"\n", |
64 | 64 | ")" |
65 | 65 | ] |
|
327 | 327 | }, |
328 | 328 | { |
329 | 329 | "cell_type": "code", |
330 | | - "execution_count": 61, |
| 330 | + "execution_count": 1, |
331 | 331 | "id": "3293e818", |
332 | 332 | "metadata": {}, |
333 | 333 | "outputs": [ |
334 | 334 | { |
335 | | - "data": { |
336 | | - "text/plain": [ |
337 | | - "pygambit.gambit.MixedBehaviorProfileRational" |
338 | | - ] |
339 | | - }, |
340 | | - "execution_count": 61, |
341 | | - "metadata": {}, |
342 | | - "output_type": "execute_result" |
| 335 | + "ename": "NameError", |
| 336 | + "evalue": "name 'eqm' is not defined", |
| 337 | + "output_type": "error", |
| 338 | + "traceback": [ |
| 339 | + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
| 340 | + "\u001b[31mNameError\u001b[39m Traceback (most recent call last)", |
| 341 | + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;66;03m# MixedBehaviorProfileRational is a subclass of MixedBehaviorProfile that uses rational numbers for probabilities.\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m \u001b[38;5;28mtype\u001b[39m(\u001b[43meqm\u001b[49m)\n", |
| 342 | + "\u001b[31mNameError\u001b[39m: name 'eqm' is not defined" |
| 343 | + ] |
343 | 344 | } |
344 | 345 | ], |
345 | 346 | "source": [ |
346 | | - "# Note: MixedBehaviorProfileRational is a subclass of MixedBehaviorProfile that uses rational numbers for probabilities.\n", |
| 347 | + "# MixedBehaviorProfileRational is a subclass of MixedBehaviorProfile that uses\n", |
| 348 | + "# rational numbers for probabilities.\n", |
347 | 349 | "type(eqm)" |
348 | 350 | ] |
349 | 351 | }, |
|
602 | 604 | "# Remember that Bob has a single information set\n", |
603 | 605 | "for action in g.players[\"Bob\"].infosets[0].actions:\n", |
604 | 606 | " print(\n", |
605 | | - " f\"When Bob plays {action.label} he can expect the payoff: {eqm.action_value(action)}\"\n", |
| 607 | + " f\"When Bob plays {action.label} his expected payoff is {eqm.action_value(action)}\"\n", |
606 | 608 | " )" |
607 | 609 | ] |
608 | 610 | }, |
|
636 | 638 | "source": [ |
637 | 639 | "for node in g.players[\"Bob\"].infosets[0].members:\n", |
638 | 640 | " print(\n", |
639 | | - " f\"Bob's belief in reaching the {node.parent.prior_action.label} -> {node.prior_action.label} node is: {eqm.belief(node)}\"\n", |
| 641 | + " f\"Bob's belief in reaching the {node.parent.prior_action.label} -> \"\n", |
| 642 | + " f\"{node.prior_action.label} node is: {eqm.belief(node)}\"\n", |
640 | 643 | " )" |
641 | 644 | ] |
642 | 645 | }, |
|
700 | 703 | "source": [ |
701 | 704 | "for node in g.players[\"Bob\"].infosets[0].members:\n", |
702 | 705 | " print(\n", |
703 | | - " f\"The probability that the node {node.parent.prior_action.label} -> {node.prior_action.label} is reached is: {eqm.realiz_prob(node)}. \",\n", |
704 | | - " f\"Bob's expected payoff conditional on reaching this node is: {eqm.node_value(\"Bob\", node)}\"\n", |
| 706 | + " f\"The probability that the node {node.parent.prior_action.label} -> \"\n", |
| 707 | + " f\"{node.prior_action.label} is reached is: {eqm.realiz_prob(node)}. \",\n", |
| 708 | + " f\"Bob's expected payoff conditional on reaching this node is {eqm.node_value('Bob', node)}\"\n", |
705 | 709 | " )" |
706 | 710 | ] |
707 | 711 | }, |
|
1227 | 1231 | } |
1228 | 1232 | ], |
1229 | 1233 | "source": [ |
1230 | | - "gbt.nash.liap_solve(g.mixed_behavior_profile(), maxregret=1.0e-4).equilibria[0].max_regret() / (g.max_payoff - g.min_payoff)" |
| 1234 | + "(\n", |
| 1235 | + " gbt.nash.liap_solve(g.mixed_behavior_profile(), maxregret=1.0e-4)\n", |
| 1236 | + " .equilibria[0].max_regret() / (g.max_payoff - g.min_payoff)\n", |
| 1237 | + ")" |
1231 | 1238 | ] |
1232 | 1239 | }, |
1233 | 1240 | { |
|
1260 | 1267 | " outcome[\"Alice\"] = outcome[\"Alice\"] * 2\n", |
1261 | 1268 | " outcome[\"Bob\"] = outcome[\"Bob\"] * 2\n", |
1262 | 1269 | "\n", |
1263 | | - "gbt.nash.liap_solve(g.mixed_behavior_profile(), maxregret=1.0e-4).equilibria[0].max_regret() / (g.max_payoff - g.min_payoff)" |
| 1270 | + "(\n", |
| 1271 | + " gbt.nash.liap_solve(g.mixed_behavior_profile(), maxregret=1.0e-4)\n", |
| 1272 | + " .equilibria[0].max_regret() / (g.max_payoff - g.min_payoff)\n", |
| 1273 | + ")" |
1264 | 1274 | ] |
1265 | 1275 | }, |
1266 | 1276 | { |
|
1603 | 1613 | ], |
1604 | 1614 | "metadata": { |
1605 | 1615 | "kernelspec": { |
1606 | | - "display_name": "gambitvenv313", |
| 1616 | + "display_name": "Python 3 (ipykernel)", |
1607 | 1617 | "language": "python", |
1608 | 1618 | "name": "python3" |
1609 | 1619 | }, |
|
0 commit comments