| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,8 +18,12 @@ class MDP: | |||
| 18 | 18 | actions for each state. [page 646]""" | |
| 19 | 19 | ||
| 20 | 20 | def __init__(self, init, actlist, terminals, gamma=.9): | |
| 21 | - update(self, init=init, actlist=actlist, terminals=terminals, | ||
| 22 | - gamma=gamma, states=set(), reward={}) | ||
| 21 | + self.init=init | ||
| 22 | + self.actlist=actlist | ||
| 23 | + self.terminals=terminals | ||
| 24 | + self.gamma=gamma | ||
| 25 | + self.states=set() | ||
| 26 | + self.reward={} | ||
| 23 | 27 | ||
| 24 | 28 | def R(self, state): | |
| 25 | 29 | "Return a numeric reward for this state." | |
@@ -48,7 +52,9 @@ def __init__(self, grid, terminals, init=(0, 0), gamma=.9): | |||
| 48 | 52 | grid.reverse() ## because we want row 0 on bottom, not on top | |
| 49 | 53 | MDP.__init__(self, init, actlist=orientations, | |
| 50 | 54 | terminals=terminals, gamma=gamma) | |
| 51 | - update(self, grid=grid, rows=len(grid), cols=len(grid[0])) | ||
| 55 | + self.grid=grid | ||
| 56 | + self.rows=len(grid) | ||
| 57 | + self.cols=len(grid[0]) | ||
| 52 | 58 | for x in range(self.cols): | |
| 53 | 59 | for y in range(self.rows): | |
| 54 | 60 | self.reward[x, y] = grid[y][x] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments