ENH: Implement pure strategy node reachability check#632
Merged
tturocy merged 11 commits intogambitproject:masterfrom Nov 25, 2025
Merged
ENH: Implement pure strategy node reachability check#632tturocy merged 11 commits intogambitproject:masterfrom
tturocy merged 11 commits intogambitproject:masterfrom
Conversation
…nfosetParents traversal. Introduce the public method GameNodeRep::IsStrategyReachable() to query the cache.
…operty on the pygambit.Node class.
tturocy
requested changes
Nov 20, 2025
Member
tturocy
left a comment
There was a problem hiding this comment.
Internally this really needs to be implemented as a set of nodes (or subtrees) which are not reachable. Un-reachability is the exceptional case not the usual case.
tturocy
requested changes
Nov 21, 2025
tturocy
reviewed
Nov 21, 2025
tests/test_node.py
Outdated
|
|
||
| @pytest.mark.parametrize("game, expected_reachable_indices", [ | ||
| # Games without Absent-Mindedness where all nodes are reachable. | ||
| (games.read_from_file("e02.efg"), set(range(7))), |
Member
There was a problem hiding this comment.
A further thought on these tests. By definition all nodes are reachable in a game that does not have absent mindedness. This could be written as a different test that automatically just checks all nodes are reachable and that none of the information sets are absent-minded (once that feature is done).
tturocy
requested changes
Nov 24, 2025
tturocy
approved these changes
Nov 25, 2025
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.
Description.
This pull request introduces a new method,
GameNode::IsStrategyReachable(), to determine if a given node in an extensive tree form can be reached by any pure strategy profile. A node is reachable if there exists at least one pure strategy profile where the resulting path of play passes through that node. A pure strategy requires the player to choose the same action at every member node of that information set. In games with absent-mindedness, a path of play may visit the same information set multiple times, making some of the ancestors of its member nodes unreachable.The existing
GameTreeRep::BuildInfosetParents()method already handles the logic for absent-minded revisiting information sets. This traversal will be leveraged to collect the set of reachable decision nodes.Implementation Summary.
The implementation follows the design discussed in the issue:
m_reachableNodesis added toGameTreeRepGameTreeRep::BuildInfosetParents()traversal is augmented to populate this set, reusing its logic for handling absent-mindedness.GameNodeRep::IsStrategyReachable(), queries the cachepygambit.Node.is_strategy_reachableCloses #629