Fuzzy Prolog
Susana Mu˜ noz-Hern´ andez Facultad de Inform´ atica Universidad Polit´ ecnica de Madrid 28660 Madrid, Spain susana@fi.upm.es
Fuzzy Prolog – p. 1
Fuzzy Prolog Susana Mu noz-Hern andez Facultad de Inform atica - - PowerPoint PPT Presentation
Fuzzy Prolog Susana Mu noz-Hern andez Facultad de Inform atica Universidad Polit ecnica de Madrid 28660 Madrid, Spain susana@fi.upm.es Fuzzy Prolog p. 1 Overview Basics Introduction Description Implementation
Susana Mu˜ noz-Hern´ andez Facultad de Inform´ atica Universidad Polit´ ecnica de Madrid 28660 Madrid, Spain susana@fi.upm.es
Fuzzy Prolog – p. 1
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 2
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 3
Fuzzy Prolog – p. 4
Fuzzy Prolog – p. 5
Fuzzy Prolog – p. 6
Fuzzy Prolog – p. 7
1 2 3 4 5 6 1 probability 1 / 6
Fuzzy Prolog – p. 8
Fuzzy Prolog – p. 9
small 1 1 2 3 4 5 6
Fuzzy Prolog – p. 10
Fuzzy Prolog – p. 11
1 Age Youth 20 60 40· CRISP
Fuzzy Prolog – p. 12
1 Age Youth 20 60 40· CRISP 1 Age Youth 20 40 60
FUZZY
Fuzzy Prolog – p. 12
1 Age Youth 20 60 40· CRISP 1 Age Youth 20 40 60
FUZZY 1 Age Youth 20 40 60 INTERVAL VALUED FUZZY
Fuzzy Prolog – p. 12
1 Age Youth 20 60 40· CRISP 1 Age Youth 20 40 60
FUZZY 1 Age Youth 20 40 60 INTERVAL VALUED FUZZY 1 Age Youth 20 40 60 INTERVAL UNION VALUED FUZZY
Fuzzy Prolog – p. 12
Fuzzy Prolog – p. 13
Fuzzy Prolog – p. 14
1 Speed Model VZX VZY
Fuzzy Prolog – p. 15
1 Speed Model VZX VZY
Fuzzy Prolog – p. 15
Fuzzy Prolog – p. 16
Fuzzy Prolog – p. 17
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 18
Fuzzy Prolog – p. 19
Fuzzy Prolog – p. 20
1, xu 1], ..., [xl n, xu n]) = [f(xl 1, ..., xl n), f(xu 1, ..., xu n)]
Fuzzy Prolog – p. 20
Fuzzy Prolog – p. 21
Fuzzy Prolog – p. 22
Fuzzy Prolog – p. 23
1 ∪ · · · ∪ I′ M in
j ∈ U ′ . x ∈ I′ j where j ∈ 1..M.
Fuzzy Prolog – p. 24
Fuzzy Prolog – p. 25
Fuzzy Prolog – p. 26
Fuzzy Prolog – p. 27
Fuzzy Prolog – p. 28
Fuzzy Prolog – p. 29
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 30
Fuzzy Prolog – p. 31
Fuzzy Prolog – p. 32
✻ ✲ ❈ ❈ ❈ ❈ ❈ ❈ 1
10 30 50
Fuzzy Prolog – p. 33
Fuzzy Prolog – p. 34
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 35
student(john). student(peter).
age_about_15(susan,0.7):˜. age_about_15(nick,0):˜.
student(X), % CRISP age_about_15(X,Va).% FUZZY ?- student(john). yes ?- student(nick). no FALSE ?- age_about_15(john,V). V = 1 ?- age_about_15(nick,V). V = 0 ?- age_about_15(peter,V). no UNKNOWN ?- teenager_student(john,V). V .=. 1 ?- teenager_student(susan,V). V .=. 0 ?- teenager_student(peter,V). no UNKNOWN
Fuzzy Prolog – p. 36
student(john). student(peter). :-default(f_student/2,0). f_student(X,1):- student(X).
age_about_15(john,1):˜. age_about_15(susan,0.7):˜. age_about_15(nick,0):˜.
teenager_student(X,V):˜ f_student(X,Vs), age_about_15(X,Va). ?- f_student(john,V). V = 1 ?- f_student(nick,V). V = 0 FALSE ?- age_about_15(john,V). V = 1 ?- age_about_15(nick,V). V = 0 ?- age_about_15(peter,V). V .>=. 0, V .<=. 1 UNKNOWN ?- teenager_student(john,V). V .=. 1 ?- teenager_student(susan,V). V .=. 0 ?- teenager_student(peter,V). V .>=. 0, V .<=. 1 UNKNOWN
Fuzzy Prolog – p. 37
Fuzzy Prolog – p. 38
Fuzzy Prolog – p. 39
Fuzzy Prolog – p. 40
Fuzzy Prolog – p. 40
Hour Day M T W T F 8 9 10 11 12 13 14 15 16 17 18 Hour Day M T W T F 8 9 10 11 12 13 14 15 16 17 18 Hour Day M T W T F 8 9 10 11 12 13 14 15 16 17 18
Shift T1 Shift T2
Fuzzy Prolog – p. 41
compatible(T1,T2,V):˜ min correct_shift(T1), correct_shift(T2), disjoint(T1,T2), append(T1,T2,T), number_of_days(T,D), few_days(D,Vf), number_of_free_hours(T,H), without_gaps(H,Vw).
1 1 2 3 4 5 few_days days
1 1 2 3 4 5 6 7 8 hours without_gaps
Fuzzy Prolog – p. 42
f_correct_shift(T,1):- correct_shift(T). :- default(f_correct_shift/2,[0,0]). % CWA f_disjoint(T1,T2,1):- disjoint(T1,T2). :- default(f_disjoint/3,[0,0]). % CWA few_days(D,V):- ... :- default(few_days/2,[0.25,0.75]). % DEFAULT without_gaps(H,V):- ... :- default(without_gaps/2,[0,1]). % OWA
Fuzzy Prolog – p. 43
Day M T W T F 8 9 10 11 12 13 14 15 16 17 18 Hour
Fuzzy Prolog – p. 44
Fuzzy Prolog – p. 45
Fuzzy Prolog – p. 46
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 47
student(john). student(peter).
yes ?- student(rick). no
X = john ? ; X = peter ? ; no
no ?- +\ student(rick). yes
no
Fuzzy Prolog – p. 48
student(john). student(peter).
yes ?- student(rick). no
X = john ? ; X = peter ? ; no
no ?- +\ student(rick). yes
X = rick ?; X = anne ?; X = rose ?; ...
Fuzzy Prolog – p. 49
student(john). student(peter).
yes ?- student(rick). no
X = john ? ; X = peter ? ; no
no ?- +\ student(rick). yes
X =/= john, X =/= peter ?; no
Fuzzy Prolog – p. 50
Fuzzy Prolog – p. 51
student(john). student(peter).
student(X),!, V .=. 1. f1_student(X,0).
student(X), V .=. 1. f2_student(X,V):- neg(student(X)), V .=. 0. ?- f1_student(X,1). X = john ? ; X = peter ? ; no
no
X =/= john, X =/= peter ? ; no
Fuzzy Prolog – p. 52
Day M T W T F 8 9 10 11 12 13 14 15 16 17 18 Hour
Fuzzy Prolog – p. 53
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 54
0.2 1 0.8 0.9 0.7 0.6 0.5 0.4 0.3 0.1 x x 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Discrete Borel Algebra Borel Algebra
A discrete-interval [X1, XN]d is a set of a finite number of values, {X1, X2, ..., XN−1, XN}, between X1 and XN, 0 ≤ X1 ≤ XN ≤ 1, such that ∃ 0 < ǫ < 1. Xi = Xi−1 + ǫ, i ∈ {2..N}.
Fuzzy Prolog – p. 55
Fuzzy Prolog – p. 56
Fuzzy Prolog – p. 57
Fuzzy Prolog – p. 58
Fuzzy Prolog – p. 59
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 60
Fuzzy Prolog – p. 61
Fuzzy Prolog – p. 62
1 CANDIDATES V= ? GOAL 0.55 0.15 0.32 0.89 0.31 ... 0.1 + V < W 0.5 > V W < V X > W + X CONSTRAINTS − AGENTS
Fuzzy Prolog – p. 63
1 CANDIDATES V= ? GOAL 0.55 0.15 0.32 0.89 0.31 ... 0.1 + V < W 0.5 > V W < V X > W + X CONSTRAINTS − AGENTS C1 C3 C2
Fuzzy Prolog – p. 64
1 CANDIDATES V= ? GOAL 0.55 0.15 0.32 0.89 0.31 ... 0.1 + V < W 0.5 > V W < V X > W + X CONSTRAINTS − AGENTS C1 C3 C2
Fuzzy Prolog – p. 65
Fuzzy Prolog – p. 66
Fuzzy Prolog – p. 67
Fuzzy Prolog – p. 68
Fuzzy Prolog – p. 69
− physical aspects (V p) − psychical aspects (V s) − evidences (V e)
database Portrait
Vp Vs
Psicologist Police
Ve
Fuzzy Prolog – p. 70
suspect(Person, V) ::∼ inter m allocate vars([Vp, Vs, Ve]), physically suspect(Person, Vp, Vs), psychically suspect(Person, Vs, Vp), evidences(Person, Ve, Vp, Vs).
suspect(Person, V) :- allocate vars([Vp, Vs, Ve]), V in 0..10, physically suspect(Person, Vp, Vs), psychically suspect(Person, Vs, Vp), evidences(Person, Ve, Vp, Vs), inter m([Vp, Vs, Ve], V).
Fuzzy Prolog – p. 71
Cp: physically_suspect(Person, Vp, Vs) :- scan_portrait_database(Person, Vp), Vp * Vs .>=. 50 @ a1. Cs: psychically_suspect(Person, Vs, Vp) :- psicologist_diagnostic(Person, Vs), Vs .<. Vp @ a2. Ce: evidences(Person, Ve, Vp, Vs) :- police_database(Person, Ve), (Ve .>=. Vp, Ve .>=. Vs) @ a3. scan_portrait_database(peter, Vp) :- Vp in 4..10. psicologist_diagnostic(peter, Vs) :- Vs in 3..10. police_database(peter, Ve) :- Ve in 7..10.
Fuzzy Prolog – p. 72
Cp Ce Cp Cp Cs CpCe CsCp CpCeCs CpCeCs CpCeCs CsCpCe CpCeCs CpCe CsCpCe CpCe 5..9 Vs in a1 a1 a1 a1 a2 a2 a2 a2 a2 a3 a3 a3 a3 a3 Vs Vp Vs Vp Vs Ve Ve Ve Vp Vs Vp=10 Ve Ve=10 T4 T5 T2 T1 T3 a1 Vp ack CsCpCe
ack CpCe
ack CsCpCe
Fuzzy Prolog – p. 73
Cp Ce Cp Vp Vs Vp Vs Vp Vs Ve Ve Ve Cs Cp Cp Vp Vs Ve a1 a1 a1 a1 a2 a2 a2 a2 a3 a3 a3 a3 T1 T2 T3 T4
nogood nogood
Fuzzy Prolog – p. 74
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 75
Fuzzy Prolog – p. 76
Fuzzy Prolog – p. 77
Fuzzy Prolog – p. 78
Fuzzy Prolog – p. 79
Fuzzy Prolog – p. 80
Fuzzy Prolog – p. 81
Fuzzy Prolog – p. 82
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 83
− Modeling a Problem with Fuzzy/RFuzzy Prolog − Semantics for Fuzzy queries language − ...
− Implementation of credibility with intervalsl − Fuzzy web interface − New Fuzzy Prolog version with credibility − Comparison with other Fuzzy Prolog (tool & semantics) − Credibility with intervals − ...
Fuzzy Prolog – p. 84
− Source files of the report (better .tex, otherwise .doc) − Report with tests, explanations, etc. (.pdf) − Source files of the developed code (.pl) − Examples files (.pl)
Fuzzy Prolog – p. 85
− Introduction − Description − Implementation
− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy
Fuzzy Prolog – p. 86
Susana Mu˜ noz-Hern´ andez Facultad de Inform´ atica Universidad Polit´ ecnica de Madrid 28660 Madrid, Spain susana@fi.upm.es
Fuzzy Prolog – p. 87