-
Notifications
You must be signed in to change notification settings - Fork 19
Adds Feature/action translation (pls squash and merge me) #38
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
Open
Drazcmd
wants to merge
22
commits into
krukah:main
Choose a base branch
from
Drazcmd:feature/action-translation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Initial commit of some of the basic math + skeleton code. Includes some of the most important math needed to perform the mapping, + a deliberately-wrong test case that performs some of the math and then fails. Big remaining work includes: - proper testing - updating the public function to work with the actual types used in this project - TBD changing the input / output types (maybe structs? I just started learning rust so still need to go look thid stuff up!)
(not related to my stuff but TLDR these get created when I run cargo fmt)
Verifies the "inner" harmonic mapping function operating on the "relative to pot" ratios replicates the "Table 1: Effect of increasing A while holding B = 1 and x = 0.25 fixed." results. I.e. keeping opponenet bet (x) and larger translated bet (B) constant as you increase the smaller translated bet (A).
Adding a vector slice input containing the bet sizes (exact in Chips, not ratios) that we want to translate to. Currently TODO to actually use it properly. TBD: Might want to instead make this take the action_abstraction as values as ratios *normalized to the pot size*, not 100% sure which will approach will be more user friendly in practice
Iterating through each window of 2 elements until we find the first one where we're bounded on both sides. (Technically we only need to check that we're > the smaller size to immediately know we found it given all of the early returns above, but might as well check against the larger size too to make it a little clearer what we're actually doing here / be defensive in general)
Just making it a little more easy to read. Since more likely to compare opponent's bet against the action abstraction / be calling it a bunch of times with the pot size unchanged.
Also cleaned up the docstring a little bit
TLDR actually does need a comment - not about what it's doing, but WHY it's doing it
TLDR is a LOT of checks so visually hard to see without this
I think this is basically the MVP for psuedoharmonic action translation here. Going to probably add a couple more test cases and then wrap things up here. (Side note: still need to double check whether the annotations on the struct are correct/expected; cursory search hasn't shown me a definitive answer yet on the best way to structure things when creating a struct just to serve as the return type like this in Rust)
Should be about ready to send pull request now!
Almost forgot - other important thing this test is exercising: specifically, scale invariance. If we were to naively impelment translate_actions where we plugged in the numbers without normalizing to pot size we'd get the wrong results. (Specifically for f(A,B, x) = ((B - x) * (1 + A)) / ((B - A) * (1 + x)) if we don't normalize properly and just directly plug in A=25, B=75, x=50 it equals 13/51 => ~0.25. Which is WAY off from the 5/12 => ~0.4167 that is actually correct.
woops!
TLDR cargo fmt added these, but I'm not intending to mess with these directories at all. (TLDR should hopefully make it less cluttered when we squash this down.)
This reverts commit 4c5bf02.
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.
Implements Action Translation via the Randomized Psuedo-harmonic Mapping algorithm.
Note:
cargo fmt
automatically added src/transport/greedy.rs and src/transport/greenkhorn.rs. I tried removing them but thencargo test
errors ¯_(ツ)_/¯ (so decided to just leave them in the PR).For more details see “Action Translation in Extensive-Form Games with Large Action Spaces:
Axioms, Paradoxes, and the Pseudo-Harmonic Mapping∗” by Sam Ganzfried and Tuomas Sandholm
(https://www.ijcai.org/Proceedings/13/Papers/028.pdf)