-
Notifications
You must be signed in to change notification settings - Fork 1.1k
InfostateTree python bind #1054
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
InfostateTree python bind #1054
Conversation
|
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. |
|
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. |
7fbb749 to
12b7139
Compare
|
Going through some very old PRs. Not sure why we never imported this. @maichmueller can you merger changes from master or resubmit? |
6b8aee0 to
390e81a
Compare
|
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. |
|
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
390e81a to
9025b70
Compare
|
@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. |
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)