-
Notifications
You must be signed in to change notification settings - Fork 270
Adaptive Zero Determinant Strategy #1282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
8f9e0e0
3627b9a
863fb8a
f678fff
318e37e
9c9f3a7
60788b7
29dbfdd
f2c41e2
6982c05
9848f38
73e871f
35de1e4
0d684b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -317,3 +317,46 @@ def test_strategy(self): | |||||||||||||||
|
||||||||||||||||
actions = [(C, D), (D, C), (D, D), (D, C), (D, D), (D, C)] | ||||||||||||||||
self.versus_test(opponent=axelrod.CyclerDC(), expected_actions=actions, seed=5) | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
class TestAdaptiveZeroDet(TestPlayer): | ||||||||||||||||
""" | ||||||||||||||||
Test the AdaptiveZeroDet strategy. | ||||||||||||||||
""" | ||||||||||||||||
|
||||||||||||||||
name = "AdaptiveZeroDet: 0.125, 0.5, 3, C" | ||||||||||||||||
player = axelrod.AdaptiveZeroDet | ||||||||||||||||
expected_classifier = { | ||||||||||||||||
"memory_depth": float('inf'), | ||||||||||||||||
"stochastic": True, | ||||||||||||||||
"makes_use_of": set(['game']), | ||||||||||||||||
"long_run_time": False, | ||||||||||||||||
"inspects_source": False, | ||||||||||||||||
"manipulates_source": False, | ||||||||||||||||
"manipulates_state": False, | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we add few tests for the two specific methods: |
||||||||||||||||
def test_strategy(self): | ||||||||||||||||
R, P, S, T = axelrod.Game().RPST() | ||||||||||||||||
|
||||||||||||||||
player = self.player(l=R) | ||||||||||||||||
axelrod.seed(0) | ||||||||||||||||
match = axelrod.Match((player, axelrod.Alternator()), turns=200) | ||||||||||||||||
match.play() | ||||||||||||||||
Comment on lines
+342
to
+345
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This tests need to be tweaked so that we can check expected behaviours. There's information on writing tests here: https://axelrod.readthedocs.io/en/stable/tutorials/contributing/strategy/writing_test_for_the_new_strategy.html For example this specific paragraph would be something like (although I am not sure what the expected behaviour is):
Suggested change
Note that we could also check that the other attributes have changed accordingly using the Let me know if I can assist with that (happy to PR the tests to your branch). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree but I didn't want to search for seeds just to have to do so again once #1288 goes in. The current tests make sure that at least each branch is run (so that the limits are bounced into). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand. Are you suggesting this are place holders and we merge #1288 and then fix these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, after we merge this I'll update all the tests that require seeds in #1288 (there are many and most will have to change). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. Happy to take a share of that work if helpful. |
||||||||||||||||
|
||||||||||||||||
player = self.player(l=P) | ||||||||||||||||
axelrod.seed(0) | ||||||||||||||||
match = axelrod.Match((player, axelrod.Alternator()), turns=200) | ||||||||||||||||
match.play() | ||||||||||||||||
|
||||||||||||||||
player = self.player(s=1) | ||||||||||||||||
axelrod.seed(0) | ||||||||||||||||
match = axelrod.Match((player, axelrod.Alternator()), turns=200) | ||||||||||||||||
match.play() | ||||||||||||||||
|
||||||||||||||||
l = 2 | ||||||||||||||||
s_min = - min((T - l) / (l - S), (l - S) / (T - l)) | ||||||||||||||||
player = self.player(s=s_min, l=2) | ||||||||||||||||
axelrod.seed(0) | ||||||||||||||||
match = axelrod.Match((player, axelrod.Alternator()), turns=200) | ||||||||||||||||
match.play() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to have some more information here, perhaps an explanation of the update procedure? It's ok to go quite in depth and include some mathematics which we can then use to check that the
_adjust_parameters
method is working as expected.