# MCTS
This package provides a simple way of using Monte Carlo Tree Search in any perfect information domain.
## Installation
With pip: `pip install mcts`
Without pip: Download the zip/tar.gz file of the [latest release](https://github.com/pbsinclair42/MCTS/releases), extract it, and run `python setup.py install`
## Quick Usage
In order to run MCTS, you must implement a `State` class which can fully describe the state of the world. It must also implement four methods:
- `getPossibleActions()`: Returns an iterable of all actions which can be taken from this state
- `takeAction(action)`: Returns the state which results from taking action `action`
- `isTerminal()`: Returns whether this state is a terminal state
- `getReward()`: Returns the reward for this state. Only needed for terminal states.
You must also choose a hashable representation for an action as used in `getPossibleActions` and `takeAction`. Typically this would be a class with a custom `__hash__` method, but it could also simply be a tuple or a string.
Once these have been implemented, running MCTS is as simple as initializing your starting state, then running:
```python
from mcts import mcts
mcts = mcts(timeLimit=1000)
bestAction = mcts.search(initialState=initialState)
```
See [naughtsandcrosses.py](https://github.com/pbsinclair42/MCTS/blob/master/naughtsandcrosses.py) for a simple example.
## Slow Usage
//TODO
## Collaborating
Feel free to raise a new issue for any new feature or bug you've spotted. Pull requests are also welcomed if you're interested in directly improving the project.
Raw data
{
"_id": null,
"home_page": "https://github.com/pbsinclair42/MCTS",
"name": "mcts",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "mcts,monte,carlo,tree,search",
"author": "Paul Sinclair",
"author_email": "pbsinclair42@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/24/05/5d9433441d3d7826ded877bbb99b33f1557fef867c4247a65a1b03ba44fd/mcts-1.0.4.tar.gz",
"platform": "",
"description": "# MCTS\n\nThis package provides a simple way of using Monte Carlo Tree Search in any perfect information domain. \n\n## Installation \n\nWith pip: `pip install mcts`\n\nWithout pip: Download the zip/tar.gz file of the [latest release](https://github.com/pbsinclair42/MCTS/releases), extract it, and run `python setup.py install`\n\n## Quick Usage\n\nIn order to run MCTS, you must implement a `State` class which can fully describe the state of the world. It must also implement four methods: \n\n- `getPossibleActions()`: Returns an iterable of all actions which can be taken from this state\n- `takeAction(action)`: Returns the state which results from taking action `action`\n- `isTerminal()`: Returns whether this state is a terminal state\n- `getReward()`: Returns the reward for this state. Only needed for terminal states. \n\nYou must also choose a hashable representation for an action as used in `getPossibleActions` and `takeAction`. Typically this would be a class with a custom `__hash__` method, but it could also simply be a tuple or a string. \n\nOnce these have been implemented, running MCTS is as simple as initializing your starting state, then running:\n\n```python\nfrom mcts import mcts\n\nmcts = mcts(timeLimit=1000)\nbestAction = mcts.search(initialState=initialState)\n```\nSee [naughtsandcrosses.py](https://github.com/pbsinclair42/MCTS/blob/master/naughtsandcrosses.py) for a simple example. \n\n## Slow Usage\n//TODO\n\n## Collaborating\n\nFeel free to raise a new issue for any new feature or bug you've spotted. Pull requests are also welcomed if you're interested in directly improving the project.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple package to allow users to run Monte Carlo Tree Search on any perfect information domain",
"version": "1.0.4",
"split_keywords": [
"mcts",
"monte",
"carlo",
"tree",
"search"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f9f603aa04e389f2ed5bf145fa923a9d",
"sha256": "d140587f724ba04094116a9f9245a35f8d96e4cb2efbd5dfc20d1218d24dfad3"
},
"downloads": -1,
"filename": "mcts-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f9f603aa04e389f2ed5bf145fa923a9d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4160,
"upload_time": "2019-04-21T13:00:09",
"upload_time_iso_8601": "2019-04-21T13:00:09.953480Z",
"url": "https://files.pythonhosted.org/packages/8a/2a/d278c768df13364dbeb20a2baab209b72cf30cdc157a55ffc04f126c8b0a/mcts-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "de66dc981d587d57e49af2a86aa16b45",
"sha256": "01923d3d33cd6cc6e31b1f9d5f10943adc7ae3c399d0d6fedae3dae0541d5ec0"
},
"downloads": -1,
"filename": "mcts-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "de66dc981d587d57e49af2a86aa16b45",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3231,
"upload_time": "2019-04-21T13:00:11",
"upload_time_iso_8601": "2019-04-21T13:00:11.246838Z",
"url": "https://files.pythonhosted.org/packages/24/05/5d9433441d3d7826ded877bbb99b33f1557fef867c4247a65a1b03ba44fd/mcts-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-04-21 13:00:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "pbsinclair42",
"github_project": "MCTS",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mcts"
}