Skip to content

Commit

Permalink
Remove unneeded tracking of previous information set.
Browse files Browse the repository at this point in the history
  • Loading branch information
tturocy committed Sep 13, 2024
1 parent 9c9686f commit 325bd45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/solvers/enumpoly/sfg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Sfg::Sfg(const BehaviorSupportProfile &S) : support(S), m_dim(support.GetGame()-
SF = NDArray<Rational>(m_dim, support.GetGame()->NumPlayers());

PureSequenceProfile parent;
std::map<GamePlayer, GameInfoset> last_infoset;
for (auto player : support.GetGame()->GetPlayers()) {
m_sequenceColumns[player] = {{nullptr, 1}};

Expand All @@ -68,14 +67,13 @@ Sfg::Sfg(const BehaviorSupportProfile &S) : support(S), m_dim(support.GetGame()-
E.at(player)(1, 1) = Rational(1);

parent[player] = sequences.at(player).front();
last_infoset[player] = nullptr;
}

MakeSequenceForm(support.GetGame()->GetRoot(), Rational(1), one, last_infoset, parent);
MakeSequenceForm(support.GetGame()->GetRoot(), Rational(1), one, parent);
}

void Sfg::MakeSequenceForm(const GameNode &n, const Rational &prob, const Array<int> &seq,
std::map<GamePlayer, GameInfoset> iset, PureSequenceProfile parent)
PureSequenceProfile parent)
{
if (n->GetOutcome()) {
for (int pl = 1; pl <= seq.Length(); pl++) {
Expand All @@ -89,12 +87,11 @@ void Sfg::MakeSequenceForm(const GameNode &n, const Rational &prob, const Array<
for (auto action : n->GetInfoset()->GetActions()) {
MakeSequenceForm(n->GetChild(action),
prob * static_cast<Rational>(n->GetInfoset()->GetActionProb(action)), seq,
iset, parent);
parent);
}
}
else {
int pl = n->GetPlayer()->GetNumber();
iset[n->GetPlayer()] = n->GetInfoset();

E.at(n->GetPlayer())(infoset_row[n->GetPlayer()][n->GetInfoset()], seq[pl]) = Rational(1);
std::shared_ptr<SequenceRep> myparent(parent[n->GetPlayer()]);
Expand All @@ -111,7 +108,7 @@ void Sfg::MakeSequenceForm(const GameNode &n, const Rational &prob, const Array<
}
snew[pl] = m_sequenceColumns[n->GetPlayer()][action];
E.at(n->GetPlayer())(infoset_row[n->GetPlayer()][n->GetInfoset()], snew[pl]) = Rational(-1);
MakeSequenceForm(n->GetChild(action), prob, snew, iset, parent);
MakeSequenceForm(n->GetChild(action), prob, snew, parent);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/enumpoly/sfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Sfg {
std::map<GamePlayer, std::map<GameAction, GameAction>> m_actionParents;

void MakeSequenceForm(const GameNode &, const Rational &, const Array<int> &,
std::map<GamePlayer, GameInfoset>, PureSequenceProfile);
PureSequenceProfile);

void ComputeNumSequences(const GameNode &, std::map<GamePlayer, GameAction> &);

Expand Down

0 comments on commit 325bd45

Please sign in to comment.