Skip to main content

Jupyddl is a PDDL planner built on top of a Julia parser

Project description

tests build codecov CodeFactor Percentage of issues still open GitHub license GitHub contributors

PyJulia PDDL Planner

A Python wrapper using JuliaPy for the PDDL.jl parser package and implementing its own planners.

Features

  • Easy to use API for exploring new states
  • Depth First Search
  • Breadth First Search
  • Dijkstra
  • A*
    • Goal Count Heuristic

Dependencies

  • Install Python (3.7.5 is the tested version)

  • Install Julia

$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.5/julia-1.5.2-linux-x86_64.tar.gz
$ tar -xvzf julia-1.5.2-linux-x86_64.tar.gz
$ sudo cp -r julia-1.5.2 /opt/
$ sudo ln -s /opt/julia-1.5.2/bin/julia /usr/local/bin/julia
  • Install Julia dependencies
$ julia --color=yes -e 'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.com/APLA-Toolbox/PDDL.jl"))'
$ julia --color=yes -e 'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.com/JuliaPy/PyCall.jl"))'
  • Install Python dependencies
$ python3 -m pip install --upgrade pip
$ python3 -m pip install jupyddl

REFL Mode

  • Run python3 in the terminal.
  • Use the AutomatedPlanner class to do what you want:
from jupyddl import AutomatedPlanner # takes some time because it has to instantiate the Julia interface
apl = AutomatedPlanner("data/domain.pddl", "data/problem.pddl)

apl.initial_state
<PyCall.jlwrap PDDL.State(Set(Julog.Term[row(r1), column(c3), row(r3), row(r2), column(c2), column(c1)]), Set(Julog.Term[white(r2, c1), white(r1, c2), white(r3, c2), white(r2, c3)]), Dict{Symbol,Any}())>

actions = apl.available_actions(apl.initial_state)
[<PyCall.jlwrap flip_row(r1)>, <PyCall.jlwrap flip_row(r3)>, <PyCall.jlwrap flip_row(r2)>, <PyCall.jlwrap flip_column(c3)>, <PyCall.jlwrap flip_column(c2)>, <PyCall.jlwrap flip_column(c1)>]

apl.satisfies(apl.problem.goal, apl.initial_state)
False

apl.transition(apl.initial_state, actions[0])
<PyCall.jlwrap PDDL.State(Set(Julog.Term[row(r1), column(c3), row(r3), row(r2), column(c2), column(c1)]), Set(Julog.Term[white(r2, c1), white(r1, c1), white(r3, c2), white(r2, c3), white(r1, c3)]), Dict{Symbol,Any}())>

path = apl.breadth_first_search() # computes path ([]State) with BFS

print(apl.get_state_def_from_path(path))
[<PyCall.jlwrap PDDL.State(Set(Julog.Term[row(r1), column(c3), row(r3), row(r2), column(c2), column(c1)]), Set(Julog.Term[white(r2, c1), white(r1, c1), white(r3, c2), white(r2, c3), white(r1, c3)]), Dict{Symbol,Any}())>, <PyCall.jlwrap PDDL.State(Set(Julog.Term[row(r1), column(c3), row(r3), row(r2), column(c2), column(c1)]), Set(Julog.Term[white(r2, c1), white(r1, c1), white(r2, c3), white(r1, c3), white(r3, c3), white(r3, c1)]), Dict{Symbol,Any}())>, <PyCall.jlwrap PDDL.State(Set(Julog.Term[row(r1), column(c3), row(r3), row(r2), column(c2), column(c1)]), Set(Julog.Term[white(r2, c1), white(r1, c1), white(r1, c2), white(r3, c2), white(r2, c3), white(r1, c3), white(r3, c3), white(r3, c1), white(r2, c2)]), Dict{Symbol,Any}())>]

print(apl.get_actions_from_path(path))
[<PyCall.jlwrap flip_row(r1)>, <PyCall.jlwrap flip_row(r3)>, <PyCall.jlwrap flip_column(c2)>]

Contribute

Open an issue to state clearly the contribution you want to make. Upon aproval send in a PR with the Issue referenced. (Implement Issue #No / Fix Issue #No).

Maintainers

  • Erwin Lejeune
  • Sampreet Sarkar

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

jupyddl-0.2.6.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

jupyddl-0.2.6-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file jupyddl-0.2.6.tar.gz.

File metadata

  • Download URL: jupyddl-0.2.6.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.9

File hashes

Hashes for jupyddl-0.2.6.tar.gz
Algorithm Hash digest
SHA256 7c44b22edfe685e4a0638a27be1bc5f6dbd01f5e78458c631805977d74e12cba
MD5 8f27f4d0e110b52f7c24f6e791b2d1bc
BLAKE2b-256 b2f6b288f42ebbaa208debcb6841984ba434a866d7f1774fc9bd06d50a0bdc7a

See more details on using hashes here.

File details

Details for the file jupyddl-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: jupyddl-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.9

File hashes

Hashes for jupyddl-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 faa93efe1e034faefd4caa6f644959eb4f798425e80d062a41a1b4136b3d985c
MD5 077587208dead04c35a9c613f6bcfff0
BLAKE2b-256 f4b335826b4adba8e6d0c378ceaf07b164c769fb123b78f6dedfa96b0d820288

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page