Here is a scenario regarding backward-chaining that I don't understand.
Perhaps someone can explain the results. Essentially, I don't 
understand why several rules activated in backward-chaining are deactivated
if only one fires. The sample below illustrates my mis-understanding.

Please help me understand what I need to do to get all rules activated
during backward chaining to fire.

-Mark

;; -------------------------- cut here ----------------------

;;I have some deftemplate like the following:
;;
(deftemplate edge
        (slot name)
        (slot valueA)
        (slot valueB)
)

;; I establish that I want to backward-chain over edge templates.
(do-backward-chaining edge)

;; I have some rule which requires the use of edge templates.
(defrule Use-edge
        (edge (name ?name) (valueA ?A) (valueB ?B))
=>
        (printout t "we now have an edge named " ?name crlf)
)

;; And a rule to create edge templates from the need for edge. Note this
rule
;; requires people facts.
(defrule need-edge
        (need-edge)
        (people ?name)
=>
        (assert (edge (name ?name) (valueA 0) (valueB 1)))
)

;; reset to seed the backward-chaining
(reset)

;;and then add some facts about people.
(assert (people mark))
(assert (people chris))
(assert (people jeff))


;; -------------------------- cut here ----------------------

;; When I run load this I see my people facts, and the need-edge fact.
Jess> (facts)
f-0   (initial-fact)
f-1   (need-edge (name nil) (valueA nil) (valueB nil))
f-2   (people mark)
f-3   (people chris)
f-4   (people jeff)
For a total of 5 facts.


;; I also see activations of need-edge as I suspect. 
;; And what I want is for all three rules to fire. But, they don't.
Jess> (agenda)
[Activation: need-edge  f-1,, f-4 ; time=9 ; salience=0] 
[Activation: need-edge  f-1,, f-3 ; time=8 ; salience=0] 
[Activation: need-edge  f-1,, f-2 ; time=7 ; salience=0] 
For a total of 3 activations. 


;; When I run, only one need-edge rule fires, and the others are
deactivated. 
;; WHY? shouldn't they all fire. 
Jess> (run)
we now have an edge named jeff
2 


;; I want to end up with an edge fact for all 3 people. But, I only get the
one for Jeff.
Jess> (facts)
f-0   (initial-fact)
f-1   (need-edge (name nil) (valueA nil) (valueB nil))
f-2   (people mark)
f-3   (people chris)
f-4   (people jeff)
f-5   (edge (name jeff) (valueA 0) (valueB 1))
For a total of 6 facts.
Jess> 

I want facts like this, but am not getting them:

f-5   (edge (name jeff) (valueA 0) (valueB 1))
f-6   (edge (name mark) (valueA 0) (valueB 1))
f-7   (edge (name chris) (valueA 0) (valueB 1))








---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to