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
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
💻 Algo-Phantoms-Backend is an Application that provides pathways and quizzes along with a code editor to help you towards your DSA journey.📰🔥 This repository contains the REST APIs of the application.✨

Algo-Phantom-Backend 💻 Algo-Phantoms-Backend is an Application that provides pathways and quizzes along with a code editor to help you towards your D

Algo Phantoms 44 Nov 15, 2022
Python library for the Unmand APIs.

Unmand Python SDK This is a simple package to aid in consuming the Unmand APIs. For more help, see our docs. Getting Started Create virtual environmen

Unmand 4 Jul 22, 2022
BlackMamba is a multi client C2/post exploitation framework

BlackMamba is a multi client C2/post exploitation framework with some spyware features. Powered by Python 3.8.6 and QT Framework.

Gustavo 873 Dec 29, 2022
An Airdrop alternative for cross-platform users only for desktop with Python

PyDrop An Airdrop alternative for cross-platform users only for desktop with Python, -version 1.0 with less effort, just as a practice. ##############

Bernardo Olisan 6 Mar 25, 2022
Easy, clean, reliable Python 2/3 compatibility

Overview: Easy, clean, reliable Python 2/3 compatibility python-future is the missing compatibility layer between Python 2 and Python 3. It allows you

Python Charmers 1.2k Jan 08, 2023
Film-dosimetry - Film dosimetry for DUVS

film-dosimetry Film dosimetry for DUVS Hi David and Joe, here we go this is a te

Christine L Kuryla 3 Jan 20, 2022
MoBioTools A simple yet versatile toolkit to automatically setup quantum mechanics/molecular mechanics

A simple yet versatile toolkit to setup quantum mechanical/molecular mechanical (QM/MM) calculations from molecular dynamics trajectories.

MoBioChem 17 Nov 27, 2022
Collection of script & resources for Foundry's Nuke software.

Author: Liam Collod. Collections of scripting stuff I wrote for Foundry's Nuke software. Utilisation You can have a look at the README.md file in each

Liam Collod 1 May 14, 2022
🐍 A Python lib for (de)serializing Python objects to/from JSON

Turn Python objects into dicts or (json)strings and back No changes required to your objects Easily customizable and extendable Works with dataclasses

Ramon Hagenaars 253 Dec 14, 2022
Hello World in different languages !

Hello World And some Examples in different Programming Languages This repository contains a big list of programming languages and some examples for th

AmirHossein Mohammadi 131 Dec 26, 2022
Project of the MSEC_LDD . group

HackathonJuntionXHN Project of team MSEC_LQĐ What did we do? Building application to generate whitelist regex for Web application firewall How to setu

Nguyễn Mạnh Cường 0 Dec 19, 2021
a url shortener with fastapi and tortoise-orm

fastapi-tortoise-orm-url-shortener a url shortener with fastapi and tortoise-orm

19 Aug 12, 2022
Uproot - A script to bring deeply nested files or directories to the surface

UPROOT Bring deeply nested files or folders to the surface Uproot helps convert

Ted 2 Jan 15, 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
Python code for YouTube videos.

#This is a open source project. Python 3 These files are mainly intended to accompany my series of YouTube tutorial videos here, https://www.youtube.c

Joe James 1.3k Dec 26, 2022
Create Arrays (Working with For Loops)

DSA with Python Create Arrays (Working with For Loops) CREATING ARRAYS WITH USER INPUT Array is a collection of items stored at contiguous memory loca

1 Feb 08, 2022
Proyecto desarrollado para el programa #FutureDevelopers, tabla periódica interactiva.

Tabla_Periodica Proyecto desarrollado para el programa #FutureDevelopers, tabla periódica interactiva. Descripcion primer entregable: Tabla periodica

1 Dec 04, 2021
Plugin to manage site, circuit and device diagrams and documents in Netbox

Netbox Documents Plugin A plugin designed to faciliate the storage of site, circuit and device specific documents within NetBox Note: Netbox v3.2+ is

Jason Yates 38 Dec 24, 2022
Python script that automates the tasks involved in starting a new coding project

Auto Project Builder Automates the repetitive tasks while starting a new project Installation Use the REQUIREMENTS.txt file to install the dependencie

Prathap S S 1 Feb 03, 2022