Skip to content

Commit

Permalink
Fix error in refactoring of dominance elimination.
Browse files Browse the repository at this point in the history
  • Loading branch information
tturocy committed Oct 25, 2024
1 parent 8cbde26 commit c9200dd
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/games/stratspt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<GameStrategy> set((p_external) ? p_player->NumStrategies()
Expand All @@ -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;
}

//---------------------------------------------------------------------------
Expand Down

0 comments on commit c9200dd

Please sign in to comment.