Skip to content

Commit 69250b6

Browse files
authored
Merge pull request #68 from APLA-Toolbox/add-submodule
PDDL Examples -> Submodule
2 parents 9b2d880 + 6003a55 commit 69250b6

14 files changed

Lines changed: 79 additions & 55 deletions

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ jobs:
3838
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3939
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
4040
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41+
- name: Checkout reposistory
42+
uses: actions/checkout@master
43+
- name: Checkout submodules
44+
uses: snickerbockers/submodules-init@v4
4145

.github/workflows/tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
4040
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
4141
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
42+
- name: Checkout reposistory
43+
uses: actions/checkout@master
44+
- name: Checkout submodules
45+
uses: snickerbockers/submodules-init@v4
4246

4347
test:
4448
runs-on: ${{ matrix.os }}
@@ -74,6 +78,10 @@ jobs:
7478
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
7579
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
7680
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
81+
- name: Checkout reposistory
82+
uses: actions/checkout@master
83+
- name: Checkout submodules
84+
uses: snickerbockers/submodules-init@v4
7785
- name: Test with pytest
7886
run: |
7987
pip install pytest

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55
.vscode/*
6-
data/*
7-
!data/.gitkeep
8-
!data/domain.pddl
9-
!data/problem.pddl
106

117
# C extensions
128
*.so
@@ -137,3 +133,4 @@ dmypy.json
137133
logs/*
138134
!logs/.gitkeep
139135
data.json
136+
pddl-examples/*

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "pddl-examples"]
2+
path = pddl-examples
3+
url = https://github.com/APLA-Toolbox/pddl-examples

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,35 @@ $ julia --color=yes -e 'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.
4141
$ julia --color=yes -e 'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.com/JuliaPy/PyCall.jl"))'
4242
```
4343

44-
- Install Python dependencies
44+
- Package installation
4545

4646
```bash
4747
$ python3 -m pip install --upgrade pip
4848
$ python3 -m pip install jupyddl
4949
```
5050

51-
# REFL Mode
51+
# Usage
5252

53-
- Run `python3` in the terminal.
53+
If using the jupyddl pip package:
54+
55+
- If you want to use the data analysis tool, create a pddl-examples folder with pddl instances subfolders containing "problem.pddl" and "domain.pddl". (refer to APLA-Toolbox/pddl-examples)
56+
57+
If you want to use it by cloning the project:
58+
59+
```shell
60+
$ git clone https://github.com/APLA-Toolbox/PythonPDDL
61+
$ cd PythonPDDL
62+
$ git submodule init
63+
$ git submodule update
64+
```
65+
66+
You should have a `pddl-examples` folder containing PDDL instances.
5467

5568
## [AutomatedPlanner]
5669

5770
```python
5871
from jupyddl import AutomatedPlanner # takes some time because it has to instantiate the Julia interface
59-
apl = AutomatedPlanner("data/domain.pddl", "data/problem.pddl)
72+
apl = AutomatedPlanner("pddl-examples/flip/domain.pddl", "pddl-examples/flip/problem.pddl)
6073

6174
apl.initial_state
6275
<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}())>
@@ -81,21 +94,21 @@ print(apl.get_actions_from_path(path))
8194

8295
## [Data Analyst]
8396

84-
Make sure you have a data folder where you run your environment that contains independent folders with "domain.pddl" and "problem.pddl" files, with those standard names.
97+
Make sure you have a pddl-examples folder where you run your environment that contains independent folders with "domain.pddl" and "problem.pddl" files, with those standard names. ( if you didn't generate with git submodule update )
8598

8699
```python
87100
from jupyddl import DataAnalyst
88101

89102
da = DataAnalyst()
90-
da.plot_astar_data() # plots complexity statistics for all the problem.pddl/domain.pddl couples in the data/ folder
103+
da.plot_astar_data() # plots complexity statistics for all the problem.pddl/domain.pddl couples in the pddl-examples/ folder
91104

92-
da.plot_astar_data(problem="data/flip/problem.pddl", domain="data/flip/domain.pddl") # scatter complexity statistics for the provided pddl
105+
da.plot_astar_data(problem="pddl-examples/flip/problem.pddl", domain="pddl-examples/flip/domain.pddl") # scatter complexity statistics for the provided pddl
93106

94107
da.plot_astar_data(heuristic_key="zero") # use h=0 instead of goal_count for your computation
95108

96109
da.plot_dfs() # same as astar
97110

98-
da.comparative_data_plot() # Run all planners on the data folder and plots them on the same figure, data is stored in a data.json file
111+
da.comparative_data_plot() # Run all planners on the pddl-examples folder and plots them on the same figure, data is stored in a data.json file
99112

100113
da.comparative_data_plot(astar=False) # Exclude astar from the comparative plot
101114

data/.gitkeep

Whitespace-only changes.

data/domain.pddl

Lines changed: 0 additions & 17 deletions
This file was deleted.

data/problem.pddl

Lines changed: 0 additions & 9 deletions
This file was deleted.

jupyddl/data_analyst.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ def __get_all_pddl_from_data(self):
2525
domains_problems = []
2626
i = 0
2727
if "DISPLAY" in os.environ:
28-
for root, _, files in os.walk("data/", topdown=False):
28+
for root, _, files in os.walk("pddl-examples/", topdown=False):
2929
for name in files:
30-
if ".gitkeep" in name:
31-
continue
30+
#if ".gitkeep" in name:
31+
# continue
3232
tested_files.append(os.getcwd() + "/" + os.path.join(root, name))
3333
if i % 2 != 0:
3434
domains_problems.append((tested_files[i - 1], tested_files[i]))
3535
i += 1
3636
return domains_problems
37-
return [("data/problem.pddl", "data/domain.pddl")]
37+
return [("pddl-examples/flip/problem.pddl", "pddl-examples/flip/domain.pddl"),
38+
("pddl-examples/dinner/problem.pddl", "pddl-examples/dinner/domain.pddl")]
3839

3940
def __plot_data(self, times, total_nodes, plot_title):
4041
data = dict()

pddl-examples

Submodule pddl-examples added at 8880cab

0 commit comments

Comments
 (0)