An act that is not a primitive act is called a complex act. If
SNeRE is asked to perform a complex act, it will try to infer a
plan to carry out the act. A plan in the SNeRE formalism is
represented by any act node, but especially one whose action is a
control action. A node of the form M:{
plan, p
act, a
} , where
a is a complex act node, and p is a plan node, represents the
proposition that the plan represented by p is the way to perform
the complex act represented by a. Having inferred some plans for
carrying out a complex act, SNeRE will perform do-one on them.
To illustrate the use of complex acts, we will first define say as a one object action function, and associate action nodes with the functions say, and snsequence.
^^
--> (define-primaction say (object1)
"Print the object."
(format t "~&~A" (sneps:choose.ns object1)))
SAY
--> (attach-primaction
say say
snsequence snsequence)
T
--> ^^
CPU time : 0.05
Then, we will give a rule that says the way to greet a person is to
sayHi, then say the person's name (and assert that Stu and Bill
are people).
* (describe (assert forall $person
ant (build member *person class person)
cq (build act (build action greet object1 *person)
plan (build action snsequence
object1 sayHi
object2 (build action say
object1 *person)))))
(M1! (FORALL V1) (ANT (P1 (CLASS PERSON) (MEMBER V1)))
(CQ
(P5 (ACT (P2 (ACTION GREET) (OBJECT1 V1)))
(PLAN
(P4 (ACTION SNSEQUENCE) (OBJECT1 SAYHI)
(OBJECT2 (P3 (ACTION SAY) (OBJECT1 V1))))))))
(M1!)
CPU time : 0.18
* (describe (assert member (Stu Bill) class person))
(M2! (CLASS PERSON) (MEMBER BILL STU))
(M2!)
CPU time : 0.06
We will give three plans for sayHi.
* (describe (assert act sayHi
plan (build action say object1 "Hello")))
(M4! (ACT SAYHI) (PLAN (M3 (ACTION SAY) (OBJECT1 Hello))))
(M4!)
CPU time : 0.09
* (describe (assert act sayHi
plan (build action say object1 "Hi")))
(M6! (ACT SAYHI) (PLAN (M5 (ACTION SAY) (OBJECT1 Hi))))
(M6!)
CPU time : 0.06
* (describe (assert act sayHi
plan (build action say object1 "Hiya")))
(M8! (ACT SAYHI) (PLAN (M7 (ACTION SAY) (OBJECT1 Hiya))))
(M8!)
CPU time : 0.09
and finally, greet Stu and Bill.
* (perform (build action greet object1 Stu)) Hiya STU CPU time : 1.34 * (perform (build action greet object1 Bill)) Hello BILL CPU time : 1.37A complex act node may be represented by a node with no action arc emanating from it, as long as a plan can be derived for it.
* (describe (assert act ask
plan (build action say object1 "Who's there?")))
(M7! (ACT ASK) (PLAN (M6 (ACTION SAY) (OBJECT1 Who's there?))))
(M7!)
CPU time : 0.05
* (perform ask)
Who's there?
CPU time : 0.33