1. Lars Yencken
  2. aichallenge-py

Commits

Lars Yencken  committed d642567

Test the torus wraparound case for mdp solving.

  • Participants
  • Parent commits ab0ef6c
  • Branches scent

Comments (0)

Files changed (1)

File test_mdp.py

View file
                 dtype=np.float32) / 3.0
         value = mdp.value_iteration(reward, torus=True, gamma=0.5, eps=1e-5)
         assert abs(value - expected).mean() < 1e-5, str(value)
+
+    def test_wraparound(self):
+        reward = np.array([[0, 1, 0], [0, 0, 0], [0, 0, 0]])
+        expected = np.array([[2, 4, 2], [1, 2, 1], [1, 2, 1]],
+                dtype=np.float32) / 3.0
+        value = mdp.value_iteration(reward, torus=True, gamma=0.5, eps=1e-5)
+        assert abs(value - expected).mean() < 1e-5, str(value)
+