mcts

A simple package to allow users to run Monte Carlo Tree Search on any perfect information domain

https://github.com/pbsinclair42/mcts

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
Last synced: 10 months ago · JSON representation

Repository

A simple package to allow users to run Monte Carlo Tree Search on any perfect information domain

Basic Info
  • Host: GitHub
  • Owner: pbsinclair42
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 12.7 KB
Statistics
  • Stars: 228
  • Watchers: 6
  • Forks: 74
  • Open Issues: 6
  • Releases: 1
Created about 8 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

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 player
  • 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 True if 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

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

GitHub Events

Total
  • Watch event: 24
  • Fork event: 4
Last Year
  • Watch event: 24
  • Fork event: 4

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 15
  • Total Committers: 5
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.267
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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
bug (3)
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

  • Versions: 5
  • Dependent Packages: 3
  • Dependent Repositories: 11
  • Downloads: 474 Last month
Rankings
Dependent packages count: 2.3%
Dependent repos count: 4.4%
Average: 5.0%
Forks count: 5.4%
Stargazers count: 5.6%
Downloads: 7.1%
Maintainers (1)
Last synced: 11 months ago

Dependencies

setup.py pypi