Skip to content

Commit

Permalink
Implemented and tested existential preconditions support.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAeryan committed Nov 15, 2022
1 parent 4fdbc69 commit 151bc8e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 498 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = fh.read()

setuptools.setup(name='lifted-pddl',
version='1.0.4',
version='1.1.0',
description='A lightweight framework for parsing PDDL in lifted form.',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion src/lifted_pddl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# __init__.py

__version__ = "1.0.4"
__version__ = "1.1.0"

from lifted_pddl.parser import Parser
Binary file modified src/lifted_pddl/__pycache__/parser.cpython-38.pyc
Binary file not shown.
12 changes: 7 additions & 5 deletions src/lifted_pddl/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ def get_next_state(self, action_name, var_assign, check_action_applicability=Tru
return new_atoms

# Perform the variable substitutions for the action_effects (i.e., ground the variables) according to @var_assign
_, action_params, action_preconds, action_effects = action
_, action_var_info, action_preconds, action_effects = action
action_vars, vars_class = action_var_info

ground_action_effects = []
for effect in action_effects:
Expand All @@ -467,11 +468,12 @@ def get_next_state(self, action_name, var_assign, check_action_applicability=Tru
# Del effects (effect[0]==False) -> delete the corresponding atom
# Note: we assume that no effects are in both the add and delete list
for effect in ground_action_effects:
if effect[0]: # Add effect
new_atoms.add( (effect[1], effect[2]) )
else: # Delete effect
effect_atom = (effect[1], effect[2])
effect_atom = (effect[1], effect[2])

if effect[0]: # Add effect
if effect_atom not in new_atoms: # If the corresponding atom does already exist in the state atoms, we do nothing
new_atoms.add(effect_atom)
else: # Delete effect
if effect_atom in new_atoms: # If the corresponding atom does not exist in the state atoms, we do nothing
new_atoms.remove(effect_atom)

Expand Down
Loading

0 comments on commit 151bc8e

Please sign in to comment.