Skip to content

Commit

Permalink
Add test for TabularBestResponse MDP from Python.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 572819580
Change-Id: I19c09caeef6efca807ff343379ad82c73ffb061d
  • Loading branch information
lanctot committed Oct 12, 2023
1 parent 16962d4 commit a44607a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions open_spiel/python/algorithms/best_response_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,16 @@ def test_best_response_prisoner_dilemma_simultaneous_game(self):
self.assertAlmostEqual(br.value(game.new_initial_state()), 21.4320068359375)


class TabularBestResponseMDPTest(absltest.TestCase):

def test_tabular_best_response_mdp(self):
# See pybind11/policy.cc for these functions.
game = pyspiel.load_game("kuhn_poker")
uniform_random_policy = pyspiel.UniformRandomPolicy(game)
tbr_mdp = pyspiel.TabularBestResponseMDP(game, uniform_random_policy)
tbr_info = tbr_mdp.nash_conv()
self.assertGreater(tbr_info.nash_conv, 0)


if __name__ == "__main__":
absltest.main()

0 comments on commit a44607a

Please sign in to comment.