Skip to content

Add make_infoset and rewrite information-set operations in terms of it - #999

Open
d-kad wants to merge 6 commits into
gambitproject:masterfrom
d-kad:make_infoset
Open

Add make_infoset and rewrite information-set operations in terms of it#999
d-kad wants to merge 6 commits into
gambitproject:masterfrom
d-kad:make_infoset

Conversation

@d-kad

@d-kad d-kad commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description of the changes in this PR

Adds Game.make_infoset(nodes, player, label=None), which forms a set of personal decision nodes
into a single information set. This is the primitive for editing information structure;
leave_infoset, set_infoset, set_player, and reveal are rewritten in terms of it.

Behavior changes:

  • set_infoset now requires the node's actions to match the target infoset's, with the same labels in the same order
    (previously only the count was checked), and rejects terminal and chance nodes.
  • reveal now raises on an absent-minded information set (previously the result was undefined).

Adds tests for make_infoset and for the four rewritten operations, which previously had little or no coverage.

Implemented in Cython over existing C++ operations; a native C++ MakeInfoset and the choice of which derived operations to retain are the following steps.

@tturocy tturocy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is mostly looking good. Are there any places in our existing tutorials or other materials where we should be using make_infoset in place of the other functions we are defining in terms of make_infoset?

See the main PR thread for other higher-level questions/next steps.

Comment thread tests/games.py
return g


def create_two_pair_infosets_efg() -> gbt.Game:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to avoid introducing more games to this file - we want to be removing them actually. Can this test be accomplished by another existing catalog game, or if not, we should make such functions utility functions located close to the test(s) they are relevant for.

Comment thread tests/test_node.py
assert list(proxy.members) == [node]


def test_leave_infoset_sole_member_is_noop():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move these under test_infosets, as they are manipulations of information structure.

(Overall our organisation of tests by the type of object is not ideal anyway.)

Comment thread ChangeLog
information set; the primitive operation for editing information structures.

### Changed
- `Game.leave_infoset`, `Game.set_infoset`, `Game.set_player`, and `Game.reveal` are now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation detail changes are probably not important. Changes to user-visible behaviour are, but ideally would be individual bullet points as they're actually logically separate (but I agree doing them all at once by thinking about edge cases while reimplementing makes sense rather than proliferating PRs)

@tturocy

tturocy commented Jul 28, 2026

Copy link
Copy Markdown
Member

The next action on this is to push the implementation of MakeInfoset into C++. This will allow us to unblock removing the other infoset-related actions by calling MakeInfoset from the GUI.

A new complementary issue #1009 provides a proposed way forward of dealing with nodes which heretofore we have called "chance infosets".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants