You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if isinstance(actlist, list):
# if actlist is a list, all states have the same actions
self.actlist = actlist
elif isinstance(actlist, dict):
# if actlist is a dict, different actions for each state
self.actlist = actlist
In test_mdp4e.py, there is this:
actlist={"plan1", "plan2", "plan3"}
This is a set, not a dictionary, and is not handled by the code above. And Perhaps an error handling was intended after the elif?
Moreover (unrelatedly) I found the notation actlist confusing (since the object can be a dictionary or a set) and inconsistent with the textbook notation. I suggest replacing every instance of actions with A (consistent with the Rand T notation) and every instance of actlist with actions. Below I think is closer to the intention of the conditional above:
if isinstance(actions, list):
# if actions is a list, all states have the same actions
self.actions = actions
elif isinstance(actions, dict):
# if actions is a dict, different actions for each state
self.actions = {k: v for k,v in actions.items()}
elif isinstance(actions, set): # This line added
# if actions is a set, convert to list
self.actions = list(actions)
else:
# throw an error
The text was updated successfully, but these errors were encountered:
In
mdp4e.py
, there is the following:In
test_mdp4e.py
, there is this:This is a set, not a dictionary, and is not handled by the code above. And Perhaps an error handling was intended after the
elif
?Moreover (unrelatedly) I found the notation
actlist
confusing (since the object can be a dictionary or a set) and inconsistent with the textbook notation. I suggest replacing every instance ofactions
withA
(consistent with theR
andT
notation) and every instance ofactlist
withactions
. Below I think is closer to the intention of the conditional above:The text was updated successfully, but these errors were encountered: