def test_high_randomness_in_hot(self): counter = Counter() for i in range(100): a = boltzmann_exploration(self.actions, self.utilities, 10000000, None) counter[a] += 1 for a, c in list(counter.items()): self.assertTrue(20 <= c <= 45)
def test_low_randomness_in_cold(self): counter = Counter() for i in range(100): a = boltzmann_exploration(self.actions, self.utilities, 0.005, None) counter[a] += 1 self.assertGreater(counter['c'], 95)
def test_all_equals_utilities(self): self.utilities = dict(zip(self.actions, [0, 0, 0])) counter = Counter() for i in range(100): a = boltzmann_exploration(self.actions, self.utilities, 10000000, None) counter[a] += 1 for a, c in list(counter.items()): self.assertTrue(25 <= c <= 40)