Skip to main content

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]

Optional debug tooling:

pip install anemone[debug]

Debug snapshot export and the debug browser's SVG rendering also require the system Graphviz executable (dot) to be installed.

  • Ubuntu: sudo apt install graphviz
  • macOS: brew install graphviz

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)

    • TreeNode is the canonical, shared data structure.
    • It stores the graph structure: branches_children and parent_nodes.
    • There is conceptually a single tree/graph of TreeNodes.
  • Wrappers implement ITreeNode

    • Higher-level nodes (e.g. AlgorithmNode) wrap a TreeNode and add algorithm-specific state: evaluation, indices, representations, etc.
    • Wrappers expose navigation by delegating to the underlying TreeNode.
  • Homogeneity at the wrapper level

    • Even though TreeNode is the core place where connections are stored, each wrapper is intended to be closed under parent/child links:
      • a wrapper’s branches_children and parent_nodes contain that same wrapper type.
      • today this is typically either “all TreeNode” or “all AlgorithmNode”.
      • in the future, another wrapper can exist (still implementing ITreeNode), and it should also be homogeneous within itself.

The practical motivation is:

  • algorithms can be written against ITreeNode (for navigation) and against wrappers like AlgorithmNode (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/, and src/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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

algorhino_anemone-0.2.9.tar.gz (209.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algorhino_anemone-0.2.9-py3-none-any.whl (217.0 kB view details)

Uploaded Python 3

File details

Details for the file algorhino_anemone-0.2.9.tar.gz.

File metadata

  • Download URL: algorhino_anemone-0.2.9.tar.gz
  • Upload date:
  • Size: 209.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for algorhino_anemone-0.2.9.tar.gz
Algorithm Hash digest
SHA256 d8893fdc4ed52f1a75a75fb57fb8dc6f969aac0e6ef4af55a8d3b191465c1bfa
MD5 f430fc0bb11d719671f6a2edbc8e8059
BLAKE2b-256 e9fc40772d98b6486f51a5dcc4b54d5bac67c7bf8642f96cc005d3895a233225

See more details on using hashes here.

Provenance

The following attestation bundles were made for algorhino_anemone-0.2.9.tar.gz:

Publisher: release.yml on victorgabillon/anemone

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file algorhino_anemone-0.2.9-py3-none-any.whl.

File metadata

File hashes

Hashes for algorhino_anemone-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 2a86c594390ac343f2475265afe81fb0e8ae73b084b1996a91ea292b44cadb1c
MD5 436417fef661857e39d014cfb7b06cb0
BLAKE2b-256 987830263edb78236764d789a7b0006a814f8cf444dd189e0449397d4e861f49

See more details on using hashes here.

Provenance

The following attestation bundles were made for algorhino_anemone-0.2.9-py3-none-any.whl:

Publisher: release.yml on victorgabillon/anemone

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page