Skip to content

Commit

Permalink
All tests pass on python2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
anandtrex committed Feb 24, 2018
1 parent 64be0e6 commit 69debd3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion examples/blocksworld/ggq-tile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
Expand Down
8 changes: 4 additions & 4 deletions rlpy/Domains/GridWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ def s0(self):
def isTerminal(self, s=None):
if s is None:
s = self.state
if self.map[s[0], s[1]] == self.GOAL:
if self.map[int(s[0]), int(s[1])] == self.GOAL:
return True
if self.map[s[0], s[1]] == self.PIT:
if self.map[int(s[0]), int(s[1])] == self.PIT:
return True
return False

Expand Down Expand Up @@ -385,8 +385,8 @@ def expectedStep(self, s, a):
pa = np.array([self.possibleActions(sn) for sn in ns])
# Make rewards
r = np.ones((k, 1)) * self.STEP_REWARD
goal = self.map[ns[:, 0], ns[:, 1]] == self.GOAL
pit = self.map[ns[:, 0], ns[:, 1]] == self.PIT
goal = self.map[ns[:, 0].astype(np.int), ns[:, 1].astype(np.int)] == self.GOAL
pit = self.map[ns[:, 0].astype(np.int), ns[:, 1].astype(np.int)] == self.PIT
r[goal] = self.GOAL_REWARD
r[pit] = self.PIT_REWARD
# Make terminals
Expand Down
3 changes: 1 addition & 2 deletions rlpy/MDPSolvers/MDPSolver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""MDP Solver base class."""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import

Expand Down Expand Up @@ -164,7 +163,7 @@ def saveStats(self):
fullpath_output = os.path.join(self.project_path, self.output_filename)
print(">>> ", fullpath_output)
checkNCreateDirectory(self.project_path + '/')
with open(fullpath_output, "w") as f:
with open(fullpath_output, "wb") as f:
json.dump(self.result, f, indent=4, sort_keys=True)

def hasTime(self):
Expand Down
1 change: 0 additions & 1 deletion tests/test_cases.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Nosetests for testing the use cases contained in the cases directory."""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import

Expand Down

0 comments on commit 69debd3

Please sign in to comment.