Python DSL for writing PDDL

Overview

PDDL in Python – Python DSL for writing a PDDL

A minimal implementation of a DSL which allows people to write PDDL in python. Based on parsing python’s AST.

Author: Masataro Asai

License: MIT.

Example in examples/blocksworld.py:

class Blocksworld(Domain):
    def move_b_to_b(bm, bf, bt):
        if clear[bm] and clear[bt] and on[bm, bf]:
            clear[bt]  = False
            on[bm, bf] = False
            on[bm, bt] = True
            clear[bf]  = True

    def move_b_to_t(bm, bf):
        if clear[bm] and on[bm, bf]:
            on[bm, bf]   = False
            on_table[bm] = True
            clear[bf]    = True

    def move_t_to_b(bm, bt):
        if clear[bm] and clear[bt] and on_table[bm]:
            clear[bt]    = False
            on_table[bm] = False
            on[bm, bt]   = True

print(Blocksworld())

will print

(domain blocksworld
  (:requirement :strips)
  (:types)
  (:predicates
    (clear ?x0)
    (on ?x0 ?x1)
    (on-table ?x0))
  (:action move-b-to-b :parameters (?bm ?bf ?bt)
   :preconditions
   (and
     (clear ?bm)
     (clear ?bt)
     (on ?bm ?bf))
   :effects
   (and
     (not (clear ?bt))
     (not (on ?bm ?bf))
     (on ?bm ?bt)
     (clear ?bf)))
  (:action move-b-to-t :parameters (?bm ?bf)
   :preconditions
   (and
     (clear ?bm)
     (on ?bm ?bf))
   :effects
   (and
     (not (on ?bm ?bf))
     (on-table ?bm)
     (clear ?bf)))
  (:action move-t-to-b :parameters (?bm ?bt)
   :preconditions
   (and
     (clear ?bm)
     (clear ?bt)
     (on-table ?bm))
   :effects
   (and
     (not (clear ?bt))
     (not (on-table ?bm))
     (on ?bm ?bt))))

Example in examples/briefcaseworld.py:

class location:
    pass
class portable:
    pass
class Briefcaseworld(Domain):
    def move(m : location, l : location):
        if is_at[m]:
            is_at[l] = True
            is_at[m] = False
            for x in all(portable): # current python syntax does not allow annotating loop variable
                if _in[x]:
                    at[x,l] = True
                    at[x,m] = False

    def take_out(x : portable):
        if _in[x]:
            _in[x] = False

    def put_in(x : portable, l : location):
        if not _in[x] and at[x,l] and is_at[l]:
            _in[x] = True

print(Briefcaseworld())

will print

(domain briefcaseworld
  (:requirement :strips)
  (:types
    portable - object)
  (:predicates
    (is-at ?x0)
    (in ?x0)
    (at ?x0 ?x1))
  (:action move :parameters (?m - location ?l - location)
   :preconditions
   (is-at ?m)
   :effects
   (and
     (is-at ?l)
     (not (is-at ?m))
     (forall (?x - portable)
       (when (in ?x)
         (and
           (at ?x ?l)
           (not (at ?x ?m)))))))
  (:action put-in :parameters (?x - portable ?l - location)
   :preconditions
   (and
     (not (in ?x))
     (at ?x ?l)
     (is-at ?l))
   :effects
   (in ?x))
  (:action take-out :parameters (?x - portable)
   :preconditions
   (in ?x)
   :effects
   (not (in ?x))))
Owner
International Business Machines
International Business Machines
Chemical Analysis Calculator, with full solution display.

Chemicology Chemical Analysis Calculator, to solve problems efficiently by displaying whole solution. Go to releases for downloading .exe, .dmg, Linux

Muhammad Moazzam 2 Aug 06, 2022
Procedural 3D data generation pipeline for architecture

Synthetic Dataset Generator Authors: Stanislava Fedorova Alberto Tono Meher Shashwat Nigam Jiayao Zhang Amirhossein Ahmadnia Cecilia bolognesi Dominik

Computational Design Institute 49 Nov 25, 2022
Python library for converting Python calculations into rendered latex.

Covert art by Joshua Hoiberg handcalcs: Python calculations in Jupyter, as though you wrote them by hand. handcalcs is a library to render Python calc

Connor Ferster 5.1k Jan 07, 2023
Example python package with pybind11 cpp extension

Developing C++ extension in Python using pybind11 This is a summary of the commands used in the tutorial.

55 Sep 04, 2022
Check broken access control exists in the Java web application

javaEeAccessControlCheck Check broken access control exists in the Java web application. 检查 Java Web 应用程序中是否存在访问控制绕过问题。 使用 python3 javaEeAccessControl

kw0ng 3 May 04, 2022
jmespath.rs Python binding

rjmespath-py jmespath.rs Python binding.

messense 3 Dec 14, 2022
A simple but flexible plugin system for Python.

PluginBase PluginBase is a module for Python that enables the development of flexible plugin systems in Python. Step 1: from pluginbase import PluginB

Armin Ronacher 1k Dec 16, 2022
Url-check-migration-python - A python script using Apica API's to migrate URL checks between environments

url-check-migration-python A python script using Apica API's to migrate URL chec

Angelo Aquino 1 Feb 16, 2022
Neogex is a human readable parser standard, being implemented in Python

Neogex (New Expressions) Parsing Standard Much like Regex, Neogex allows for string parsing and validation based on a set of requirements. Unlike Rege

Seamus Donnellan 1 Dec 17, 2021
Mechanized literally means automation.

Mechanized literally means automation. And this branch which you are now observing is automated by the python script. This python project actually automates my workflow related to Git & Github.

Shreejan Dolai 4 Nov 11, 2022
Archive, organize, and watch for changes to publicly available information.

0. Overview The Trapper Keeper is a collection of scripts that support archiving information from around the web to make it easier to study and use. I

Bill Fitzgerald 9 Oct 26, 2022
LibreMind is a free meditation app made in under 24 hours. It has various meditation, breathwork, and visualization exercises.

libreMind Meditation exercises What is it? LibreMind is a free meditation app made in under 24 hours. It has various meditation, breathwork, and visua

1 May 24, 2022
Open HW & SW for Scanning Electron Microscopes

OpenSEM Project Status: Preliminary The purpose of this project is to create a modern and open-source hardware and software platform for using vintage

Steven Lovegrove 7 Nov 01, 2022
Anki Cards for the HSK vocabulary Chinese-German

Anki-HanyuShuipingKaoshi Anki Cards for the HSK vocabulary Chinese-German Das Deck baut auf folgenden Quellen auf: China Endecken Wortschatz von wohok

1 Jan 07, 2022
Supply Chain will be a SAAS platfom to provide e-logistic facilites with most optimal

Shipp It Welcome To Supply Chain App [ Shipp It ] In "Shipp It" we are creating a full solution[web+app] for a entire supply chain from receiving orde

SAIKAT_CLAW 25 Dec 26, 2022
Broken Link Finder is a Burp Extension to detect broken links for a passive scanning domains and links.

Broken Link Finder Broken Link Finder is a Burp Extension to detect broken links for a passive scanning domains and links. Inspired by InitRoot's link

Red Section 10 Sep 11, 2021
Web service which feeds Navitia with real-time disruptions

Chaos Chaos is the web service which can feed Navitia with real-time disruptions. It can work together with Kirin which can feed Navitia with real-tim

KISIO Digital 7 Jan 07, 2022
How did Covid affect businesses?

NYC_Business_Analysis How did Covid affect businesses? COVID's effect on NYC businesses We all know that businesses in NYC have been affected by COVID

AK 1 Jan 15, 2022
This simple script generates a backup of a given Python and R environment

Python Environment Backup It’s always good to maintain your Python and R Anaconda environment packages properly listed and well-kept in case you have

Andrew Laganaro 1 Jul 13, 2022
Spartan implementation of H.O.T.T.

Down The Path I was walking down the line, Trying to find some peace of mind. Then I saw you, You were takin' it slow, And walkin' it one step at a ti

Trebor Huang 25 Aug 05, 2022