Skip to content

Commit

Permalink
Removed last instances of numbering sequences.
Browse files Browse the repository at this point in the history
  • Loading branch information
tturocy committed Sep 19, 2024
1 parent d454544 commit d9e13bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
22 changes: 10 additions & 12 deletions src/solvers/enumpoly/efgpoly.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ gPolyList<double> LastActionProbPositiveInequalities(ProblemData &p_data)
gPolyList<double> equations(p_data.Space, p_data.Lex);

for (auto player : p_data.support.GetGame()->GetPlayers()) {
for (int j = 2; j <= p_data.SF.NumSequences(player); j++) {
GameAction action = p_data.SF.GetSequence(player, j).action;
int act_num = p_data.support.GetIndex(action);
if (act_num == p_data.support.NumActions(action->GetInfoset()) && act_num > 1) {
equations += p_data.variables.at({player, action});
for (auto sequence = p_data.SF.cbegin_sequences(player);
sequence != p_data.SF.cend_sequences(player); ++sequence) {
int action_number = (sequence->action) ? p_data.support.GetIndex(sequence->action) : 0;
if (action_number > 1 &&
action_number == p_data.support.NumActions(sequence->action->GetInfoset())) {
equations += p_data.variables.at({player, sequence->action});
}
}
}
Expand All @@ -179,15 +180,12 @@ gPolyList<double> NashOnSupportEquationsAndInequalities(ProblemData &p_data)
std::map<GameSequence, double> ToSequenceProbs(const ProblemData &p_data, const Vector<double> &v)
{
std::map<GameSequence, double> x;

for (int i = 1; i <= p_data.support.GetGame()->NumPlayers(); i++) {
GamePlayer player = p_data.support.GetGame()->GetPlayer(i);
for (int j = 1; j <= p_data.SF.NumSequences()[i]; j++) {
GameSequence sequence = p_data.SF.GetSequence(player, j);
x[sequence] = p_data.variables.at(sequence).Evaluate(v);
for (auto player : p_data.support.GetGame()->GetPlayers()) {
for (auto sequence = p_data.SF.cbegin_sequences(player);
sequence != p_data.SF.cend_sequences(player); sequence++) {
x[*sequence] = p_data.variables.at(*sequence).Evaluate(v);
}
}

return x;
}

Expand Down
6 changes: 0 additions & 6 deletions src/solvers/enumpoly/sfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ class Sfg {
return m_sequenceColumns.at(p_player).size();
}

GameSequence GetSequence(const GamePlayer &p_player, int p_index) const
{
// For the moment sequences are indexed from 1 externally.
return m_sequences.at(p_player).at(p_index - 1);
}

std::vector<GameSequence>::const_iterator cbegin_sequences(const GamePlayer &p_player) const
{
return m_sequences.at(p_player).cbegin();
Expand Down

0 comments on commit d9e13bd

Please sign in to comment.