diff --git a/src/games/stratspt.cc b/src/games/stratspt.cc index 0adcfedea..97752ad82 100644 --- a/src/games/stratspt.cc +++ b/src/games/stratspt.cc @@ -244,10 +244,10 @@ Iterator find_minimal_elements(Iterator first, Iterator last, Comparator greater return min; } -} // end anonymous namespace +} // end anonymous namespace - -bool UndominatedForPlayer(StrategySupportProfile &p_support, const GamePlayer &p_player, +bool UndominatedForPlayer(const StrategySupportProfile &p_support, + StrategySupportProfile &p_newSupport, const GamePlayer &p_player, bool p_strict, bool p_external) { std::vector set((p_external) ? p_player->NumStrategies() @@ -260,26 +260,25 @@ bool UndominatedForPlayer(StrategySupportProfile &p_support, const GamePlayer &p auto strategies = p_support.GetStrategies(p_player); std::copy(strategies.begin(), strategies.end(), set.begin()); } - auto min = find_minimal_elements(set.begin(), set.end(), - [&p_support, p_strict](const GameStrategy &s, const GameStrategy &t) { - return p_support.Dominates(s, t, p_strict); - }); + auto min = + find_minimal_elements(set.begin(), set.end(), + [&p_support, p_strict](const GameStrategy &s, const GameStrategy &t) { + return p_support.Dominates(s, t, p_strict); + }); for (auto s = min; s != set.end(); s++) { - p_support.RemoveStrategy(*s); + p_newSupport.RemoveStrategy(*s); } return min != set.end(); } StrategySupportProfile StrategySupportProfile::Undominated(bool p_strict, bool p_external) const { - StrategySupportProfile newS(*this); - + StrategySupportProfile newSupport(*this); for (auto player : m_nfg->GetPlayers()) { - UndominatedForPlayer(newS, player, p_strict, p_external); + UndominatedForPlayer(*this, newSupport, player, p_strict, p_external); } - - return newS; + return newSupport; } //---------------------------------------------------------------------------