From 4b6ec2bb822dfa2a38a6253e30e41c5b1226956c Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 26 Mar 2021 09:00:18 -0700 Subject: [PATCH 1/8] Update citations.md --- citations.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/citations.md b/citations.md index 9b32cddbb..f0cd69f52 100644 --- a/citations.md +++ b/citations.md @@ -1,5 +1,9 @@ # Citations +### 2021 + +* Glynatsi, Nikoleta E., and Vincent A. Knight. "A bibliometric study of research topics, collaboration, and centrality in the iterated prisoner’s dilemma." Humanities and Social Sciences Communications 8.1 (2021): 1-12. [Nature.com](https://www.nature.com/articles/s41599-021-00718-9) [ArXiv](https://arxiv.org/abs/1911.06128) + ### 2020 * Krapohl, Sebastian, Václav Ocelík, and Dawid M. Walentek. "The instability of globalization: applying evolutionary game theory to global trade cooperation." [Public Choice](https://ideas.repec.org/a/kap/pubcho/vyid10.1007_s11127-020-00799-1.html) (2020): 1-21. @@ -10,8 +14,8 @@ ### 2019 -* T.J. Gaffney, Marc Harper, Vincent A. Knight. "Memory depth of finite state machine strategies for the iterated prisoner's dilemm" arXiv preprint arxiv:1912.04493 (2019). [ArXiv](https://arxiv.org/abs/1912.04493) -* Glynatsi, Nikoleta E., and Vincent A. Knight. "A bibliometric study of research topics, collaboration and influence in the field of the Iterated Prisoner's Dilemma" arXiv preprint arXiv:1911.06128 (2019). [ArXiv](https://arxiv.org/abs/1911.06128) +* Thomas, Robert W., and José M. Vidal. "Ad Hoc Vehicle Platoon Formation." [2019 SoutheastCon. IEEE](Emergence and Stability of Self-Evolved Cooperative Strategies using Stochastic Machines) (2019) +* T.J. Gaffney, Marc Harper, Vincent A. Knight. "Memory depth of finite state machine strategies for the iterated prisoner's dilemma" arXiv preprint arxiv:1912.04493 (2019). [ArXiv](https://arxiv.org/abs/1912.04493) * O'Neil, Daniel A., and Mikel D. Petty. "Synthesizing Social Networks with Iterated Prisoners' Dilemma." [Proceedings of the International Conference on Modeling, Simulation and Visualization Methods (MSV).](https://csce.ucmss.com/cr/books/2019/LFS/CSREA2019/MSV2345.pdf) The Steering Committee of The World Congress in Computer Science, Computer Engineering and Applied Computing (WorldComp), 2019. * Collins, David. "A Genetic Algorithm Approach to the Iterated Prisoner’s Dilemma." [Undergraduate Research in Natural and Clinical Science and Technology Journal](https://urncst.com/index.php/urncst/article/view/155) (2019): 1-9. * Wang, Shiheng, and Fangzhen Lin. "Invincible Strategies of Iterated Prisoner's Dilemma." Proceedings of the 18th International Conference on Autonomous Agents and MultiAgent Systems. International Foundation for Autonomous Agents and Multiagent Systems, 2019. [ArXiv](https://arxiv.org/abs/1712.06488) @@ -24,12 +28,11 @@ * Latorre, Julian F. and Ospina, Juan Pablo and Ortiz, Jorge E. "A Coalitional Game for Achieving Emergent Cooperation in Ad Hoc Networks Through Sympathy and Commitment." Springer (2018). [Springer](https://link.springer.com/chapter/10.1007/978-3-030-00350-0_30) * Moura, Jose, and David Hutchison. "Game Theory for Multi-Access Edge Computing: Survey, Use Cases, and Future Trends." IEEE Communications Surveys & Tutorials (2018). [IEEE CS&T](https://ieeexplore.ieee.org/abstract/document/8424815) [ArXiv](https://arxiv.org/abs/1704.00323) * Neumann, Shai and Sood, Suraj and Hollander, Markus et al. "Using Bots in Strategizing Group Compositions to Improve Decision--Making Processes" Springer (2018). [Springer](https://link.springer.com/chapter/10.1007/978-3-319-91467-1_24) -* Nicolas, Anastassacos and Mirco, Musolesi. "Learning through Probing: a decentralized reinforcement learning architecture for social dilemmas."arXiv preprint arXiv:1809.10007 (2018). [ArXiv](https://arxiv.org/abs/1809.10007) +* Nicolas, Anastassacos and Mirco, Musolesi. "Learning through Probing: a decentralized reinforcement learning architecture for social dilemmas." arXiv preprint arXiv:1809.10007 (2018). [ArXiv](https://arxiv.org/abs/1809.10007) * Skiba, Grażyna, et al. "Flexible asynchronous simulation of iterated prisoner’s dilemma based on actor model." Simulation Modelling Practice and Theory 83 (2018): 75-92. ### 2017 -* Hayes, Victoria. The Evolution of Cooperation: A Recreation of Axelrod's Computer Tournament. The University of North Carolina at Greensboro, (2017). [PDF](http://libres.uncg.edu/ir/uncg/f/Hayes_uncg_0154M_12243.pdf) * Harper, Marc, et al. "Reinforcement learning produces dominant strategies for the Iterated Prisoner’s Dilemma." PloS one 12.12 (2017): e0188046. [PLOS](http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0188046) ### 2016 @@ -40,8 +43,9 @@ * Knight, Vincent. "Playing Games: A Case Study in Active Learning Applied to Game Theory." [MSOR Connections 14.1 (2015): 28-38](https://journals.gre.ac.uk/index.php/msor/article/download/254/254). -### Other Preprints and Disserations +### Disserations -* Thomas, Robert W., and José M. Vidal. "Ad Hoc Vehicle Platoon Formation." (2019) [Preprint](http://jmvidal.cse.sc.edu/papers/thomas19a.pdf) +* Glynatsi, Nikoleta. "Understanding responses to environments for the Prisoner's Dilemma: A meta analysis, multidimensional optimisation and machine learning approach". PhD Thesis, Cardiff University. (2020) [Available Online](http://orca.cf.ac.uk/135221/). +* Santana, Jonas Cardoso Carvalho. "Aprendizado de máquina e o dilema dos prisioneiros". (2020) * Black, Ben. "An Empirical Evaluation of the Ohtsuki-Nowak Approximation." [Master's Thesis](https://www.lancaster.ac.uk/~blackb/documents/MScDiss.pdf). (2018). -* Zakirov, Bahti. "Modes of Information Flow." (2017) [Preprint](http://london.ucdavis.edu/~reu/REU17/Papers/zakirov.pdf) +* Hayes, Victoria. The Evolution of Cooperation: A Recreation of Axelrod's Computer Tournament. The University of North Carolina at Greensboro, (2017). [PDF](http://libres.uncg.edu/ir/uncg/f/Hayes_uncg_0154M_12243.pdf) From 569c23e265861cb639f20d57bba4d91e5e7ac3d6 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 26 Mar 2021 09:07:11 -0700 Subject: [PATCH 2/8] Another citation --- citations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/citations.md b/citations.md index f0cd69f52..8a818fd38 100644 --- a/citations.md +++ b/citations.md @@ -6,6 +6,7 @@ ### 2020 +* Kies, Martin. "Finding Best Answers for the Iterated Prisoner’s Dilemma Using Improved Q-Learning." [Available at SSRN 3556714](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3556714) (2020). * Krapohl, Sebastian, Václav Ocelík, and Dawid M. Walentek. "The instability of globalization: applying evolutionary game theory to global trade cooperation." [Public Choice](https://ideas.repec.org/a/kap/pubcho/vyid10.1007_s11127-020-00799-1.html) (2020): 1-21. * Glynatsi, Nikoleta E., and Vincent A. Knight. "A meta analysis of tournaments and an evaluation of performance in the Iterated Prisoner's Dilemma" arXiv preprint arXiv:2001.05911 (2019). [ArXiv](https://arxiv.org/abs/2001.05911) * Wang, Shiheng, and Fangzhen Lin. "Nice Invincible Strategy for the Average-Payoff IPD." [Proceedings of the AAAI Conference on Artificial Intelligence](https://aaai.org/ojs/index.php/AAAI/article/view/5604) From 6ac633a50c6e4218889966e99a85768ff7bcfc97 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 26 Mar 2021 09:20:52 -0700 Subject: [PATCH 3/8] Add another master's dissertation to citations.md --- citations.md | 1 + 1 file changed, 1 insertion(+) diff --git a/citations.md b/citations.md index 8a818fd38..c4589e6a4 100644 --- a/citations.md +++ b/citations.md @@ -50,3 +50,4 @@ * Santana, Jonas Cardoso Carvalho. "Aprendizado de máquina e o dilema dos prisioneiros". (2020) * Black, Ben. "An Empirical Evaluation of the Ohtsuki-Nowak Approximation." [Master's Thesis](https://www.lancaster.ac.uk/~blackb/documents/MScDiss.pdf). (2018). * Hayes, Victoria. The Evolution of Cooperation: A Recreation of Axelrod's Computer Tournament. The University of North Carolina at Greensboro, (2017). [PDF](http://libres.uncg.edu/ir/uncg/f/Hayes_uncg_0154M_12243.pdf) +* Latorre Ochoa, Julian Felipe. "Compromiso y simpatía: emotividad en la toma de decisiones cooperativas en redes estocásticas de siguiente generación". [Available online](https://repositorio.unal.edu.co/handle/unal/60956) (2017) From f1f838d376047a0b1b9a0b346ae0109e79e091ef Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 29 Mar 2021 15:54:20 +0100 Subject: [PATCH 4/8] Add type hints. This fixes the two errors: ``` axelrod/fingerprint.py:444: error: Function "numpy.array" is not valid as a type 22 axelrod/fingerprint.py:444: note: Perhaps you need "Callable[...]" or a callback protocol? 23 Found 1 error in 1 file (checked 1 source file) ``` and: ``` axelrod/strategies/ann.py:125: error: Incompatible types in assignment (expression has type "ndarray", variable has type "List[int]") 34 Found 1 error in 1 file (checked 1 source file) ``` note that in `fingerprint.py` I'm using the `ArrayType` type but that when I tried to use that in `ann.py` a lot of other things broke. --- axelrod/fingerprint.py | 6 ++++-- axelrod/strategies/ann.py | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/axelrod/fingerprint.py b/axelrod/fingerprint.py index 8ef34d60b..61d1ae92a 100644 --- a/axelrod/fingerprint.py +++ b/axelrod/fingerprint.py @@ -16,6 +16,8 @@ from axelrod.strategy_transformers import DualTransformer, JossAnnTransformer from mpl_toolkits.axes_grid1 import make_axes_locatable +from numpy.typing import ArrayLike + Point = namedtuple("Point", "x y") @@ -188,7 +190,7 @@ def _generate_data(interactions: dict, points: list, edges: list) -> dict: return point_scores -def _reshape_data(data: dict, points: list, size: int) -> np.ndarray: +def _reshape_data(data: dict, points: list, size: int) -> ArrayLike: """Shape the data so that it can be plotted easily. Parameters @@ -441,7 +443,7 @@ def fingerprint( filename: str = None, progress_bar: bool = True, seed: int = None, - ) -> np.array: + ) -> ArrayLike: """Creates a spatial tournament to run the necessary matches to obtain fingerprint data. diff --git a/axelrod/strategies/ann.py b/axelrod/strategies/ann.py index d2e368bcc..97bcb09d0 100644 --- a/axelrod/strategies/ann.py +++ b/axelrod/strategies/ann.py @@ -22,7 +22,7 @@ def num_weights(num_features, num_hidden): return size -def compute_features(player: Player, opponent: Player) -> List[int]: +def compute_features(player: Player, opponent: Player) -> np.ndarray: """ Compute history features for Neural Network: * Opponent's first move is C @@ -91,7 +91,7 @@ def compute_features(player: Player, opponent: Player) -> List[int]: total_player_c = player.cooperations total_player_d = player.defections - return [ + return np.array(( opponent_first_c, opponent_first_d, opponent_second_c, @@ -109,20 +109,19 @@ def compute_features(player: Player, opponent: Player) -> List[int]: total_player_c, total_player_d, len(player.history), - ] + )) def activate( bias: List[float], hidden: List[float], output: List[float], - inputs: List[int], + inputs: np.ndarray, ) -> float: """ Compute the output of the neural network: output = relu(inputs * hidden_weights + bias) * output_weights """ - inputs = np.array(inputs) hidden_values = bias + np.dot(hidden, inputs) hidden_values = relu(hidden_values) output_value = np.dot(hidden_values, output) From 986c29430434d8fcc3e8742c82d90e6721e904c2 Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 29 Mar 2021 15:56:51 +0100 Subject: [PATCH 5/8] Run isort and black. --- axelrod/fingerprint.py | 1 - axelrod/strategies/ann.py | 40 ++++++++++++++++++++------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/axelrod/fingerprint.py b/axelrod/fingerprint.py index 61d1ae92a..e161fdaa6 100644 --- a/axelrod/fingerprint.py +++ b/axelrod/fingerprint.py @@ -15,7 +15,6 @@ ) from axelrod.strategy_transformers import DualTransformer, JossAnnTransformer from mpl_toolkits.axes_grid1 import make_axes_locatable - from numpy.typing import ArrayLike Point = namedtuple("Point", "x y") diff --git a/axelrod/strategies/ann.py b/axelrod/strategies/ann.py index 97bcb09d0..e838ec09e 100644 --- a/axelrod/strategies/ann.py +++ b/axelrod/strategies/ann.py @@ -91,25 +91,27 @@ def compute_features(player: Player, opponent: Player) -> np.ndarray: total_player_c = player.cooperations total_player_d = player.defections - return np.array(( - opponent_first_c, - opponent_first_d, - opponent_second_c, - opponent_second_d, - my_previous_c, - my_previous_d, - my_previous2_c, - my_previous2_d, - opponent_previous_c, - opponent_previous_d, - opponent_previous2_c, - opponent_previous2_d, - total_opponent_c, - total_opponent_d, - total_player_c, - total_player_d, - len(player.history), - )) + return np.array( + ( + opponent_first_c, + opponent_first_d, + opponent_second_c, + opponent_second_d, + my_previous_c, + my_previous_d, + my_previous2_c, + my_previous2_d, + opponent_previous_c, + opponent_previous_d, + opponent_previous2_c, + opponent_previous2_d, + total_opponent_c, + total_opponent_d, + total_player_c, + total_player_d, + len(player.history), + ) + ) def activate( From 8a1b5d282a0ba1a64fc7140399e56732b3f2c3ef Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 29 Mar 2021 16:26:11 +0100 Subject: [PATCH 6/8] Mock numpy.typing in sphinx docs. --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 0e33e21c3..e32f807ac 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,6 +29,7 @@ "numpy", "numpy.linalg", "numpy.random", + "numpy.typing", "pandas", "pandas.util", "pandas.util.decorators", From a22dc0cd012d6f8e8b99124abbde0ca3a263fd97 Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 29 Mar 2021 16:35:51 +0100 Subject: [PATCH 7/8] Remove ArrayLike. Note we can also remove it from the docs. --- axelrod/fingerprint.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/axelrod/fingerprint.py b/axelrod/fingerprint.py index e161fdaa6..638707f57 100644 --- a/axelrod/fingerprint.py +++ b/axelrod/fingerprint.py @@ -15,7 +15,6 @@ ) from axelrod.strategy_transformers import DualTransformer, JossAnnTransformer from mpl_toolkits.axes_grid1 import make_axes_locatable -from numpy.typing import ArrayLike Point = namedtuple("Point", "x y") @@ -189,7 +188,7 @@ def _generate_data(interactions: dict, points: list, edges: list) -> dict: return point_scores -def _reshape_data(data: dict, points: list, size: int) -> ArrayLike: +def _reshape_data(data: dict, points: list, size: int) -> np.ndarray: """Shape the data so that it can be plotted easily. Parameters @@ -442,7 +441,7 @@ def fingerprint( filename: str = None, progress_bar: bool = True, seed: int = None, - ) -> ArrayLike: + ) -> np.ndarray: """Creates a spatial tournament to run the necessary matches to obtain fingerprint data. From 532c6f618e818704e4aa8698f96af44f13f2d102 Mon Sep 17 00:00:00 2001 From: Vince Knight Date: Mon, 29 Mar 2021 16:36:22 +0100 Subject: [PATCH 8/8] Remove mocking of numpy.typing from docs. No longer necessary. --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index e32f807ac..0e33e21c3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,6 @@ "numpy", "numpy.linalg", "numpy.random", - "numpy.typing", "pandas", "pandas.util", "pandas.util.decorators",