-
Notifications
You must be signed in to change notification settings - Fork 158
Issue 522 #524
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?
Issue 522 #524
Conversation
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.
I've written a few implementation comments. However, I am coming back conceptually to the comments I made after your talk a few months ago. I'm now not sure that power
(defined like this) is the concept we want, but rather its complement.
Also as a tip: The "Closes #XXX" needs to be in the commit message to auto-close an issue, not in the covering description of the PR.
@@ -169,6 +169,7 @@ Information about the game | |||
Action.precedes | |||
Action.prob | |||
Action.plays | |||
Action.power |
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.
This should be Action.veto
@@ -109,9 +109,18 @@ class Action: | |||
|
|||
@property | |||
def plays(self) -> typing.List[Node]: | |||
"""Returns a list of all terminal `Node` objects consistent with it. | |||
"""Returns a list of all terminal `Node` objects consistent with the action. |
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.
Simpler is just to say 'terminal nodes' rather than 'terminal Node objects'
""" | ||
return [ | ||
Node.wrap(n) for n in | ||
self.action.deref().GetInfoset().deref().GetGame().deref().GetPlays(self.action) | ||
] | ||
|
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.
Docstring has not been updated.
It would be useful to write a brief explanation of what the 'veto' of an action is here - a few lines so the documentation is self-contained
@@ -143,3 +143,18 @@ def test_action_plays(): | |||
} # paths=[0, 1, 0], [0, 1] | |||
|
|||
assert set(test_action.plays) == expected_set_of_plays | |||
|
|||
|
|||
def test_action_veto(): |
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.
This explanation would be better put in the docstring of veto rather than in the tests.
|
||
|
||
def test_action_veto(): | ||
"""Verify `action.veto` returns the action's veto |
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 useful to have a few test fixtures rather than a single test (see other examples throughout the test suite for setting up fixtures). In particular think about potential edge cases - e.g. actions at the root node, actions at singleton information sets versus nontrivial information sets, so on.
Implement, for a given action, its veto
Considering the implementation details of
strategy.power
, it appears optimal to define firststrategy.veto
as the union of vetos of corresponding actions the strategy assigns and then generatestrategy.power
as its complement.Thus,
action.power
appears to be redundant.