aig-upf / tarski

Tarski - An AI Planning Modeling Framework
Apache License 2.0
59 stars 20 forks source link

Parsing blocksworld fails with DuplicatePredicateDefinition #30

Closed emilkeyder closed 5 years ago

emilkeyder commented 5 years ago

This can be replicated with:

r = tarski.io.FstripsReader() r.read_problem('blocks/domain.pddl', 'blocks/probBLOCKS-10-0.pddl')

Resulting in:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/fstrips.py", line 27, in read_problem self.parse_domain(domain) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/fstrips.py", line 37, in parse_domain self.parse_file(filename, 'domain') File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/fstrips.py", line 34, in parse_file self.parser.visit(domain_parse_tree) File "/usr/local/lib/python3.7/site-packages/antlr4_python3_runtime-4.7.1-py3.7.egg/antlr4/tree/Tree.py", line 34, in visit return tree.accept(self) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/_fstrips/parser/parser.py", line 790, in accept return visitor.visitDomain(self) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/_fstrips/parser/visitor.py", line 19, in visitDomain return self.visitChildren(ctx) File "/usr/local/lib/python3.7/site-packages/antlr4_python3_runtime-4.7.1-py3.7.egg/antlr4/tree/Tree.py", line 44, in visitChildren childResult = c.accept(self) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/_fstrips/parser/parser.py", line 2191, in accept return visitor.visitPredicate_definition_block(self) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/_fstrips/parser/visitor.py", line 134, in visitPredicate_definition_block return self.visitChildren(ctx) File "/usr/local/lib/python3.7/site-packages/antlr4_python3_runtime-4.7.1-py3.7.egg/antlr4/tree/Tree.py", line 44, in visitChildren childResult = c.accept(self) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/_fstrips/parser/parser.py", line 2256, in accept return visitor.visitSingle_predicate_definition(self) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/io/_fstrips/reader.py", line 108, in visitSingle_predicate_definition return self.language.predicate(predicate, *argument_types) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/fol.py", line 234, in predicate self._check_name_not_defined(name, self._predicates, err.DuplicatePredicateDefinition) File "/usr/local/lib/python3.7/site-packages/tarski-0.1.0-py3.7.egg/tarski/fol.py", line 229, in _check_name_not_defined raise exception(name, where[name]) tarski.errors.DuplicatePredicateDefinition: Duplicate definition of element "on": "on/2"

miquelramirez commented 5 years ago

Hello @emilkeyder,

I am using the branch hybrid (which will be soon master), and this problem is not happening for me with Python 3.5. Seeing that the version of the Python package is 0.1.0 I reckon you must be using another branch. If you're using the hybrid branch, you should be at 0.2.0.

In any case, your report allowed me to find another bug which would annoy you later on, involving the (total-cost) function/object fluent, which is fixed in this commit.

I am closing this issue for now, let me know if the issue persists and I will be happy to reopen it.