Skip to content
Snippets Groups Projects
Commit 2d190af8 authored by Jayant Khatkar's avatar Jayant Khatkar
Browse files

Readme update to desired interface

parent 384e95f7
No related merge requests found
# Dec-MCTS
Python implementation of Dec-MCTS
### Installation
```bash
pip install git+https://code.research.uts.edu.au/bigprint/pydecmcts.git
```
### Usage
```python
from DecMCTS import Tree
# data can be anything required to calculate your
# global reward and available actions
data = {}
# Create an available actions function
# This returns a list of possible actions to take from a given state
# state input explained next
def avail_actions(data, state):
# This example is simply getting max sum,
# options are same regardless of state
return [1,2,3,4,5]
# 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
def reward(dat, state):
each_robot_sum = [sum(state[1][a]) for a in state[1]]
return sum(each_robot_sum)
# Number of Action Sequences to communicate
comm_n = 5
# Create instances for each robot
tree1 = Tree(data, reward, avail_actions, comm_n, 1) # Robot ID is 1
tree2 = Tree(data, reward, avail_actions, comm_n, 2) # Robot ID is 2
for i in range(350):
tree1.grow()
tree2.grow()
tree1.receive_comms(tree2.send_comms(), 2) #send comms message doesn't have ID in it
tree2.receive_comms(tree2.send_comms(), 1)
```
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