diff --git a/src/solvers/enumpoly/efgpoly.cc b/src/solvers/enumpoly/efgpoly.cc index db7c05b5e..080b6b6af 100644 --- a/src/solvers/enumpoly/efgpoly.cc +++ b/src/solvers/enumpoly/efgpoly.cc @@ -197,39 +197,15 @@ gPolyList NashOnSupportEquationsAndInequalities(ProblemData &p_data) // Mapping solution vectors to sequences //======================================================================= -double NumProbOfSequence(const ProblemData &p_data, const GamePlayer &p_player, int seq, - const Vector &x) -{ - GameInfoset infoset = p_data.SF.GetInfoset(p_player, seq); - - if (seq == 1) { - return 1.0; - } - else if (p_data.SF.ActionNumber(p_player, seq) < p_data.support.NumActions(infoset)) { - return x[p_data.var[p_player->GetNumber()][seq]]; - } - else { - double value = 0.0; - int isetrow = p_data.SF.InfosetRowNumber(p_player, seq); - for (int j = 1; j < seq; j++) { - if (p_data.SF.GetConstraintEntry(p_player, isetrow, j) == Rational(-1)) { - value -= NumProbOfSequence(p_data, p_player, j, x); - } - else if (p_data.SF.GetConstraintEntry(p_player, isetrow, j) == Rational(1)) { - value += NumProbOfSequence(p_data, p_player, j, x); - } - } - return value; - } -} - PVector SeqFormVectorFromSolFormVector(const ProblemData &p_data, const Vector &v) { PVector x(p_data.SF.NumSequences()); 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++) { - x(i, j) = NumProbOfSequence(p_data, p_data.support.GetGame()->GetPlayer(i), j, v); + GameAction action = p_data.SF.GetSequence(player, j); + x(i, j) = p_data.variables.at(std::make_pair(player, action)).Evaluate(v); } }