Пример #1
0
 def test_argmax_without_init(self):
     """ Test max(key) function. """
     qtable = QTable(self.actions)
     state = collections.OrderedDict()
     state['from'] = 1
     state['to'] = 2
     state['rank'] = [0, 1, 2]
     self.assertTrue(qtable.argmax(state) in self.actions)
Пример #2
0
 def test_argmax_with_init(self):
     """ Test max(key) function. """
     qtable = QTable(self.actions)
     state = collections.OrderedDict()
     state['from'] = 1
     state['to'] = 2
     state['rank'] = [0, 1, 2]
     qtable[state][0] = 1.0
     self.assertEqual(0, qtable.argmax(state))
Пример #3
0
 def test_argmax_with_parity(self):
     """ Test max(key) function. """
     qtable = QTable(self.actions)
     state = collections.OrderedDict()
     state['from'] = 1
     state['to'] = 2
     state['rank'] = [0, 1, 2]
     qtable[state][0] = 1.0
     qtable[state][1] = 1.0
     self.assertTrue(qtable.argmax(state) in [0, 1])