Skip to content

Commit aca85cf

Browse files
Added GetContingencies
1 parent 3638ceb commit aca85cf

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/games/behavspt.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,9 @@ InfosetsWrapper BehaviorSupportProfile::GetInfosets() const {
299299
return InfosetsWrapper(infosets);
300300
}
301301

302+
ContingenciesWrapper BehaviorSupportProfile::GetContingencies() const {
303+
auto contingencies = GetSequenceForm()->GetContingencies();
304+
return ContingenciesWrapper(contingencies);
305+
}
306+
302307
} // end namespace Gambit

src/games/behavspt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct GameSequenceRep;
3434
class SequencesWrapper;
3535
class PlayerSequencesWrapper;
3636
class InfosetsWrapper;
37+
class ContingenciesWrapper;
3738

3839
/// This class represents a subset of the actions in an extensive game.
3940
/// It is enforced that each player has at least one action at each
@@ -155,6 +156,7 @@ class BehaviorSupportProfile {
155156
GameRep::Players GetPlayers() const {return GetGame()->GetPlayers();}
156157
MixedBehaviorProfile<double> ToMixedBehaviorProfile(const std::map<std::shared_ptr<GameSequenceRep>, double> &) const;
157158
InfosetsWrapper GetInfosets() const;
159+
ContingenciesWrapper GetContingencies() const;
158160

159161
};
160162

src/games/gameseq.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,19 @@ class InfosetsWrapper {
336336
};
337337

338338

339+
class ContingenciesWrapper {
340+
public:
341+
explicit ContingenciesWrapper(const GameSequenceForm::Contingencies& contingencies)
342+
: m_contingencies(contingencies) {}
343+
344+
auto begin() { return m_contingencies.begin(); }
345+
auto end() { return m_contingencies.end(); }
346+
347+
private:
348+
GameSequenceForm::Contingencies m_contingencies;
349+
};
350+
351+
339352
} // end namespace Gambit
340353

341354
#endif // GAMESEQ_H

src/solvers/enumpoly/efgpoly.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Polynomial<double> GetPayoff(ProblemData &p_data, const GamePlayer &p_player)
100100
{
101101
Polynomial<double> equation(p_data.space);
102102

103-
for (auto profile : p_data.m_support.GetSequenceForm()->GetContingencies()) {
103+
for (auto profile : p_data.m_support.GetContingencies()) {
104104
auto pay = p_data.m_support.GetPayoff(profile, p_player);
105105
if (pay != Rational(0)) {
106106
Polynomial<double> term(p_data.space, double(pay));

0 commit comments

Comments
 (0)