Repository navigation
Fix death-birth MoranProcess pairing wrong players - #1502
Open
barlowa124 wants to merge 1 commit into
Open
barlowa124 wants to merge 1 commit into
barlowa124 wants to merge 1 commit into
Conversation
In mode="db", _matchup_indices() used the enumerate position in the dead node's neighbour list as the player index, so score_all() played and credited the wrong players. Use self.index[source] so both modes use global player positions. Fixes Axelrod-Python#1499.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1499.
In
MoranProcesswithmode="db",_matchup_indices()built matchupsfrom two different index spaces:
enumerate(sources)produced positionsin the dead node's neighbour list, while
self.index[target]producedglobal player positions.
score_all()then played and credited the wrongplayers. Nothing raised, which kept it hidden.
Birth-death mode was unaffected only by accident: there
sourcescoversevery vertex, so the enumerate counter coincides with
self.index[source].The change uses
self.index[source]in both modes, so matchup pairs arealways global player positions. On the issue's reproduction (5-cycle,
player 2 dead) matchups go from
{(0, 0), (1, 4)}to{(1, 0), (3, 4)}:the dead node's neighbours (players 1 and 3) each play their own
out-neighbours, and the dead vertex is skipped.
A regression test pins the matchup set and the resulting scores in the
exact internal state
__next__creates beforescore_all().pytest axelrod/tests/unit/test_moran.pypasses: 44 tests.