Render reduced-strategy labels lazily - #991
Open
d-kad wants to merge 4 commits into
Open
Conversation
…osen action, holding only the sets a strategy specifies Render strategy labels lazily from the behaviour map
Contributor
Author
Member
|
This is a good idea, but let's trace the implications through even more thoroughly. Would it make sense simply to have generate-on-demand for the strategic form above a given size? Random access via label is probably not going to be something that makes a lot of sense in a large game. But also this is flagging up that we are abusing labels in reduced strategic forms to do multiple duties. And - now that we are requiring labels for actions, the use of numbers for the auto-generated strategy labels is dubious when we could do something derived from the constituent actions. We should discuss this in our upcoming catchup. We do definitely need to do something along these lines however. |
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
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.

Description of the changes in this PR
GamePlayerRep::MakeStrategybuilt a text label for every reduced strategy eagerly, scanning all of theplayer's information sets with two map lookups each. The label is often never read, and its construction is
O(strategies × infosets)in time and allocations.This PR makes it lazy.
GameStrategyRep::m_labelbecomes amutable std::optional<std::string>;MakeStrategyleaves it empty andGetLabel()renders fromm_behavon first access, then caches.The rendered text is unchanged.
It also replaces
operator[]withcontains()/at()on the two paths that readm_behav(the behavior-to-strategy profile constructor and
TreePureStrategyProfileRep::GetPayoff).operator[]inserted a zero for every absent information set, expanding each strategy's map on first read;the const-correct access preserves the sparsity
MakeStrategyproduces.No behavioral change.