Skip to content

Commit 783a3c3

Browse files
authored
Merge pull request #55 from APLA-Toolbox/package-pypi
Packaging Pypi
2 parents 35b1d3b + b515901 commit 783a3c3

14 files changed

Lines changed: 74 additions & 33 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ on: [push]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-latest
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-latest]
11+
python-version: [3.6, 3.7, 3.8]
12+
exclude:
13+
- os: macos-latest
14+
python-version: 3.8
815

916
steps:
1017
- uses: actions/checkout@v2

.github/workflows/tests.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ on: [push]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-latest
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-latest]
11+
python-version: [3.6, 3.7, 3.8]
12+
exclude:
13+
- os: macos-latest
14+
python-version: 3.8
815

916
steps:
1017
- uses: actions/checkout@v2
@@ -34,7 +41,16 @@ jobs:
3441
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3542
3643
test:
37-
runs-on: ubuntu-latest
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
matrix:
47+
os: [ubuntu-latest, macos-latest, windows-latest]
48+
python-version: [3.6, 3.7, 3.8, pypy-3.6]
49+
exclude:
50+
- os: macos-latest
51+
python-version: 3.8
52+
- os: windows-latest
53+
python-version: 3.6
3854
steps:
3955
- uses: actions/checkout@v2
4056
- name: Set up Python 3.7

README.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,15 @@ $ julia --color=yes -e 'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github.
4545

4646
```bash
4747
$ python3 -m pip install --upgrade pip
48-
$ git clone https://github.com/APLA-Toolbox/PythonPDDL
49-
$ cd PythonPDDL
50-
$ python3 -m pip install -r requirements.txt
48+
$ python3 -m pip install jupyddl
5149
```
5250

53-
# Usage
54-
55-
Navigate to the root directory and you can run the tool by using : `python3 main.py "data/domain.pddl" "data/problem.pddl"`
56-
5751
# REFL Mode
5852

59-
- Clone the repository: `git clone https://github.com/APLA-Toolbox/PythonPDDL`
60-
- Move to the repository folder: `cd PythonPDDL`
6153
- Run `python3` in the terminal.
6254
- Use the AutomatedPlanner class to do what you want:
6355
```python
64-
from src.automated_planner import AutomatedPlanner # takes some time because it has to instantiate the Julia interface
56+
from jupyddl import AutomatedPlanner # takes some time because it has to instantiate the Julia interface
6557
apl = AutomatedPlanner("data/domain.pddl", "data/problem.pddl)
6658

6759
apl.initial_state
@@ -85,15 +77,11 @@ print(apl.get_actions_from_path(path))
8577
[<PyCall.jlwrap flip_row(r1)>, <PyCall.jlwrap flip_row(r3)>, <PyCall.jlwrap flip_column(c2)>]
8678
```
8779

88-
# Script mode
89-
90-
UC
91-
9280
# Contribute
9381

9482
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).
9583

96-
# Contributors
84+
# Maintainers
9785

9886
- Erwin Lejeune
9987
- Sampreet Sarkar

jupyddl/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .automated_planner import AutomatedPlanner
2+
3+
if __name__ == "__main__":
4+
_ = AutomatedPlanner("data/domain.pddl", "data/problem.pddl")
File renamed without changes.
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def satisfies(self, asserted_state, state):
4747
def state_has_term(self, state, term):
4848
if self.pddl.has_term_in_state(self.domain, state, term):
4949
return True
50-
else:
51-
return False
50+
return False
5251

5352
def __flatten_goal(self):
5453
return self.pddl.flatten_goal(self.problem)
@@ -74,8 +73,7 @@ def get_actions_from_path(self, path):
7473
cost = self.pddl.get_value(path[-1].state, "total-cost")
7574
if not cost:
7675
return actions
77-
else:
78-
return (actions, cost)
76+
return (actions, cost)
7977

8078
def get_state_def_from_path(self, path):
8179
if not path:
@@ -92,32 +90,28 @@ def breadth_first_search(self, time_it=False):
9290
path = self.__retrace_path(last_node)
9391
if time_it:
9492
return path, total_time
95-
else:
96-
return path, None
93+
return path, None
9794

9895
def depth_first_search(self, time_it=False):
9996
dfs = DepthFirstSearch(self)
10097
last_node, total_time = dfs.search()
10198
path = self.__retrace_path(last_node)
10299
if time_it:
103100
return path, total_time
104-
else:
105-
return path, None
101+
return path, None
106102

107103
def dijktra_best_first_search(self, time_it=False):
108104
dijkstra = DijkstraBestFirstSearch(self)
109105
last_node, total_time = dijkstra.search()
110106
path = self.__retrace_path(last_node)
111107
if time_it:
112108
return path, total_time
113-
else:
114-
return path, None
109+
return path, None
115110

116111
def astar_best_first_search(self, time_it=False, heuristic=goal_count_heuristic):
117112
astar = AStarBestFirstSearch(self, heuristic)
118113
last_node, total_time = astar.search()
119114
path = self.__retrace_path(last_node)
120115
if time_it:
121116
return path, total_time
122-
else:
123-
return path, None
117+
return path, None
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)