Skip to main content

anemone searches trees

Project description

anemone

anemone is a Python library for tree search over valanga game states. It separates structural tree storage, runtime search state, node evaluation, exploration indices, and selector/opening logic so different search policies can share one coherent runtime.

Overview

The main architectural split is:

  • structure: TreeNode and ITreeNode
  • runtime: AlgorithmNode and TreeExploration
  • evaluation: direct evaluation plus backed-up tree evaluation
  • exploration: per-node exploration-index payloads and tree-wide recomputation
  • selection: selectors and opening instructions that decide what to expand next

Installation

pip install anemone

Optional extras:

pip install anemone[nn]
pip install anemone[debug]

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

Getting started

The canonical public entry point is anemone.factory.create_search.

  • Use anemone.factory to build a runnable search runtime.
  • Treat anemone._runtime_assembly and anemone.search_factory as internal wiring layers behind that API.
  • Use TreeAndValueBranchSelector only when you want the higher-level one-shot recommendation wrapper instead of driving the runtime directly.
from random import Random

from anemone.factory import SearchArgs, create_search

# Domain-specific collaborators omitted for brevity:
# - YourStateType
# - your_dynamics
# - starting_state
# - your_evaluator
# - your_selector_args
# - your_opening_type
# - your_stopping_criterion
# - your_recommender_rule
args = SearchArgs(
    node_selector=your_selector_args,
    opening_type=your_opening_type,
    stopping_criterion=your_stopping_criterion,
    recommender_rule=your_recommender_rule,
)

runtime = create_search(
    state_type=YourStateType,
    dynamics=your_dynamics,
    starting_state=starting_state,
    args=args,
    random_generator=Random(0),
    master_state_value_evaluator=your_evaluator,
    state_representation_factory=None,
)

result = runtime.explore(Random(0))
print(result.branch_recommendation.recommended_name)

Core concepts

  • TreeNode: the concrete structural node storing state, depth, and links.
  • AlgorithmNode: the runtime wrapper that adds tree evaluation and exploration-index payloads.
  • direct_value: the immediate evaluator output for one node.
  • backed_up_value: the subtree-derived value propagated from children.
  • exploration index: optional per-node search-priority data recomputed across the tree by a configured strategy.

How it works

  • create_search(...) assembles the runtime, direct evaluator, selector factory, tree-evaluation factory, and tree manager.
  • The initial tree is created with a directly evaluated root node.
  • A selector chooses which node or branch to open next.
  • The tree manager expands the structure and creates any new runtime nodes.
  • Direct evaluation fills direct_value on newly created nodes.
  • Upward propagation recomputes backed_up_value, branch ordering, and principal variation.
  • Exploration-index payloads are refreshed for the next iteration.

Documentation

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.14.tar.gz (309.5 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.14-py3-none-any.whl (329.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for algorhino_anemone-0.2.14.tar.gz
Algorithm Hash digest
SHA256 f6ab5d3cd9ce902d5853e1a5751c22b286acfb0bcea0ef9b10801881d75ff63f
MD5 9a79af33c990b00493cfe2f9d2adcf7f
BLAKE2b-256 6b8ca86f7945fd1b381b1d39a6b992d31d669c42da8d618977b7f4423851d79e

See more details on using hashes here.

Provenance

The following attestation bundles were made for algorhino_anemone-0.2.14.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.14-py3-none-any.whl.

File metadata

File hashes

Hashes for algorhino_anemone-0.2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 3b70564d0c1599e8cf78fb0b5627cba5e7088ba8fb78a6f5d35c3c8e7b4f0fec
MD5 069e7388be00f4c212846916a1ce19bf
BLAKE2b-256 82a5c192f5ed34b281fc340768cc622de8ee7620ce0f136494a5c6d3d32a7245

See more details on using hashes here.

Provenance

The following attestation bundles were made for algorhino_anemone-0.2.14-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