Commit 84bf38cb authored by anon's avatar anon
Browse files

Compute Predecessors of all states, untested

parent c82535cc
......@@ -193,5 +193,17 @@ class PrioritizedSweepingValueIterationAgent(AsynchronousValueIterationAgent):
ValueIterationAgent.__init__(self, mdp, discount, iterations)
def runValueIteration(self):
"*** YOUR CODE HERE ***"
# Compute all predecessor
states = self.mdp.getStates()
predecessors = dict()
for state in states:
actions = self.mdp.getPossibleActions(state)
for action in actions:
nextState = self.mdp.getTransitionStatesAndProbs(state, action)[0]
except KeyError:
predecessors[nextState] = set()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment