Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions mdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ class MDP:
list of (p, s') pairs. We also keep track of the possible states,
terminal states, and actions for each state. [page 646]"""

def __init__(self, init, actlist, terminals, transitions={}, states=set(), gamma=.9):
def __init__(self, init, actlist, terminals, transitions={}, states=None, gamma=.9):
if not (0 <= gamma < 1):
raise ValueError("An MDP must have 0 <= gamma < 1")

if states:
self.states = states
else:
self.states = set()
self.init = init
self.actlist = actlist
self.terminals = terminals
self.transitions = transitions
self.states = states
self.gamma = gamma
self.reward = {}

Expand Down
Loading