コード例 #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])