Skip to content

Commit 3faa845

Browse files
committed
Fix caching in MixedStrategyProfile
For mixed strategy profiles which are defined on trees, a behavior strategy profile is computed and cached. This was not correctly being cleared when changing the strategy probabilities, resulting in incorrect output. Closes #616.
1 parent 9d28e17 commit 3faa845

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
adding a move via drag-and-drop of a player icon (#618)
1212
- Fixed a regression generating null pointer dereference errors when setting the outcome of
1313
a node to the null outcome (#625, #647)
14+
- Fixed a regression in calculating payoff quantities for mixed strategy profiles derived from
15+
mixed behavior profiles (#616)
1416

1517

1618
## [16.3.2] - unreleased

src/games/stratmixed.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ template <class T> class MixedStrategyProfileRep {
4949
return m_probs[m_profileIndex.at(p_strategy)];
5050
}
5151
/// Returns the probability the strategy is played
52-
T &operator[](const GameStrategy &p_strategy) { return m_probs[m_profileIndex.at(p_strategy)]; }
52+
T &operator[](const GameStrategy &p_strategy)
53+
{
54+
InvalidateCache();
55+
return m_probs[m_profileIndex.at(p_strategy)];
56+
}
5357
/// Set the strategy of the corresponding player to a pure strategy
5458
void SetStrategy(const GameStrategy &p_strategy)
5559
{

0 commit comments

Comments
 (0)