From 3faa845c720b2a62b4505c10bf976b12e85d2d9c Mon Sep 17 00:00:00 2001 From: Theodore Turocy Date: Thu, 4 Dec 2025 18:09:07 +0000 Subject: [PATCH] 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. --- ChangeLog | 2 ++ src/games/stratmixed.h | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e319a0744..da05cf682 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ adding a move via drag-and-drop of a player icon (#618) - Fixed a regression generating null pointer dereference errors when setting the outcome of a node to the null outcome (#625, #647) +- Fixed a regression in calculating payoff quantities for mixed strategy profiles derived from + mixed behavior profiles (#616) ## [16.3.2] - unreleased diff --git a/src/games/stratmixed.h b/src/games/stratmixed.h index 7c7b13e08..652b1062e 100644 --- a/src/games/stratmixed.h +++ b/src/games/stratmixed.h @@ -49,7 +49,11 @@ template class MixedStrategyProfileRep { return m_probs[m_profileIndex.at(p_strategy)]; } /// Returns the probability the strategy is played - T &operator[](const GameStrategy &p_strategy) { return m_probs[m_profileIndex.at(p_strategy)]; } + T &operator[](const GameStrategy &p_strategy) + { + InvalidateCache(); + return m_probs[m_profileIndex.at(p_strategy)]; + } /// Set the strategy of the corresponding player to a pure strategy void SetStrategy(const GameStrategy &p_strategy) {