Skip to content
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ on: [push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
exclude:
- os: macos-latest
python-version: 3.8

steps:
- uses: actions/checkout@v2
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ on: [push]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
exclude:
- os: macos-latest
python-version: 3.8

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -34,7 +41,16 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, pypy-3.6]
exclude:
- os: macos-latest
python-version: 3.8
- os: windows-latest
python-version: 3.6
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
Expand Down
18 changes: 3 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,15 @@ $ julia --color=yes -e 'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.

```bash
$ python3 -m pip install --upgrade pip
$ git clone https://github.com/APLA-Toolbox/PythonPDDL
$ cd PythonPDDL
$ python3 -m pip install -r requirements.txt
$ python3 -m pip install jupyddl
```

# Usage

Navigate to the root directory and you can run the tool by using : `python3 main.py "data/domain.pddl" "data/problem.pddl"`

# REFL Mode

- Clone the repository: `git clone https://github.com/APLA-Toolbox/PythonPDDL`
- Move to the repository folder: `cd PythonPDDL`
- Run `python3` in the terminal.
- Use the AutomatedPlanner class to do what you want:
```python
from src.automated_planner import AutomatedPlanner # takes some time because it has to instantiate the Julia interface
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
Expand All @@ -85,15 +77,11 @@ print(apl.get_actions_from_path(path))
[<PyCall.jlwrap flip_row(r1)>, <PyCall.jlwrap flip_row(r3)>, <PyCall.jlwrap flip_column(c2)>]
```

# Script mode

UC

# 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).

# Contributors
# Maintainers

- Erwin Lejeune
- Sampreet Sarkar
4 changes: 4 additions & 0 deletions jupyddl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .automated_planner import AutomatedPlanner

if __name__ == "__main__":
_ = AutomatedPlanner("data/domain.pddl", "data/problem.pddl")
File renamed without changes.
18 changes: 6 additions & 12 deletions src/automated_planner.py → jupyddl/automated_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def satisfies(self, asserted_state, state):
def state_has_term(self, state, term):
if self.pddl.has_term_in_state(self.domain, state, term):
return True
else:
return False
return False

def __flatten_goal(self):
return self.pddl.flatten_goal(self.problem)
Expand All @@ -74,8 +73,7 @@ def get_actions_from_path(self, path):
cost = self.pddl.get_value(path[-1].state, "total-cost")
if not cost:
return actions
else:
return (actions, cost)
return (actions, cost)

def get_state_def_from_path(self, path):
if not path:
Expand All @@ -92,32 +90,28 @@ def breadth_first_search(self, time_it=False):
path = self.__retrace_path(last_node)
if time_it:
return path, total_time
else:
return path, None
return path, None

def depth_first_search(self, time_it=False):
dfs = DepthFirstSearch(self)
last_node, total_time = dfs.search()
path = self.__retrace_path(last_node)
if time_it:
return path, total_time
else:
return path, None
return path, None

def dijktra_best_first_search(self, time_it=False):
dijkstra = DijkstraBestFirstSearch(self)
last_node, total_time = dijkstra.search()
path = self.__retrace_path(last_node)
if time_it:
return path, total_time
else:
return path, None
return path, None

def astar_best_first_search(self, time_it=False, heuristic=goal_count_heuristic):
astar = AStarBestFirstSearch(self, heuristic)
last_node, total_time = astar.search()
path = self.__retrace_path(last_node)
if time_it:
return path, total_time
else:
return path, None
return path, None
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import setuptools

with open("requirements.txt") as f:
required = f.read().splitlines()

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()


setuptools.setup(
name="jupyddl", # Replace with your own username
version="0.2.4",
author="Erwin Lejeune",
author_email="erwinlejeune.pro@gmail.com",
description="Jupyddl is a PDDL planner built on top of a Julia parser",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/apla-toolbox/pythonpddl",
packages=setuptools.find_packages(),
install_requires=required,
classifiers=[
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: Unix",
"Operating System :: MacOS",
"Framework :: Pytest",
],
python_requires=">=3.6",
)
1 change: 0 additions & 1 deletion src/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_automated_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def test_execute_action():
def test_state_has_term():
apla = AutomatedPlanner("data/domain.pddl", "data/problem.pddl")
is_goal = apla.state_has_term(apla.initial_state, apla.goals[0])
assert is_goal == False
assert not is_goal


def test_state_assertion():
apla = AutomatedPlanner("data/domain.pddl", "data/problem.pddl")
assert apla.satisfies(apla.problem.goal, apla.initial_state) == False
assert not apla.satisfies(apla.problem.goal, apla.initial_state)