Hi im using FuzzyClips v6.10.d, i was reading about using modifiers for fuzzy variables and tried it:
(deftemplate temperature
0.0 1.0 ;
(
(cold (z 0.1 0.2))
(warm(PI 0.3 0.6))
(hot (s 0.7 0.9))
(hyperhot very hot)
)
)
(deftemplate temp-day
(slot day (type SYMBOL) (allowed-symbols Monday Thursday Friday Sunday))
(slot day-temp (type FUZZY-VALUE temperature))
)
(deffacts fuzzyfacts
(temp-day (day Sunday) (day-temp warm))
(temp-day (day Monday) (day-temp cold))
(temp-day (day Thursday) (day-temp hot))
(temp-day (day Friday) (day-temp hyperhot))
)
(defrule select
(temp-day (day ?x) (day-temp hyperhot))
=>
(assert(was-so-hyper-hot ?x))
)
I just expected to get only the days where the weather was hyperhot (Friday), but instead i got:
So the question: why if i am filtering by hyperhot temperature, Clips is giving me another days with different temperatures? I know the CF is different between them (1.00, 0.88 and 0.12) but i expected Clips to not even consider facts with temperature different from hyperhot. Am i missunderstanding how to filter variables using modifiers? Thanks!
You're misunderstanding how fuzzy values work. They're fuzzy, so when you say something is very hot it may be that it's just hot or warm (as the facts indicate in your example). If you changed the range that indicates warm so that it is further away from hot, you'll see that the (was-so-hyper-hot Sunday) fact is no longer asserted.
(deftemplate temperature
0.0 1.0 ;
(
(cold (z 0.1 0.2))
(warm(PI 0.3 0.4))
(hot (s 0.7 0.9))
(hyperhot very hot)
)
)
If you want your rules to match exact values, then you shouldn't be using fuzzy values.