Skip to content

Conversation

@maichmueller
Copy link
Contributor

This PR would bring bindings for the infostate tree class to the python module pyspiel.

The following classes would be bound by this PR:

InfostateTree
InfostateTreeNode
InfostateNodeType (enum)

TreeplexVector< double >
LeafVector< double >
DecisionVector< double>

TreeplexVector< py::object >
LeafVector< py::object >
DecisionVector< py::object >

SequenceId
DecisionId
LeafId

Range< SequenceId >
Range< DecisionId >
Range < LeafId >

kUndefinedDecisionId (constant)
kUndefinedLeafId (constant)
kUndefinedSequenceId (constant)
kDummyRootNodeInfostate (constant)
kFillerInfostate (constant)

@google-cla
Copy link

google-cla bot commented Apr 17, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@maichmueller
Copy link
Contributor Author

maichmueller commented Apr 17, 2023

I have been unsure with how to bind the InfostateNode class correctly, since it doesn't have a public constructor and is constructed only by the tree. Since the tree exposes the nodes to the client, I exported the node class as well. I opted to go for a std unique ptr mock as smart holder which does not manage the lifetime but acts like one (yet remains being copyable).

Edit: the python bindings are correctly recognized, it was an error in my env setup.

@maichmueller maichmueller force-pushed the feat/infostate_binding branch from 7fbb749 to 12b7139 Compare April 21, 2023 11:02
@maichmueller maichmueller marked this pull request as ready for review April 21, 2023 14:26
@maichmueller maichmueller changed the title InfostateTree python bind. InfostateTree python bind May 1, 2023
@lanctot
Copy link
Collaborator

lanctot commented Jan 19, 2026

Going through some very old PRs. Not sure why we never imported this. @maichmueller can you merger changes from master or resubmit?

@maichmueller maichmueller force-pushed the feat/infostate_binding branch from 6b8aee0 to 390e81a Compare January 21, 2026 11:03
@maichmueller
Copy link
Contributor Author

Hi @lanctot, I just rebased the branch back onto current master and updated the python test file location to work the new cmake style for tests.

Note that I also reworked the previous holder semantics for the node owned by the InfostateTree class. Previously, a user would have had to keep a python handle on the tree alive somewhere so that nodes dont silently disappear. Now, the nodes use aliasing shared ptrs to co-own their tree. This should ensure that the tree stays alive as long as any node is still held onto.

@lanctot
Copy link
Collaborator

lanctot commented Jan 21, 2026

Ok #1074 has been merged into master, can you please pull change and submit a merge to this branch?

previously, a user had to store a tree handle to ensure that any node stored elsewhere survives. Those nodes would be silently deleted should the tree handle ever disappear. Now, the nodes ensure the tree survives as well, so this accidental footgun disappears
@maichmueller maichmueller force-pushed the feat/infostate_binding branch from 390e81a to 9025b70 Compare January 22, 2026 10:52
@maichmueller
Copy link
Contributor Author

@lanctot, rebased and exposed the new args in infostate tree. Also made the optional args (max move limit, store_all_world_states) kw-args only, since a positional swap error already came up in my own tests. Should avoid some users getting bit by this.

@lanctot lanctot added the imported This PR has been imported and awaiting internal review. Please avoid any more local changes, thanks! label Jan 22, 2026
@lanctot lanctot merged commit faa5f90 into google-deepmind:master Jan 22, 2026
10 checks passed
@lanctot lanctot added the merged internally The code is now submitted to our internal repo and will be merged in the next github sync. label Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

imported This PR has been imported and awaiting internal review. Please avoid any more local changes, thanks! merged internally The code is now submitted to our internal repo and will be merged in the next github sync.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants