Class FluentExplicitizer
compiled fluents and compiled triggers to a compiled
problem to make it easier to check when trigger apply in a state.
When a state represents an
infinitely-nested theory of mind, it can sometimes be hard to detect when
to apply triggers. Let c be a character and
let x and y be two Boolean propositions. Imagine
this trigger:
Trigger t Precondition: x & !y Effect: yNow suppose this is the state:
x & y & believes(c, x) & believes(c, !y)The trigger does not apply in this state because its precondition is not satisfied; however it does apply in character
c's beliefs. The
state should immediately transition to:
x & y & believes(c, x) & believes(c, y)Detecting situations like this can be expansive, so this compiler offers one possible solution by creating a new trigger like this:
New Trigger t' Precondition: believes(c, x & !y) Effect: believes(c, y)This way, instead of checking triggers in every character's beliefs (and their beliefs about beliefs and so on), one set of triggers can be checked in the current state only.
This compiler starts by finding all compiled fluents
with one or more characters, for example,
believes(c, f=v) where c is some character,
f is some fluent, and v is some value. Then, for
any trigger that has an effect with f as its fluent, a new trigger is
added. If p is the original trigger's precondition and
e is the original trigger's effect, the new trigger's
precondition is believes(c, p) and the new trigger's effect is
believes(c, e).
Note that creating these new triggers may create new fluents, and these new fluents may require new triggers, and so on. This compiler handles those situations, except where they would create an infinite number of triggers and fluents, in which case this compiler will crash. The most common situation that causes this crash is when a trigger makes a belief true. For example, consider this trigger:
Trigger t Precondition: believes(a, x) & !x Effect: xThis compiler would create this new trigger:
Trigger t' Precondition: believes(a, believes(a, x)) & believes(a, !x) Effect: believes(a, x)and then it will create this new trigger:
Trigger t'' Precondition: believes(a, believes(a, believes(a, x))) & believes(a, believes(a, !x)) Effect: believes(a, believes(a, x))and so on, forever, until a crash. This compiled should not be used when a
problem contains a situation like this.- Author:
- Stephen G. Ware
-
Method Summary
Modifier and TypeMethodDescriptionstatic final CompiledProblemcompile(CompiledProblem problem, Worker.Status status) Adds newcompiled triggers(and possibly newcompiled fluents) to acompiled problemto make it easier to detect when triggers should apply in astatewith beliefs.
-
Method Details
-
compile
Adds newcompiled triggers(and possibly newcompiled fluents) to acompiled problemto make it easier to detect when triggers should apply in astatewith beliefs.- Parameters:
problem- the original compiled problemstatus- a status to update while the compiler runs- Returns:
- a new compiled problem identical to the original but possibly with additional triggers and fluents
-