Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and improvements in the parsing of typed lists #82

Merged
merged 51 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e3a249e
fix: remove constants.py module and use pddl/parser/symbols.py
marcofavorito Jun 6, 2023
658dc62
fix: add missing __invert__ method for True/FalseFormula classes
marcofavorito Jun 7, 2023
d7d0534
test: fix blocksworld_fond/p01.pddl goal
marcofavorito Jun 7, 2023
d5b509c
chore: add 'check' function to generalize assert_ for any exception type
marcofavorito Jun 7, 2023
3c53e3f
feat: add TypesIndex class
marcofavorito Jun 7, 2023
3cf8cb4
feat: changing domain parser behaviour on typed_list_name (backward c…
marcofavorito Jun 7, 2023
cf25df5
test: add problem parsing in test_formatter.py
marcofavorito Jun 7, 2023
ccb5097
test: fix expected error messages when duplicated names/types occur
marcofavorito Jun 7, 2023
7a7836c
fix: minor fix to object-supertypes-error
marcofavorito Jun 7, 2023
f1e3316
fix: use 'name' type to validate tokens of typed list
marcofavorito Jun 7, 2023
48ffa56
chore: sort Symbols in alphanumerical order
marcofavorito Jun 7, 2023
976f481
fix: add keyword validation for typed list names
marcofavorito Jun 7, 2023
889b3fc
fix: renaming variables to avoid shadowing from outer scope
marcofavorito Jun 7, 2023
73e4fac
feat: use TypesIndex to parse and validate typed_list_variables
marcofavorito Jun 7, 2023
d2dded9
test: split domain parser tests from problem parser tests
marcofavorito Jun 7, 2023
67d3b1d
docs: fix types argument passed to Domain in README
marcofavorito Jun 7, 2023
124a60a
fix: problem optionally accepts requirements
marcofavorito Jun 7, 2023
03abf7d
lint: fix vulture's whitelist
marcofavorito Jun 7, 2023
04fe2f8
feat: add internal class to manage and handle types
marcofavorito Jun 7, 2023
1a35939
refactor: more Requirements to its own module pddl.requirements
marcofavorito Jun 7, 2023
c3ab1aa
chore: move _Types in pddl._validation
marcofavorito Jun 7, 2023
35f333b
chore: return 'name' instead of str in domain/problem names property …
marcofavorito Jun 7, 2023
529d35d
chore: used 'validate' instead of 'assert_'
marcofavorito Jun 7, 2023
0d264a8
chore: add Problem.check method stub
marcofavorito Jun 7, 2023
03e632b
chore: change the way requirements are set in a Problem object
marcofavorito Jun 7, 2023
f232127
fix: update domain setter of Problem
marcofavorito Jun 7, 2023
1586db1
feat: add TypeChecker utility class and use it for checking (both dom…
marcofavorito Jun 7, 2023
e879efb
fix: improve Problem initialize regarding requirements and domain_nam…
marcofavorito Jun 7, 2023
771c6fc
test: refactor parametrized tests
marcofavorito Jun 7, 2023
2d35e8c
build: bump minimum Python interpreter supported to 3.8
marcofavorito Jun 7, 2023
190a7c5
fix: minor fixes to requirements handling in core module
marcofavorito Jun 7, 2023
4376e54
feat: add validation of domain/problem predicates
marcofavorito Jun 7, 2023
a511022
feat: add type validation of domain actions
marcofavorito Jun 7, 2023
3d02538
refactor: move Action class in its own module core.action
marcofavorito Jun 7, 2023
617cfd7
test: fix validation exception message
marcofavorito Jun 7, 2023
bdddfbf
feat: add keyword check
marcofavorito Jun 7, 2023
7b3e7ad
test: add tests on wrong variable typed lists
marcofavorito Jun 7, 2023
a12e34b
fix: move keyword validation inside class contructors
marcofavorito Jun 8, 2023
f0e79af
fix: make find_cycle to handle arbitrary graphs
marcofavorito Jun 9, 2023
8c41830
chore: rename TypesIndex to TypedListParser
marcofavorito Jun 9, 2023
eb2429d
feat: allow repetition in variable list
marcofavorito Jun 9, 2023
9a16858
test: improve 'test_variables_repetition_allowed_if_same_type'
marcofavorito Jun 9, 2023
a6367ba
Update .github/workflows/docs.yml
marcofavorito Jun 9, 2023
2c67fde
feat: add validation of no-duplicates in type-tags of a Term
marcofavorito Jun 9, 2023
b8e0a2b
feat: make Term non-instantiatable
marcofavorito Jun 9, 2023
3661f64
feat: check terms consistency wrt type tag
marcofavorito Jun 9, 2023
924c88c
feat: add term type checks in EqualTo class
marcofavorito Jun 9, 2023
f7996d1
test: add more tests for problem parsing
marcofavorito Jun 9, 2023
f5858b3
ci: change GH action version from master to main
marcofavorito Jun 9, 2023
edcc295
fix formatting of typed lists
marcofavorito Jun 13, 2023
97b379f
fix: update error message in case a name inherits from multiple types
marcofavorito Jun 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7]
python-version: ["3.8"]

timeout-minutes: 30

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we change:

- uses: actions/checkout@master
- uses: actions/setup-python@master

to main as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure, thank you for spotting it

steps:
- uses: actions/checkout@master
- uses: actions/setup-python@master
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
timeout-minutes: 30

steps:
- uses: actions/checkout@master
- uses: actions/setup-python@master
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

timeout-minutes: 30

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here?

steps:
- uses: actions/checkout@master
- uses: actions/setup-python@master
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
22 changes: 19 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ You can use the `pddl` package in two ways: as a library, and as a CLI tool.

This is an example of how you can build a PDDL domain or problem
programmatically:

```python
from pddl.logic import Predicate, constants, variables
from pddl.core import Domain, Problem, Action, Requirements
from pddl.core import Domain, Problem
from pddl.action import Action
from pddl.formatter import domain_to_string, problem_to_string
from pddl.requirements import Requirements

# set up variables and constants
x, y, z = variables("x y z", types=["type_1"])
Expand All @@ -103,11 +106,11 @@ a1 = Action(
# define the domain object.
requirements = [Requirements.STRIPS, Requirements.TYPING]
domain = Domain("my_domain",
requirements=requirements,
types={"type_1": []},
constants=[a, b, c],
predicates=[p1, p2],
actions=[a1])
requirements=requirements,
types={"type_1": None},
constants=[a, b, c],
predicates=[p1, p2],
actions=[a1])

print(domain_to_string(domain))
```
Expand All @@ -117,7 +120,7 @@ that gives:
(define (domain my_domain)
(:requirements :strips :typing)
(:types type_1)
(:constants a b c)
(:constants a b c - type_1)
(:predicates (p1 ?x - type_1 ?y - type_1 ?z - type_1) (p2 ?x - type_1 ?y - type_1))
(:action action-1
:parameters (?x - type_1 ?y - type_1 ?z - type_1)
Expand Down Expand Up @@ -145,7 +148,7 @@ Output:
(define (problem problem-1)
(:domain my_domain)
(:requirements :strips :typing)
(:objects a - type_1 b - type_1 c - type_1)
(:objects a b c - type_1)
(:init (not (p2 b c)) (p1 a b c))
(:goal (p2 b c))
)
Expand Down Expand Up @@ -197,7 +200,7 @@ If you want to contribute, here's how to set up your development environment.

- Install [Pipenv](https://pipenv-fork.readthedocs.io/en/latest/)
- Clone the repository: `git clone https://github.com/AI-Planning/pddl.git && cd pddl`
- Install development dependencies: `pipenv shell --python 3.7 && pipenv install --dev`
- Install development dependencies: `pipenv shell --python 3.8 && pipenv install --dev`

## Tests

Expand Down