[comp.ai] CLIPS-help

snugroh@hubcap.clemson.edu (Anto) (10/05/90)

I need help.....
I am using CLIPS to build a small expert system.
I want to put confidence factor in my system and I want it run like
in MYCIN,i.e CF of AND connected statements is the max of the statement's CF 
and CF of OR connected statements is the min of the statement's CF.
Here I have a rule look like

IF
  1) A is 1 with CF1 and
  2) B is 2 with CF2 or
     C is 3 with CF3
THEN
  D is 4 with CF4

The IF confidence factor will be:
	CF(IF) = min (CF1, max (CF2,CF3))

In order to fire this rule, the IF confidence factor has to be more than
a certain threshold, 20 for example. 

I implemented it in CLIPS as follows:
 (defrule RULE001
	  (A 1 ?cf1)
	  (or (B 2 ?cf2)
	      (C 3 ?cf3))
	  (test (>= (min ?cf1 (max ?cf2 ?cf3)) 20))
	  =>
	  (assert (putfact D 4 CF4 =(min ?cf1 (max ?cf2 ?cf3)))))

and there are rules to calculate confidence factor given the fact as,
     (putfact <variable> <value> <cf-of-then> <cf-of-if>)

The problem is that RULE001 wouldn't be accepted by CLIPS because I used
different variable inside OR connective (?cf2 and ?cf3).
It said ?cf3 is undefined.
I know that I have to use same variable for ?cf2 and ?cf3, but then I couldn't
take the maximum of it.

One solution that will work, but I don't want to do it, is split up the rule
into several rules so that each rule doesn't have any OR connective.

If anybody have solution or suggestion how to handle this problem,
I greatly appreciate it.

Thanks for any response.
-anto-