mcts
A simple package to allow users to run Monte Carlo Tree Search on any perfect information domain
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 5 committers (20.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.6%) to scientific vocabulary
Repository
A simple package to allow users to run Monte Carlo Tree Search on any perfect information domain
Basic Info
Statistics
- Stars: 228
- Watchers: 6
- Forks: 74
- Open Issues: 6
- Releases: 1
Metadata Files
README.md
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, 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:
getCurrentPlayer(): Returns 1 if it is the maximizer player's turn to choose an action, or -1 for the minimiser playergetPossibleActions(): Returns an iterable of allactions which can be taken from this statetakeAction(action): Returns the state which results from taking actionactionisTerminal(): ReturnsTrueif this state is a terminal stategetReward(): 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
searcher = mcts(timeLimit=1000)
bestAction = searcher.search(initialState=initialState)
``
Here the unit oftimeLimit=1000is millisecond. You can also useiterationLimit=1600to specify the number of rollouts. Exactly one oftimeLimitanditerationLimitshould be specified. The expected reward of best action can be got by settingneedDetailstoTrueinsearcher`.
python
resultDict = searcher.search(initialState=initialState, needDetails=True)
print(resultDict.keys()) #currently includes dict_keys(['action', 'expectedReward'])
See 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.
Owner
- Name: Paul Sinclair
- Login: pbsinclair42
- Kind: user
- Location: Edinburgh, Scotland
- Website: http://uk.linkedin.com/in/pbsinclair42
- Repositories: 8
- Profile: https://github.com/pbsinclair42
GitHub Events
Total
- Watch event: 24
- Fork event: 4
Last Year
- Watch event: 24
- Fork event: 4
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| pbsinclair42 | b****2@g****m | 11 |
| harrdb12 | d****s@g****u | 1 |
| Paul Sinclair | p****l@a****m | 1 |
| WhymustIhaveaname | s****8@g****m | 1 |
| Alex Prengère | a****e | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 11
- Total pull requests: 8
- Average time to close issues: 4 months
- Average time to close pull requests: 12 days
- Total issue authors: 10
- Total pull request authors: 6
- Average comments per issue: 2.82
- Average comments per pull request: 2.38
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- DarioBernardo (2)
- anu43 (1)
- cmay10 (1)
- PoetCoderJun (1)
- CreamyLong (1)
- tynanseltzer (1)
- mrtolkien (1)
- esparano (1)
- VCode28629 (1)
- taylorvance (1)
Pull Request Authors
- WhymustIhaveaname (2)
- Anton-Gasse (2)
- LucasBorboleta (2)
- harrdb12 (1)
- alexprengere (1)
- HectorAGarcia (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 474 last-month
- Total dependent packages: 3
- Total dependent repositories: 11
- Total versions: 5
- Total maintainers: 1
pypi.org: mcts
A simple package to allow users to run Monte Carlo Tree Search on any perfect information domain
- Homepage: https://github.com/pbsinclair42/MCTS
- Documentation: https://mcts.readthedocs.io/
- License: MIT
-
Latest release: 1.0.4
published about 7 years ago