-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement an efficient CFR solver. #393
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
Conversation
This is due to future interfacing with neural nets, as we will not need such a high precision. Doubles are still used for CFRInfoStateValues for the moment.
…built to work properly anyway.
elkhrt
left a comment
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.
Could you revert the changes to the other algorithms and just add the new algorithm in this PR?
| // A helper struct that allows to propagate reach probs / cf values | ||
| // up and down the tree. | ||
| struct InfostateTreeValuePropagator { | ||
| // Tree and the tree structure information. These must not change! |
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 seems ugly. Shouldn't these values be parameters to the propagation function rather than members here?
| // Collects legal actions at the specified state. | ||
| ActionView(const State& state); | ||
|
|
||
| // Provides an iterator over flattened actions. This is equivalent to calling |
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 looks like unnecessary duplication.
| if __name__ == "__main__": | ||
| absltest.main() | ||
|
|
||
| # TODO checks |
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.
Please make these TODOs clearer. You can link to github issues if you want, or just write a longer description of each in-line here.
| } | ||
|
|
||
| private: | ||
| std::array<InfostateTreeValuePropagator, 2> propagators_; |
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.
What's the array for?
|
|
||
| private: | ||
| std::array<InfostateTreeValuePropagator, 2> propagators_; | ||
| // Map from player 1 index (key) to player 0 (value). |
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.
Unclear.
|
Thank you for the comments! I will go over them. Since I have a lot of other code piled up locally, I was thinking about how to incorporate it efficiently. I came up with the idea that I split them up into smaller PRs that are better structured. The code has mostly a linear chain of dependence, and I will post new PRs as we move forward the chain. This will allow us to incorporate the review feedback and have a cleaner git history. I appreciate the quality code review, therefore please do not feel under a rush for reviewing the PRs. This change will only mean that the contributions will come slower from our side. I will close the PR for now, but I will address the comments in the new smaller PRs. Thanks again! |
This PR is a work-in-progress for implementing efficient CFR solvers for infostate trees.
@elkhrt @gabrfarina I would appreciate your feedback on the work.
I expect that this CFR implementation will be much faster, as making rollouts in the game is slow and locating CFRInfoStateValues in a map indexed by strings is nice for understanding the algorithm, but not for efficiency.
Some things I decided not to do (in this PR):
I outlined a number of welcome contributions in the code.