def test_mdp_size(self): """ Probably nice to be able to tell the size of the MDP. If not only for tests """ mdp = MDP() self.assertEqual(mdp.num_states(), 0) mdp = MDP(5) self.assertEqual(mdp.num_states(), 5) mdp = MDP() mdp.add_state(0) mdp.add_state(1) self.assertEqual(mdp.num_states(), 2)
def test_create_new_mdp_no_initial_states(self): """ I'm not sure what the create MDP method should actually do. """ # there isn't very much we can tell about an mdp that is completely devoid # of states mdp = MDP() self.assertEqual(mdp.num_states(), 0)
def test_create_new_mdp_initial_num_states(self): """ Test initializing MDPS with an explicity number of states """ mdp = MDP(5) self.assertEqual(mdp.num_states(), 5) # this MDP should have 5 states self.assertEquals(type(mdp.get_state(0)), State) self.assertEquals(type(mdp.get_state(2)), State) self.assertEquals(type(mdp.get_state(4)), State)
def test_create_state(self): """ For implementation simplification I'm imagining creating all of the the states separately and then connecting them afterwards by specifying the actions. """ # States should be abled to be identified by numbers or by strings I suppose. # I don't imagine that strings will ever be used. mdp = MDP() mdp.add_state(0) mdp.add_state(1) mdp.add_state(2) mdp.add_state(3) mdp.add_state(4) mdp.add_state(5, terminal=True) self.assertEqual(mdp.num_states(), 6)