https://github.com/ziofil/montecarlo-tree
A simple implementation of a model-agnostic montecarlo tree search
https://github.com/ziofil/montecarlo-tree
Last synced: over 1 year ago
JSON representation
A simple implementation of a model-agnostic montecarlo tree search
- Host: GitHub
- URL: https://github.com/ziofil/montecarlo-tree
- Owner: ziofil
- Created: 2018-03-29T17:00:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-16T14:43:48.000Z (over 8 years ago)
- Last Synced: 2025-01-29T18:13:44.514Z (over 1 year ago)
- Language: Python
- Size: 18.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# montecarlo-tree
A simple implementation of a model-agnostic montecarlo tree search to use with an actor-critic RL agent. Just pass a handler that interfaces with your model. The handler must implement the following functions:
- `num_actions(state)`
- `new_state(action, state)`
- `value(state)` <--- must also be able to work on lists/arrays of states
- `policy(state)`
- `next_possible_states(state)`
- `is_solution(state)` <--- not all problems will have a clear solution, in that case just always return False
## Usage
```python
from MonteCarloTreeSearch import MCTS
tree = MCTS(my_handler, max_steps = 10, num_simlulations = 100)
actions = tree.search()
```
voila.