Skip to content

Commit db049ce

Browse files
antmarakisnorvig
authored andcommitted
RL Fixes (Fixing Build) (aimacode#519)
* Update rl.py * Update mdp.py * Minor changed to rl notebook
1 parent 7bebc1b commit db049ce

3 files changed

Lines changed: 93 additions & 129 deletions

File tree

mdp.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ class MDP:
2222
list of (p, s') pairs. We also keep track of the possible states,
2323
terminal states, and actions for each state. [page 646]"""
2424

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

29+
if states:
30+
self.states = states
31+
else:
32+
self.states = set()
2933
self.init = init
3034
self.actlist = actlist
3135
self.terminals = terminals
3236
self.transitions = transitions
33-
self.states = states
3437
self.gamma = gamma
3538
self.reward = {}
3639

0 commit comments

Comments
 (0)