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.5 pypddl==1.0.2
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.11.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.11-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.11-cp313-cp313-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pytyr-0.0.11-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.11-cp312-cp312-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pytyr-0.0.11-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.11-cp311-cp311-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pytyr-0.0.11-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.11-cp310-cp310-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pytyr-0.0.11-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.11-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.11.tar.gz.

File metadata

  • Download URL: pytyr-0.0.11.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.11.tar.gz
Algorithm Hash digest
SHA256 7708b0189bbf96cec808f9730c31adbaf4f540368bd70986e1f8f0069992ea87
MD5 af6c8e870368ed61247163f3adfc8c06
BLAKE2b-256 3913aad0f5168e8c2797cdbec00fa70c2de7beb69edf1dc7b0f9db2011360fbb

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fbe80a540b108e4b665efa214fb790de551cbc6aadc539e158148daf06c3970e
MD5 0206dcd495976eeefe76463b77a2e436
BLAKE2b-256 f0bcd1d578335a796c7bc8aaa5e097f97dad9404c991b09c19b00c8bc1ed1911

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d04eabb60c7b246eaea958b252dd61e17674e56c09a4a15ecceac256c9528590
MD5 7050b91524678a5c8b2b37ed9844dd31
BLAKE2b-256 60eed260fe796a8643a62cf97fdd0b6df2b33eed582ac6956fb407f278ff64f2

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b89b377034d9cc6a3f3cd887f2df10c85531268bd2b79e9a6875785e4dad46e5
MD5 e2a695355dd110dae2ab411ae6317126
BLAKE2b-256 c431b4e4890c4d56e67283e9c8caaf866bdb8eba592b2f5b744f5dae3dd7a78d

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94cd7f5c584d584b78ec8e391e8f4514bd53b59d3b32b0443acfae56af4caf47
MD5 808a4727eb6e287a81ed972cbbc65b6f
BLAKE2b-256 0dfe3cbceaf1ff8e830b3d68c0807baf0730883dc02e3586d606b36e0f66f360

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2885b02f84a0261c60b0fc1af51a4738bd75bf059e2fff9aa9a93f7ed8c2d0af
MD5 20cf07f8c0ba818d9268863e9b378f1e
BLAKE2b-256 96f23da4c740e6ea7d9c769594720a4f4a82486ce48f7e736c03d8d803bd5083

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4cd2ec22b63a19aacd386939a5d4d509a0dd6ee7efee596837de09cf14271630
MD5 0e229ad9568fffe981b4bc9d8b89a67e
BLAKE2b-256 0222c5e95e446b1aab3bf836f747e1b496df475c020eaa359c0801cb99113a5c

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2bdd67cc72a94f92bddfeb84f66e92963a2868903d5b1ec96f3b07c6463da54f
MD5 0f389fa2e532fba3af471e5e4ebdeb01
BLAKE2b-256 99f21f9d9abb853300ff13e274b35d1c4df10c1e89d975f5e21ff3373d75fef0

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0444e4d0f46be5819b351332b0da415030d83f230b39574282b84a393ebc379e
MD5 85a6c20b44b591212328d6bca152e5a4
BLAKE2b-256 9a3e9b8d6a3b9ccd732d614cd354ec6a3947cc81c67dd46a6bae46285eb75561

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0a95bb0222ee0223cdf86290ce4b10ebb118314eec56b99493c1b56b065d8409
MD5 eff374f16a3ae5c80950c4298646676b
BLAKE2b-256 4963ff85a77896c1a3eaa145a1cfecf41589393dd9af9397af31239e3897b1fa

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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.11-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytyr-0.0.11-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ccbe2ba869e5d69ab0dc7d68fcb78e4b4ba6cb24195a5fa80273b1f66928ebee
MD5 9a06e7ee765540ab33c5b69f4f9c3d7d
BLAKE2b-256 b505bce69a2e8dec2a6ea5f7aa5b292685d0fac51d4a2457f9e75cad8ab6855e

See more details on using hashes here.

Provenance

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

Publisher: release.yml on drexlerd/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