Skip to content

Commit

Permalink
Implemented and tested negative preconditions support.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAeryan committed Nov 30, 2022
1 parent 53df4a4 commit dc56b64
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,17 @@ Secondly, it can be called from the command line. It supports different modes of

## Limitations

At the moment, Lifted PDDL only supports typed STRIPS and existential preconditions (`:requirements :typing :existential-preconditions`). In the future, it will be extended to support ADL and, maybe, other PDDL requirements. We also welcome contributions. The code is brief, simple to understand and has many comments, so I encourage you to implement any functionality you need and submit a pull request to the [Github](https://github.com/AI-Planning/lifted-pddl)! 😄
At the moment, Lifted PDDL supports the following PDDL extensions:

- Types (`:typing`).

- Existential preconditions (`:existential-preconditions`), i.e., `(exists ...)` constructions in action preconditions.

- Limited support for negative preconditions (`:negative-preconditions`), i.e., `(not ...)` constructions in action preconditions. However,
negative compound formulas are not supported, i.e., constructions like `(exists (not ...))` and `(not (and ...))`. At the moment, we only support
negated atoms in preconditions.

In the future, Lifted PDDL will be extended to support ADL and, maybe, other PDDL requirements. We also welcome contributions. The code is brief, simple to understand and has many comments, so I encourage you to implement any functionality you need and submit a pull request to the [Github](https://github.com/AI-Planning/lifted-pddl)! 😄

## Authors

Expand Down
Binary file modified src/lifted_pddl/__pycache__/parser.cpython-38.pyc
Binary file not shown.
51 changes: 51 additions & 0 deletions src/lifted_pddl/data/sokoban-problem.pddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
;; 0 1 2
;; 0 x
;; 1 x
;; 2 r x
;; 3

(define (problem sokoban-problem)

(:domain typed-sokoban)

(:objects
l0-0 l0-1 l0-2 l1-0 l1-1 l1-2 l2-0 l2-1 l2-2 l3-0 l3-1 l3-2 - loc
)

(:init
(connected-up l3-0 l2-0)
(connected-up l2-0 l1-0)
(connected-up l1-0 l0-0)

(connected-up l3-1 l2-1)
(connected-up l2-1 l1-1)
(connected-up l1-1 l0-1)

(connected-up l3-2 l2-2)
(connected-up l2-2 l1-2)
(connected-up l1-2 l0-2)

(connected-right l0-0 l0-1)
(connected-right l0-1 l0-2)

(connected-right l1-0 l1-1)
(connected-right l1-1 l1-2)

(connected-right l2-0 l2-1)
(connected-right l2-1 l2-2)

(connected-right l3-0 l3-1)
(connected-right l3-1 l3-2)


(at-robot l2-0)
(at-box l2-1)
(at-box l0-0)
(at-box l1-0)
)

(:goal (and
(not (at-robot l2-0))
(at-robot l1-0)
))
)
4 changes: 2 additions & 2 deletions src/lifted_pddl/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,12 @@ def _get_applicable_var_assigns_action(self, action, _var_assigns):
if ground_precond not in atoms:
new_var_assigns.append(var_assign)

full_var_assigns = new_var_assings
full_var_assigns = new_var_assigns

# If there are no var_assigns left, we know that no variable substitution
# satisfies all the preconditions
if len(full_var_assigns) == 0:
return list()
return tuple()


# <Existential preconditions>
Expand Down

0 comments on commit dc56b64

Please sign in to comment.