I want to compute the "paths through edges" using the following code:
<code>
(deftemplate edge (slot first) (slot second))
(deftemplate path(slot first) (slot second))
(defrule pathRule
(or (edge (first ?first) (second ?second))
(and (edge (first ?first) (second ?mid))
(path (first ?mid) (second ?second))
)
)
=>
(assert (path (first ?first) (second ?second)))
)
(reset)
(load-facts "test_data.clp")
(bind ?tmx (call java.lang.management.ManagementFactory getThreadMXBean))
(deffunction cputime () (return (* (?tmx getCurrentThreadCpuTime) 1E-9)))
(bind ?starttime_wall (time))
(bind ?starttime_cpu (cputime))
(run)
(bind ?endtime_cpu (cputime))
(bind ?endtime_wall (time))
(bind ?walltime (- ?endtime_wall ?starttime_wall))
(bind ?cputime (- ?endtime_cpu ?starttime_cpu))
(printout t "Cpu time = " ?cputime crlf)
(printout t "Wall time= " ?walltime crlf crlf)
</code>
My question: is there a way to compute "path(a, X)?" efficiently?
I am not sure how should I write the rules to make use of bound
variable. Any help is appreciated.
Thanks,
Senlin
--------------------------------------------------------------------
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]
--------------------------------------------------------------------