Skip to content

Commit b4fdb61

Browse files
committed
change set to list in tiger to tame random.sample in python 3.11
1 parent a730fa9 commit b4fdb61

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Version 1.3.3 (07/25/2023)
1111
* Fix :code:`s -> sp` in :py:mod:`~pomdp_py.algorithms.value_iteration.ValueIteration` (`pomdp-py#20 <https://github.com/h2r/pomdp-py/issues/20>`_)
1212
* Allow updating rollout policy for :py:mod:`~pomdp_py.algorithms.po_uct.POUCT` and :py:mod:`~pomdp_py.algorithms.pomcp.POMCP`
1313
* Fix in :code:`setup.py` so that wheel builds properly.
14+
* Change set to list in :code:`pomdp_problems.tiger.tiger_problem.py` to tame error regarding :code:`random.sample` in Python 3.11.
1415
* Minor bug fixes and documentation.
1516

1617

pomdp_problems/tiger/cythonize/tiger_problem.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ import numpy as np
4444
import sys
4545

4646
def build_states(strings):
47-
return {TigerState(s) for s in strings}
47+
return [TigerState(s) for s in strings]
4848
def build_actions(strings):
49-
return {TigerAction(s) for s in strings}
49+
return [TigerAction(s) for s in strings]
5050
def build_observations(strings):
51-
return {TigerObservation(s) for s in strings}
51+
return [TigerObservation(s) for s in strings]
5252

5353
cdef class TigerState(State):
5454
cdef public str name

pomdp_problems/tiger/tiger_problem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def sample(self, state, action, next_state):
168168
class PolicyModel(pomdp_py.RolloutPolicy):
169169
"""A simple policy model with uniform prior over a
170170
small, finite action space"""
171-
ACTIONS = {TigerAction(s)
172-
for s in {"open-left", "open-right", "listen"}}
171+
ACTIONS = [TigerAction(s)
172+
for s in {"open-left", "open-right", "listen"}]
173173

174174
def sample(self, state):
175175
return random.sample(self.get_all_actions(), 1)[0]

0 commit comments

Comments
 (0)