Commit b3937a57 authored by Jayant Khatkar's avatar Jayant Khatkar

back propogation

parent 975bd2f0
......@@ -194,8 +194,25 @@ class Tree:
best_reward = float("-Inf")
for i in range(nsims):
# TODO
# SIMULATION NOT REQUIRED FOR BIGPRINT, HEURISTIC USED INSTEAD
pass
avg_reward = self.reward(self.data, state)
self.graph.nodes["mu"] = avg_reward
self.graph.nodes["N"] = 1
### BACKPROPOGATION
while start_node!=1: #while not root node
start_node = self._parent(start_node)
self.graph.nodes[start_node]["mu"] = \
(gamma * self.graph.nodes[start_node]["mu"] + avg_reward)\
/(gamma * self.graph.nodes[start_node]["N"] + 1)
self.graph.nodes[start_node]["N"] = \
gamma * self.graph.nodes[start_node]["N"] + 1
return avg_reward
def send_comms(self):
......
Markdown is supported
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