next up previous contents index
Next: Primitive Acts Up: SNeRE: The SNePS Rational Previous: SNeRE: The SNePS Rational

Acting

  SNeRE, The SNePS Rational Engine, is a package that allows for the smooth incorporation of acting into SNePS-based agents. SNeRE recognizes a node with an action arc to be a special kind of node called an act node. Since an act usually consists of an action and one or more objects of the action, an act node usually has additional arcs pointing to the nodes that represent the objects of the action. These additional arcs are generally labelled object1 ...objectn, where n is the number of objects the action is performed on. The relations object1 and object2 are pre-defined. If more objecti are needed, the user must define them.

There are three ways to initiate acting. The first is by use of the SNePSUL command perform.

(perform actnode context-specifier) 
Causes the actnode to be performed. Deductions and assertions triggered during the performance will be made in the specified context.

* (perform (build action say object1 "Hello" object2 "there"))
Hello there
 CPU time : 0.15
(How the say action is defined will be explained below.) The other two ways to initiate action are during inference:
  1. If a node of the form M:{tex2html_wrap_inline4595whenever, ptex2html_wrap_inline4597do, atex2html_wrap_inline4599}  or of the form M:{tex2html_wrap_inline4595when, ptex2html_wrap_inline4597do, atex2html_wrap_inline4599} , where p is a proposition node and a is an act node, is in the network, and forward inference causes both M and p to be asserted, then a is performed.
    * (describe
         (assert whenever (build agent Stu state is location here)
                       do (build action say object1 "Hello" object2 "Stu.")))
    (M3! (DO (M2 (ACTION SAY) (OBJECT1 Hello) (OBJECT2 Stu)))
     (WHENEVER (M1 (AGENT STU) (LOCATION HERE) (STATE IS))))
    (M3!)
     CPU time : 0.04 
    
    * (describe
         (assert when (build agent Stu state is location here)
                   do (build action say object1 "I see" object2 "you're here.")))
    (M5! (DO (M3 (ACTION SAY) (OBJECT1 Hello) (OBJECT2 Stu)))
     (WHEN (M2 (AGENT STU) (LOCATION HERE) (STATE IS))))
    (M5!)
     CPU time : 0.03 
    
    * (add agent Stu state is location here)
    Hello Stu
    I see you're here
     CPU time : 0.06
    The difference between when and whenever is that if the proposition p is disbelieved (see below) and readded, the act controlled by whenever will be performed again, but the act controlled by when won't.
    * (perform (build action disbelieve
                      object1 (build agent Stu state is location here)))
     CPU time : 0.18 
    
    * (add agent Stu state is location here)
    Hello Stu
     CPU time : 0.02
  2. If an asserted node of the form M!:{tex2html_wrap_inline4595if, ptex2html_wrap_inline4597do, atex2html_wrap_inline4599} , where p is a proposition node and a is an act node, is in the network, and SNIP back-chains into p, then a will be performed.
    * (describe (assert if (build agent who state is location here)
                        do (build action say object1 "Who's" object2 "here?")))
    (M7! (DO (M6 (ACTION SAY) (OBJECT1 Who's) (OBJECT2 here?)))
     (IF (M5 (AGENT WHO) (LOCATION HERE) (STATE IS))))
    (M7!)
     CPU time : 0.19 
    
    * (deduce agent who state is location here)
    Who's here?
     CPU time : 0.12

next up previous contents index
Next: Primitive Acts Up: SNeRE: The SNePS Rational Previous: SNeRE: The SNePS Rational

John Francis Santore
Fri May 14 11:18:57 EDT 1999