I'm trying to obtain a % to have covid, based on number of sympthoms and number of contacts (strict contacts or not). I read about using a CLP module in SWI_prolog, this is what I did, but I'm not sure I'm using the fuzzy logic, probably just random math.
:- use_module(library(clpfd)).
sintomi_fuzzy(X,Y):-
( X in 0..0 -> Y is 0 ;
X in 1..2 -> Y is 0.45 ;
X >= 3 -> Y is 0.6 ).
strict_contacts(X,Y):-
( X in 0..0 -> Y is 0 ;
X in 1..2 -> Y is 0.5 ;
X >= 3 -> Y is 0.8 ).
no_strict_contacts(X,Y):-
( X in 0..0 -> Y is 0 ;
X in 1..2 -> Y is 0.3 ;
X >= 3 -> Y is 0.4 ).
find_prob(Patient,P):-
# S is the Y from sympthoms
# C is the Y from strict contacts
# C1 is the Y from contacts
sintomi_fuzzy(2,S),
strict_contacts(1,C),
no_strict_conctacts(0,C1),
(C1 > 0 -> P is (S + C + C1) / 3 ;
P is (S + C) / 2 ).
How can I implement fuzzy for obtaining P?