-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
Description
User Story
Narrative planning problems have a modified action format (e.g., :fail, ':agents') and keyword predicates such as believes and 'intends'.
Here is an example of an action:
(:action search-for
:parameters (?character - character ?thing - thing ?room - room)
:precondition
(and
(at ?character ?room)
(in ?thing ?room)
)
:effect
(and
(has ?character ?thing)
(not (in ?thing ?room))
(believes ?character (has ?character ?thing))
(believes ?character (not (in ?thing ?room)))
(not (believes ?character (not (has ?character ?thing))))
(not (believes ?character (in ?thing ?room)))
)
:fail
(when (and (not (in ?thing ?room)) (at ?character ?room))
(and
(not (believes ?character (in ?thing ?room)))
(believes ?character (not (in ?thing ?room)))
)
)
:agents (?character)
)
I have modified the PDDLGrammar to parse the :fail and :agents by changing action_def in PDDLGrammar:
agents = set_results_name(
Suppress("(")
- ZeroOrMore(
Group(
Located(Group(OneOrMore(variable)) + Optional(Suppress("-") + name))
)
)
+ Suppress(")"),
"agents",
)
action_def = Group(
Suppress("(")
+ ":action"
- set_results_name(name, "name")
+ ":parameters"
- Suppress("(")
+ parameters
+ Suppress(")")
+ Optional(":precondition" - set_results_name(nested_expr(), "pre"))
+ Optional(":effect" - set_results_name(nested_expr(), "eff"))
+ Optional(":observe" - set_results_name(nested_expr(), "obs"))
+ Optional(":fail" - set_results_name(nested_expr(), "fail"))
+ Optional(":agents" - agents)
+ Suppress(")")
)
Also modified the requirements:
require_def = (
Suppress("(")
+ ":requirements"
+ OneOrMore(
one_of(
":strips :typing :negative-preconditions :disjunctive-preconditions :equality :existential-preconditions :universal-preconditions :quantified-preconditions :conditional-effects :fluents :numeric-fluents :adl :durative-actions :duration-inequalities :timed-initial-literals :timed-initial-effects :action-costs :hierarchy :method-preconditions :constraints :contingent :preferences :expression-variables :intentionality :belief"
)
)
+ Suppress(")")
)
Now I am facing a problem when parsing the believes predicate since such predicate's args are (believes <agent> <fact>) (e.g., (not (believes ?character (not (has ?character ?thing))))).
Any advice on parsing this since I am getting the well-formed exception?