Commit 2792282d authored by Jayant Khatkar's avatar Jayant Khatkar

available action no only offers state of current robot - other robot states...

available action no only offers state of current robot - other robot states should not be used since they are sampled
parent 32847591
......@@ -190,8 +190,8 @@ class Tree:
Init step.
"""
state = self._get_system_state(start_node)
options = self.available_actions(self.data, state, self.id)
robot_state = self.graph.node[start_node]["state"]
options = self.available_actions(self.data, robot_state, self.id)
# create empty nodes underneath the node being expanded
for o in options:
......
......@@ -39,9 +39,8 @@ def state_storer(data, parent_state, action):
data = {}
# Create an available actions function
# This returns a list of possible actions to take from a given state
# state and robot_id inputs explained below
def avail_actions(data, states, robot_id):
# This returns a list of possible actions to take from a given state (from state_storer)
def avail_actions(data, state, robot_id):
# This example is simply getting max sum,
# options are same regardless of state
......@@ -49,8 +48,8 @@ def avail_actions(data, states, robot_id):
# Create a reward function. This is the global reward given a list of
# actions taken by the current robot, and every other robot
# State is a dictionary with keys being robot IDs, and values
# are a list of actions taken from the starting position
# states is a dictionary with keys being robot IDs, and values
# are the object returned by the state_storer function you provide
def reward(dat, states):
each_robot_sum= [states[robot].cumulative_sum for robot in states]
return sum(each_robot_sum)
......
......@@ -19,7 +19,7 @@ def state_storer(data, parent_state, action):
state.cumulative_sum = state.cumulative_sum + action
return state
def avail_actions(data, states, robot_id):
def avail_actions(data, state, robot_id):
return [1,2,3,4,5]
def reward(dat, states):
......
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