anemone searches trees
Project description
anemone
anemone is a Python library for tree search over valanga game states. It builds a
shared tree graph and layers algorithm-specific wrappers on top so you can plug in
node evaluation, exploration indices, and selection policies for "tree and value"
searches.
Highlights
- Tree-and-value exploration pipeline driven by
TreeAndValueBranchSelector. - Modular factories for node evaluation, selection, index computation, and tree management.
- Pluggable stopping criteria and recommender rules for final branch selection.
- Optional torch-based evaluator for batched neural evaluations.
Installation
pip install anemone
Optional torch integration:
pip install anemone[nn]
Quick start
anemone exposes factory helpers to build a branch selector configured with your
node selector, evaluation, and stopping-criterion choices. At runtime you feed it a
valanga state and a seed to get back a branch recommendation.
from random import Random
from anemone import TreeAndValuePlayerArgs, create_tree_and_value_branch_selector
from anemone.node_selector.factory import UniformArgs
from anemone.node_selector.node_selector_types import NodeSelectorType
from anemone.progress_monitor.progress_monitor import (
StoppingCriterionTypes,
TreeBranchLimitArgs,
)
from anemone.recommender_rule.recommender_rule import SoftmaxRule
# Populate the pieces specific to your game domain.
args = TreeAndValuePlayerArgs(
node_selector=UniformArgs(type=NodeSelectorType.UNIFORM),
opening_type=None,
stopping_criterion=TreeBranchLimitArgs(
type=StoppingCriterionTypes.TREE_BRANCH_LIMIT,
tree_branch_limit=100,
),
recommender_rule=SoftmaxRule(type="softmax", temperature=1.0),
)
selector = create_tree_and_value_branch_selector(
state_type=YourStateType,
args=args,
random_generator=Random(0),
master_state_evaluator=your_state_evaluator,
state_representation_factory=None,
queue_progress_player=None,
)
recommendation = selector.select_branch(state=current_state, selection_seed=0)
print(recommendation.branch_key)
Design
This codebase follows a “core node + wrappers” pattern.
-
TreeNode(core)TreeNodeis the canonical, shared data structure.- It stores the graph structure:
branches_childrenandparent_nodes. - There is conceptually a single tree/graph of
TreeNodes.
-
Wrappers implement
ITreeNode- Higher-level nodes (e.g.
AlgorithmNode) wrap aTreeNodeand add algorithm-specific state: evaluation, indices, representations, etc. - Wrappers expose navigation by delegating to the underlying
TreeNode.
- Higher-level nodes (e.g.
-
Homogeneity at the wrapper level
- Even though
TreeNodeis the core place where connections are stored, each wrapper is intended to be closed under parent/child links:- a wrapper’s
branches_childrenandparent_nodescontain that same wrapper type. - today this is typically either “all
TreeNode” or “allAlgorithmNode”. - in the future, another wrapper can exist (still implementing
ITreeNode), and it should also be homogeneous within itself.
- a wrapper’s
- Even though
The practical motivation is:
- algorithms can be written against
ITreeNode(for navigation) and against wrappers likeAlgorithmNode(for algorithm-specific fields), - while keeping a single shared underlying structure that can be accessed consistently from any wrapper.
Repository layout
Each important package folder includes a local README with details. Start with:
src/anemone/for the main search pipeline and public entry points.src/anemone/node_selector/for selection strategies (Uniform, RecurZipf, Sequool).src/anemone/node_evaluation/for direct evaluation and minmax tree evaluation.src/anemone/tree_manager/,src/anemone/trees/, andsrc/anemone/updates/for tree construction, expansion, and backpropagation.src/anemone/indices/for exploration index computation and updates.tests/for index and tree-building fixtures.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file algorhino_anemone-0.1.18.tar.gz.
File metadata
- Download URL: algorhino_anemone-0.1.18.tar.gz
- Upload date:
- Size: 88.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecd98c91b3b7447d5702c36e43ed723f731c77fd65fee90b1e8f128804368c12
|
|
| MD5 |
d9e1717df653d7a9202ef85a0921ed4f
|
|
| BLAKE2b-256 |
a7f084fa859531d913751de851c930ff12d0fe97c0d60c3c819eaf1a4221fe95
|
Provenance
The following attestation bundles were made for algorhino_anemone-0.1.18.tar.gz:
Publisher:
release.yml on victorgabillon/anemone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
algorhino_anemone-0.1.18.tar.gz -
Subject digest:
ecd98c91b3b7447d5702c36e43ed723f731c77fd65fee90b1e8f128804368c12 - Sigstore transparency entry: 954809714
- Sigstore integration time:
-
Permalink:
victorgabillon/anemone@be694a68e8b031cae5ed4ad5e640bd31c3315d23 -
Branch / Tag:
refs/tags/v0.1.18 - Owner: https://github.com/victorgabillon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@be694a68e8b031cae5ed4ad5e640bd31c3315d23 -
Trigger Event:
push
-
Statement type:
File details
Details for the file algorhino_anemone-0.1.18-py3-none-any.whl.
File metadata
- Download URL: algorhino_anemone-0.1.18-py3-none-any.whl
- Upload date:
- Size: 115.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fa29bf5313984aef5fa14bd67d2a090dfef0b4fb766e1a512d8ed0e3346904d
|
|
| MD5 |
7aa38b0de10c271f1b9f149833369260
|
|
| BLAKE2b-256 |
9e891e65508b27cc482d240792c91ce4a48477943cbdf5109ae722eb817832c5
|
Provenance
The following attestation bundles were made for algorhino_anemone-0.1.18-py3-none-any.whl:
Publisher:
release.yml on victorgabillon/anemone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
algorhino_anemone-0.1.18-py3-none-any.whl -
Subject digest:
4fa29bf5313984aef5fa14bd67d2a090dfef0b4fb766e1a512d8ed0e3346904d - Sigstore transparency entry: 954809724
- Sigstore integration time:
-
Permalink:
victorgabillon/anemone@be694a68e8b031cae5ed4ad5e640bd31c3315d23 -
Branch / Tag:
refs/tags/v0.1.18 - Owner: https://github.com/victorgabillon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@be694a68e8b031cae5ed4ad5e640bd31c3315d23 -
Trigger Event:
push
-
Statement type: