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

File tree

3 files changed

+93
-129
lines changed

3 files changed

+93
-129
lines changed

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy