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
This repository contains all the data analytics projects that I've worked on in python.

93_Python_Data_Analytics_Projects This repository contains all the data analytics projects that I've worked on in python. No. Name 01 001_Cervical_Can

Milaan Parmar / Милан пармар / _米兰 帕尔马 267 Jan 06, 2023
Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat 📊 Stats 🧪 Get SESSION_NAME from below:

dark phoenix 12 May 08, 2022
Prototype application for GCM bias-correction and downscaling

dodola Prototype application for GCM bias-correction and downscaling This is an unstable prototype. This is under heavy development. Features Nothing!

Climate Impact Lab 9 Dec 27, 2022
Problem 5: Fermat near-misses

Problem 5: Fermat near-misses fermatnearmiss This is a script that computes fermat nearm misses when the -f option is set and requires users to input

CHRIS BYRON (Int0x80) 1 Jan 08, 2022
A10 cipher - A Hill 2x2 cipher that totally gone wrong

A10_cipher This is a Hill 2x2 cipher that totally gone wrong, it encrypts with H

Caner Çetin 15 Oct 19, 2022
These are the scripts used for the project of ‘Assembly of a pan-genome for global cattle reveals missing sequence and novel structural variation, providing new insights into their diversity and evolution history’

script-SV-genotyping These are the scripts used for the project of ‘Assembly of a pan-genome for global cattle reveals missing sequence and novel stru

2 Aug 26, 2022
A collection of simple tools that proved to be needed for hadling large periodic calculations with the VASP software package.

VESTA-tools A collection of simple tools that proved to be needed for handling large periodic calculations with the VASP software package. distTotCalc

Ilia Kichev 2 Dec 14, 2021
Extra scripts to improve user experience related to OpenTaiko

OpenTaiko-Utils Extra scripts to improve user experience related to OpenTaiko osu2tja /!\ IMPORTANT NOTE /!\ Converted charts that aren't yours are fo

2 Dec 25, 2022
A Curated Collection of Awesome Python Scripts

A Curated Collection of Awesome Python Scripts that will make you go wow. This repository will help you in getting those green squares. Hop in and enjoy the journey of open source. 🚀

Prathima Kadari 248 Dec 31, 2022
RISE allows you to instantly turn your Jupyter Notebooks into a slideshow

RISE RISE allows you to instantly turn your Jupyter Notebooks into a slideshow. No out-of-band conversion is needed, switch from jupyter notebook to a

Damian Avila 3.4k Jan 04, 2023
Scripts to convert the Ted-MDB corpora into the formats for DISRPT shared task and the converted corpora

Scripts to convert the Ted-MDB corpora into the formats for DISRPT shared task and the converted corpora.

1 Feb 08, 2022
Find Transposon Element insertions using long reads (nanopore), by alignment directly. (minimap2)

find_te_ins find_te_ins is designed to find Transposon Element (TE) insertions using long reads (nanopore), by alignment directly. (minimap2) Install

Ming Wang 1 Feb 09, 2022
Remote Worker

Remote Worker Separation of Responsibilities There are several reasons to move some processing out of the main code base for security or performance:

V2EX 69 Dec 05, 2022
The Python Achievements Framework!

Pychievements: The Python Achievements Framework! Pychievements is a framework for creating and tracking achievements within a Python application. It

Brian 114 Jul 21, 2022
Up to date simple useragent faker with real world database

fake-useragent info: Up to date simple useragent faker with real world database Features grabs up to date useragent from useragentstring.com randomize

Victor K. 2.9k Jan 04, 2023
Python library for generating CycloneDX SBOMs

Python Library for generating CycloneDX This CycloneDX module for Python can generate valid CycloneDX bill-of-material document containing an aggregat

CycloneDX SBOM Standard 31 Dec 16, 2022
IPython: Productive Interactive Computing

IPython: Productive Interactive Computing Overview Welcome to IPython. Our full documentation is available on ipython.readthedocs.io and contains info

IPython 15.6k Dec 31, 2022
Syarat.ID Source Code - Syarat.ID is a content aggregator website

Syarat.ID is a content aggregator website that gathering all informations with the specific keyword: "syarat" from the internet.

Syarat.ID 2 Oct 15, 2021
Banking management project using Tkinter GUI in python.

Bank-Management Banking management project using Tkinter GUI in python. Packages required Tkinter - Tkinter is the standard GUI library for Python. sq

Anjali Kumawat 7 Jul 03, 2022
SkyPort console user terminal written in python

SkyPort terminal implemented as a console script written in Python Description Sky Port is an universal bus between user software and compute resource

Sky Workflows 1 Oct 23, 2022