Skip to main content

Tyr datalog/planning library

Project description

Tyr: Generalized Planning in C++20 and Python

Tyr is designed to address several challenges in modern planning systems:

  1. Unified grounded and lifted planning within a type-safe API.

  2. Rapid prototyping through Python bindings with type hints, backed by a high-performance C++ core.

  3. Support for expressive numeric planning formalisms across both grounded and lifted reasoning paradigms (see Supported PDDL Features).

  4. Integration of learning and reasoning by supporting collections of planning tasks over a shared planning domain.

Technical Overview

  • PDDL frontend: Tyr uses Loki to parse, normalize, and translate PDDL input. The parser is implemented with Boost and provides informative error messages for syntactically invalid input. The normalization pipeline largely follows the approach described in Section 4 of Concise finite-domain representations for PDDL planning tasks.

  • Datalog engine: Tyr implements a parallel semi-naive Datalog engine for lifted successor generation, axiom evaluation, relaxed planning graph heuristics, and task grounding. Its execution model is synchronous and supports both rule-level and grounding-level parallelism.

  • Ground planning: For grounded tasks, Tyr uses data structures inspired by The Fast Downward Planning System to efficiently identify applicable actions in a given state. Grounding often yields substantial performance improvements, although it is not always feasible for large tasks.

  • State representation: Tyr statically analyzes domain and problem files and partitions predicates, functions, and related structures into strongly typed categories such as static, fluent, and derived atoms. This design prevents accidental mixing of conceptually different entities. To represent sequences compactly, Tyr uses tree databases of perfectly balanced binary trees, allowing common subsequences to be shared through shared subtrees. As a special case, Tyr synthesizes finite-domain variables for fluent atoms in grounded planning, largely following the method described in Section 5 of Concise finite-domain representations for PDDL planning tasks, enabling more compact storage when grounding is feasible.

  • Memory model: Tyr stores generated data in hierarchically structured, geometrically growing buffers. For variable-sized objects, it uses Cista for serialization and zero-copy deserialization. This design allows derived buffers to inherit data from parent buffers without duplication. For example, multiple tasks can share a domain, and multiple workers can share task data.

Getting Started

The library consists of a formalism and a planning component. The formalism component is responsible for representing PDDL entities. The planning component provides functionality for implementing search algorithms, as well as off-the-shelf implementations of eager A*, lazy GBFS, and heuristics such as blind, max, add, and FF. Below is a minimal overview of the Python and C++ APIs for implementing custom search algorithms.

Python Interface

Pytyr is available at PyPI and can be installed with pip install pytyr.

Detailed examples are available in the python/examples directory:

  • structures.py – Parse and traverse all planning formalism structures.
  • builder.py – Create new planning formalism structures.
  • invariants.py – Synthesize invariants, access candidate variable bindings, and match atoms through unification.
  • astar_eager.py – Use and customize off-the-shelf search algorithms.
  • gbfs_lazy.py – Implement a custom search algorithm from scratch.

The Python interface for implementing search algorithms is:

# Recommended namespace aliases
import pytyr.formalism.planning as tfp
import pytyr.planning.lifted as tpl  # pytyr.planning.ground also exists

# Parse and translate a task over a domain.
parser = tfp.Parser("domain.pddl")
# Instantiate a lifted task.
task = tpl.Task(parser.parse_task("problem.pddl"))

# Instantiate a single-threaded execution environment.
execution_context = tpl.ExecutionContext(1)

# Instantiate a lifted successor generator.
successor_generator = tpl.SuccessorGenerator(task, execution_context)

# Get the initial node (state + metric value)
initial_node = successor_generator.get_initial_node()

# Get the labeled successor nodes (sequence of ground action + node)
labeled_successor_nodes = successor_generator.get_labeled_successor_nodes(initial_node)

C++ Interface

The C++ interface for implementing search algorithms is:

#include <tyr/tyr.hpp>

// Recommended namespace aliases.
namespace tfp = tyr::formalism::planning;
namespace tp = tyr::planning;

// Parse and translate a task over a domain.
auto parser = tfp::Parser("domain.pddl");
// Instantiate a lifted task.
auto task = tp::LiftedTask::create(parser.parse_task("problem.pddl"));

// Instantiate a single-threaded execution environment
auto execution_context = tp::ExecutionContext::create(1);

// Instantiate a lifted successor generator.
auto successor_generator = tp::SuccessorGenerator<tp::LiftedTask>(task, execution_context);

// Get the initial node (state + metric value).
auto initial_node = successor_generator.get_initial_node();

// Get the labeled successor nodes (sequence of ground action + node).
auto labeled_successor_nodes = successor_generator.get_labeled_successor_nodes(initial_node);

Dependencies

Tyr consumes native dependencies from Python packages:

uv pip install pyyggdrasil==0.0.6 pypddl==1.0.3
cmake -S . -B build \
  -DPython_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')" \
  -DPython3_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')" \
  -DCMAKE_PREFIX_PATH="$(python -c 'import pypddl, pyyggdrasil; print(f"{pypddl.native_prefix()};{pyyggdrasil.native_prefix()}")')"

For offline/local development, install the native providers from sibling source checkouts first:

cd ../yggdrasil
uv pip install --python ../tyr/.venv/bin/python .
cd ../loki
uv pip install --python ../tyr/.venv/bin/python .

Build Instructions

cmake -S . -B build \
  -DPython_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')" \
  -DPython3_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')" \
  -DCMAKE_PREFIX_PATH="$(python -c 'import pypddl, pyyggdrasil; print(f"{pypddl.native_prefix()};{pyyggdrasil.native_prefix()}")')" \
  -DTYR_BUILD_SHARED=ON \
  -DTYR_LINK_STATIC_DEPENDENCIES=OFF

cmake --build build -j16
cmake --install build --prefix=<path/to/installation-directory>

Optional targets are disabled by default and can be enabled during configure:

  • -DBUILD_TESTS=ON
  • -DBUILD_EXECUTABLES=ON
  • -DBUILD_PROFILING=ON
  • -DBUILD_PYTYR=ON

More detailed build instructions are available here.

Integration Instructions

The Python package pytyr installs Tyr's native headers, shared library, and CMake package config under pytyr.native_prefix(). It depends on pypddl for Loki and pyyggdrasil for third-party native dependencies:

import pypddl
import pyyggdrasil
import pytyr

print(pytyr.native_prefix())
print(pypddl.native_prefix())
print(pyyggdrasil.native_prefix())

Downstream CMake projects can then use:

cmake -S . -B build \
  -DCMAKE_PREFIX_PATH="$(python -c 'import pytyr, pypddl, pyyggdrasil; print(f"{pytyr.native_prefix()};{pypddl.native_prefix()};{pyyggdrasil.native_prefix()}")')"

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

pytyr-0.0.12.tar.gz (3.4 MB view details)

Uploaded Source

Built Distributions

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

pytyr-0.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pytyr-0.0.12-cp313-cp313-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pytyr-0.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pytyr-0.0.12-cp312-cp312-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pytyr-0.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pytyr-0.0.12-cp311-cp311-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pytyr-0.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pytyr-0.0.12-cp310-cp310-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pytyr-0.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pytyr-0.0.12-cp39-cp39-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pytyr-0.0.12.tar.gz.

File metadata

  • Download URL: pytyr-0.0.12.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pytyr-0.0.12.tar.gz
Algorithm Hash digest
SHA256 5f92e0d9eb1315145d121dcbcc0acce5637a1f04e3f87c931694954e7c9256fa
MD5 c86dad31e5621371b10248967880cad1
BLAKE2b-256 93751ecbfbca68a4b68d842dae686f9ac318f28e92cbc5e020109045e4b8c23d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12.tar.gz:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4bfe1e9ba0041e8e2fa12c2c5407ac53de169f7925f28e0fd91a18ccc4855c13
MD5 bbf1fca040d07335e4d3ab0f6c6548cc
BLAKE2b-256 bcaaf0ff668032138ed7e444265a437d140351c458ca672ff6f4856449702afb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 974bd389676c996975a8f40771f90e092dc2c1d1fc56e47552844090c7d1375a
MD5 eac43d92de72d9e04a03da3d39a7f817
BLAKE2b-256 7852d34824c9c45997f58ecfdcccffc175132d8ceba1fb69ecb3394ec5ec6a15

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b069a9f323643d362232c78ef0fd47fc35c0389e037c486b124e6a9836dd39a
MD5 72ec8582f7fc25d48590dc27b8dd5472
BLAKE2b-256 a185c6d97feaa47ebc1ea34b39dd92da112eec738151c3607a48dd60897fb72f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d8771bb9fcf56c36a831a54b0d30250188cfbbe9a4f98a47d9030d22702b6bda
MD5 1b88d6af34274296c1ea8e60d7e74820
BLAKE2b-256 37a8d09744314ac89ca53310576ed2e1581ea47092f55ac156a39850bcd9057e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 736ea68a3bfbf027e886064de3bbc386888ec4b33c66b4cd606213655b393b40
MD5 455b1a1e684686612054258c78b4a03f
BLAKE2b-256 2c48f39e6df3ba8b4e8509bd261c574b1cc95ebd4c9a940072088775635a46e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5decda5e2b7da661a267888f64bd8a0208e30ee85c987a7b1e23982e0641702c
MD5 48ebb43d2e3e1cf0e6cc0e1174ceeb98
BLAKE2b-256 31bb69982e80ca8f598aad92035cfe95b5768e0e919d47647a5104c3e81bfe69

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b622b9f53a278e5069e1d3ded632700a9a35e42f4aaae1b2239b295d8594327
MD5 3dac1f8bdf26b545db80b8f228d93d85
BLAKE2b-256 7480da2bf4ead690d0894ef89357b412b40f3866040a61ce61f2dcccb8a69e0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09a3eb87e399a538e0f51fb15d0acc858c5f8b3ae013caa98218318579b1ebfd
MD5 f78e26058e98b9013d3d45592bcc58f5
BLAKE2b-256 aabb6bba2da30da4d42934c020cc889f6a77d2c912e03f9521216efe76a9d767

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 76911d4dc64b8d0c05350207fd9e15037db6c2a70e1434070b378b792c5211cf
MD5 64352397a2fb99234185f4dca77ae279
BLAKE2b-256 9d5b6e0a2e45641b1efaefec58248057c3314d32d122e3a81f4a25e7e59460f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/tyr

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

File details

Details for the file pytyr-0.0.12-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.12-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4882ccc884bb74119709c9d48071a2c41addc8bb68c9032df3124887fadf8814
MD5 6389c4623e77a9da6652330b2852c502
BLAKE2b-256 dc9c69fde0d6042648da6fce8db0a64dcf587ed07b224a7c3ad4dfdcfed6a5e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytyr-0.0.12-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/tyr

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