Fuzzy Prolog Susana Mu noz-Hern andez Facultad de Inform atica - - PowerPoint PPT Presentation

fuzzy prolog
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 2

slide-3
SLIDE 3

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 3

slide-4
SLIDE 4

Modeling Real World

  • Knowledge:

− Uncertainty − Probability − Fuzziness − Incompleteness − Distributed knowledge

  • Reasoning:

− Logic

Fuzzy Prolog – p. 4

slide-5
SLIDE 5

Uncertainty-Probability-Fuzziness

?

  • If we through the cube... which value will

appear at the top?

Fuzzy Prolog – p. 5

slide-6
SLIDE 6

Uncertainty

?

X = 1 ∨ X = 2 ∨ X = 3 ∨ X = 4 ∨ X = 5 ∨ X = 6

Fuzzy Prolog – p. 6

slide-7
SLIDE 7

Uncertainty-Probability-Fuzziness

3?

  • If we through the cube... is it probable to
  • btain 3 at the top?

Fuzzy Prolog – p. 7

slide-8
SLIDE 8

Probability

3?

1 2 3 4 5 6 1 probability 1 / 6

Pr(X = 3) = 1/6 = 0.16

Fuzzy Prolog – p. 8

slide-9
SLIDE 9

Uncertainty-Probability-Fuzziness

  • If we obtain 3 at the top... is it a small value?

Fuzzy Prolog – p. 9

slide-10
SLIDE 10

Fuzziness

small 1 1 2 3 4 5 6

small(X = 3) = 0.6 Value 3 is slightly small

Fuzzy Prolog – p. 10

slide-11
SLIDE 11

Fuzziness level: Example

Let’s define the concept of youth

Fuzzy Prolog – p. 11

slide-12
SLIDE 12

Fuzziness level

1 Age Youth 20 60 40· CRISP

Fuzzy Prolog – p. 12

slide-13
SLIDE 13

Fuzziness level

1 Age Youth 20 60 40· CRISP 1 Age Youth 20 40 60

·

FUZZY

Fuzzy Prolog – p. 12

slide-14
SLIDE 14

Fuzziness level

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

slide-15
SLIDE 15

Fuzziness level

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

slide-16
SLIDE 16

Truth value (Fuzziness level)

The value of youth of a 42 years-old man

  • V = 0
  • V = 0.5
  • V ∈ [0.2, 0.6]
  • V ∈ [0.2, 0.5] [0.8, 1]

Fuzzy Prolog – p. 13

slide-17
SLIDE 17

Truth value (Fuzziness level)

The value of youth of a 42 years-old man

  • V = 0

(V = 0)

  • V = 0.5

(V = 0.5)

  • V ∈ [0.2, 0.6]

(0.2 ≤ V ∧ V ≤ 0.6)

  • V ∈ [0.2, 0.5] [0.8, 1]

(0.2 ≤ V ∧ V ≤ 0.5) ∨ (0.8 ≤ V ∧ V ≤ 1)

Fuzzy Prolog – p. 14

slide-18
SLIDE 18

Fuzziness - Uncertainty

  • New Laptop is a branch of computers with two laptop

models (VZX and VZY). One model is very slow and the other one is very fast.

1 Speed Model VZX VZY

− VZX speed [0.02, 0.08] − VZY speed [0.75, 0.90]

Fuzzy Prolog – p. 15

slide-19
SLIDE 19

Fuzziness - Uncertainty

  • New Laptop is a branch of computers with two laptop

models (VZX and VZY). One model is very slow and the other one is very fast.

1 Speed Model VZX VZY

− VZX speed [0.02, 0.08] − VZY speed [0.75, 0.90]

  • If a client buys a New Laptop computer, the truth value,

V , of its speed will be [0.02, 0.08] [0.75, 0.90] (0.02 ≤ V ∧ V ≤ 0.08) ∨ (0.75 ≤ V ∧ V ≤ 0.90)

Fuzzy Prolog – p. 15

slide-20
SLIDE 20

Modeling Real World

  • Knowledge:

Constraints ←              Uncertainty Probability Fuzziness Incompleteness Distributed knowledge

  • Reasoning:

Prolog ← Logic

Fuzzy Prolog – p. 16

slide-21
SLIDE 21

Fuzzy Prolog

  • Existing Fuzzy Prolog systems:
  • Prolog-Elf
  • Fril Prolog
  • f-Prolog
  • Our Fuzzy Prolog approach:
  • Truth Value (union of sub-intervals) B([0, 1])
  • Aggregation operators (min, max, luka, ...)
  • CLP(R) based implementation

Fuzzy Prolog – p. 17

slide-22
SLIDE 22

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 18

slide-23
SLIDE 23

Syntax

  • If A is an atom, A ← v is a fuzzy fact, where v, a truth

value, is an element in B([0, 1]) expressed as constraints over the domain [0, 1].

  • Let A, B1, . . . , Bn be atoms. A fuzzy clause is a clause
  • f the form A v ←F B1 v1, . . . , Bn vn where F is an

aggregation operator of truth values represented as constraints over the domain [0, 1]. The interval-aggregation induces a union-aggregation.

  • A fuzzy query is a tuple v ← A ? where A is an atom,

and v is a variable (possibly instantiated) that represents a truth value in B([0, 1]).

Fuzzy Prolog – p. 19

slide-24
SLIDE 24

Aggregation Operators

  • A function f : [0, 1]n → [0, 1] that verifies f(0, . . . , 0) = 0,

f(1, . . . , 1) = 1, and in addition it is monotonic and continuous, then it is called aggregation operator

Fuzzy Prolog – p. 20

slide-25
SLIDE 25

Aggregation Operators

  • A function f : [0, 1]n → [0, 1] that verifies f(0, . . . , 0) = 0,

f(1, . . . , 1) = 1, and in addition it is monotonic and continuous, then it is called aggregation operator

  • Given an aggregation f : [0, 1]n → [0, 1] an

interval-aggregation F : E([0, 1])n → E([0, 1]) is defined as follows: F([xl

1, xu 1], ..., [xl n, xu n]) = [f(xl 1, ..., xl n), f(xu 1, ..., xu n)]

Fuzzy Prolog – p. 20

slide-26
SLIDE 26

Union Aggregation

  • Given an interval-aggregation F : E([0, 1])n → E([0, 1])

defined over intervals, a union-aggregation F : B([0, 1])n → B([0, 1]) is defined over union of intervals as follows: F(B1, . . . , Bn) = ∪{F(E1, ..., En) | Ei ∈ Bi}

Fuzzy Prolog – p. 21

slide-27
SLIDE 27

Interpretation

An interpretation I consists of the following:

  • 1. a subset BI of the Herbrand Base,
  • 2. a mapping VI, to assign a truth value, in B([0, 1]), to

each element of BI. The Borel Algebra B([0, 1]) is a complete lattice under ⊆BI, that denotes Borel inclusion, and the Herbrand Base is a complete lattice under ⊆, that denotes set inclusion, therefore a set of all interpretations forms a complete lattice under the relation ⊑ defined as follows.

Fuzzy Prolog – p. 22

slide-28
SLIDE 28

Interval Inclusion

Def:[interval inclusion ⊆II] Given two intervals I1 = [a, b], I2 = [c, d] in E([0, 1]), I1 ⊆II I2 iff c ≤ a and b ≤ d.

I I2

1 d c a b

Fuzzy Prolog – p. 23

slide-29
SLIDE 29

Borel Inclusion

Def:[Borel inclusion ⊆BI] Given two unions of intervals U = I1 ∪ · · · ∪ IN, U ′ = I′

1 ∪ · · · ∪ I′ M in

B([0, 1]), U ⊆BI U ′ if and only if ∀x ∈ Ii, i ∈ 1..N, ∃I′

j ∈ U ′ . x ∈ I′ j where j ∈ 1..M.

U U’ I I I I’

1 1 2 3

I’

2

I’

3

Fuzzy Prolog – p. 24

slide-30
SLIDE 30

Interpretation Inclusion - Valuation

Def:[interpretation inclusion ⊑] I ⊑ I′ iff BI ⊆ BI′ and for all B ∈ BI, VI(B) ⊆BI VI′(B), where I = BI, VI, I′ = BI′, VI′ are interpretations. Def:[valuation] A valuation σ of an atom A is an assignment of elements of U to variables of A. So σ(A) ∈ B is a ground atom.

Fuzzy Prolog – p. 25

slide-31
SLIDE 31

Model

Def: [model] Given an interpretation I = BI, VI

  • I is a model for a fuzzy fact A ← v, if for all valuation σ,

σ(A) ∈ BI and v ⊆BI VI(σ(A)).

  • I is a model for a clause A ←F B1, . . . , Bn when the

following holds: for all valuation σ, if σ(Bi) ∈ BI, 1 ≤ i ≤ n, and v = F(VI(σ(B1)), . . . , VI(σ(Bn))) then σ(A) ∈ BI and v ⊆BI VI(σ(A)), where F is the union aggregation

  • btained from F.
  • I is a model of a fuzzy program, if it is a model for the

facts and clauses of the program.

Fuzzy Prolog – p. 26

slide-32
SLIDE 32

Semantics Equivalence

Given a program P, the three semantics:

  • 1. Least model lm(P), under the ⊑ ordering.
  • 2. Declarative meaning lfp(TP), least fixpoint for

a consequence operator TP(I).

  • 3. Success set SS(P) of a transitional system.

are equivalent: SS(P) = lfp(TP) = lm(P).

Fuzzy Prolog – p. 27

slide-33
SLIDE 33

Operational Semantics

  • A sequence of transitions between different

states of a system

  • State: Goal, V aluation, Constraint
  • Initial State: A, ∅, true
  • Final State: ∅, σ, S

Examples:

p(X, Y ), ∅, true, ... , ∅, {X = 3, Y = 3}, true bachelor(S, M), ∅, true, ... , ∅, {S = completed}, M ≥ 5

Fuzzy Prolog – p. 28

slide-34
SLIDE 34

Operational Semantics

A transition in the transition system is defined as:

  • 1. A ∪ a, σ, S → Aθ, σ · θ, S ∧ µa = v

if h ← v is a fact of the program P, θ is the mgu of a and h, and µa is the truth variable for a, and solvable(S ∧ µa = v). (solvable(c) ≡ c has solution in [0, 1] of R )

  • 2. A ∪ a, σ, S → (A ∪ B)θ, σ · θ, S ∧ c

if h ←F B is a rule of the program P, θ is the mgu of a and h, c is the constraint that represents the truth value

  • btained applying the union-aggregator F on the truth

variables of B, and solvable(S ∧ c).

  • 3. A ∪ a, σ, S → fail if none of the above are applicable.

Fuzzy Prolog – p. 29

slide-35
SLIDE 35

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 30

slide-36
SLIDE 36

Fuzzy Programs Syntax

tall(john,V):˜ [0.8,0.9]. tall(john,[0.8,0.9]):˜. f_digit :# fuzzy digit/1. good_player(X,V):˜min tall(X,Vt), swift(X,Vs). not_small :# fnot small/2.

Fuzzy Prolog – p. 31

slide-37
SLIDE 37

Fuzzy → CLP(R) Translation

good_player(X,V):˜min tall(X,Vt), swift(X,Vs). good_player(X,V) :- tall(X,Vt), swift(X,Vs), minim([Vt,Vs],V), V.>=.0, V.=<.1. not_small :# fnot small/2. not_small(X,V) :- small(X,Vs), V .=. 1 - Vs.

Fuzzy Prolog – p. 32

slide-38
SLIDE 38

Syntactic Sugar

✻ ✲ ❈ ❈ ❈ ❈ ❈ ❈ 1

10 30 50

young :# fuzzy_predicate([(0,1), (35,1), (45,0), (90,0)]). young(X,1):- X .>=. 0, X .<. 35. young(X,V):- X .>=. 35, X .<. 45, 10*V.=.45-X. young(X,0):- X .>=. 45, X .=<. 120.

Fuzzy Prolog – p. 33

slide-39
SLIDE 39

Initial Evaluation

  • Implementation over CLP(R): SIMPLICITY
  • Aggregation operator: GENERALITY
  • Definition of new operators: FLEXIBILITY
  • Using Prolog resolution: EFFICIENCY

Available implementation: http://clip.dia.fi.upm.es/Software/Ciao/

Fuzzy Prolog – p. 34

slide-40
SLIDE 40

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 35

slide-41
SLIDE 41

Combining Crisp and Fuzzy Logic

student(john). student(peter).

  • age_about_15(john,1):˜.

age_about_15(susan,0.7):˜. age_about_15(nick,0):˜.

  • teenager_student(X,V):˜

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

slide-42
SLIDE 42

Solution: Default Knowledge

student(john). student(peter). :-default(f_student/2,0). f_student(X,1):- student(X).

  • :-default(age_about_15/2,[0,1]).

age_about_15(john,1):˜. age_about_15(susan,0.7):˜. age_about_15(nick,0):˜.

  • :-default(teenager_student/2,[0,1]).

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

slide-43
SLIDE 43

Default Value

We assume there is a function default which implement the Default Knowledge Assumptions. It assigns an element of B([0, 1]) to each element

  • f the Herbrand Base.
  • If the Closed World Assumption is used, then

default(A) = [0, 0] for all A in Herbrand Base.

  • If Open World Assumption is used instead,

default(A) = [0, 1] for all A in Herbrand Base.

Fuzzy Prolog – p. 38

slide-44
SLIDE 44

Interpretation

An interpretation I consists of the following:

  • 1. a subset BI of the Herbrand Base,
  • 2. a mapping VI, to assign

(a) a truth value, in B([0, 1]), to each element

  • f BI, or

(b) default(A), if A does not belong to BI.

Fuzzy Prolog – p. 39

slide-45
SLIDE 45

Operational Semantics

A transition in the transition system is defined as:

  • 1. A ∪ a, σ, S → Aθ, σ · θ, S ∧ µa = v

if h ← v is a fact of the program P, ...

  • 2. A ∪ a, σ, S → (A ∪ B)θ, σ · θ, S ∧ c

if h ←F B is a rule of the program P, ...

  • 3. A ∪ a, σ, S → fail if none of the above are applicable.

Fuzzy Prolog – p. 40

slide-46
SLIDE 46

Operational Semantics

A transition in the transition system is defined as:

  • 1. A ∪ a, σ, S → Aθ, σ · θ, S ∧ µa = v

if h ← v is a fact of the program P, ...

  • 2. A ∪ a, σ, S → (A ∪ B)θ, σ · θ, S ∧ c

if h ←F B is a rule of the program P, ...

  • 3. A ∪ a, σ, S → fail if none of the above are applicable.

A ∪ a, σ, S → A, σ, S ∧ µa = v if none of the above are applicable and solvable(S ∧ µa = v) where µa = default(a).

Fuzzy Prolog – p. 40

slide-47
SLIDE 47

Example (I) - Shifts Compatibility

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

Timetables of compatible shifts

Shift T1 Shift T2

Fuzzy Prolog – p. 41

slide-48
SLIDE 48

Example (II) - Crisp and Fuzzy

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

slide-49
SLIDE 49

Example (III) - Default Values

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

slide-50
SLIDE 50

Example (IV) - Constructive Answers

?- compatible( [(mo,9),(tu,10),(we,8),(we,9)], [(mo,8),(we,11),(we,12),(D,H)], V ), V .>. 0.7 . V = 0.9, D = we, H = 10 ? ; V = 0.75, D = mo, H = 10 ? ; no

Day M T W T F 8 9 10 11 12 13 14 15 16 17 18 Hour

Fuzzy Prolog – p. 44

slide-51
SLIDE 51

Evaluation

  • Representation of real problems: INCOMPLETENESS
  • Crisp + Fuzzy logic: EXPRESIVITY
  • [0, 1] to represent total uncertainty (0 ≤ v ∧ v ≤ 1). Lack
  • f information do not stop the evaluation: ACCURACY
  • Provides answers: CONSTRUCTIVE

Fuzzy Prolog – p. 45

slide-52
SLIDE 52

Evaluation and Further Work

  • Representation of real problems: INCOMPLETENESS
  • Crisp + Fuzzy logic: EXPRESIVITY
  • [0, 1] to represent total uncertainty (0 ≤ v ∧ v ≤ 1). Lack
  • f information do not stop the evaluation: ACCURACY
  • Provides answers: CONSTRUCTIVE

Further Work:

  • Constructive negative queries
  • Discrete fuzzy sets
  • Applications (collaborative agents)

Fuzzy Prolog – p. 46

slide-53
SLIDE 53

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 47

slide-54
SLIDE 54

Negation in Prolog - As Failure

student(john). student(peter).

  • POSITIVE QUERIES
  • ?- student(john).

yes ?- student(rick). no

  • ?- student(X).

X = john ? ; X = peter ? ; no

  • NEGATIVE QUERIES
  • ?- +\ student(john).

no ?- +\ student(rick). yes

  • ?- +\ student(X).

no

Fuzzy Prolog – p. 48

slide-55
SLIDE 55

Negation in Prolog - Constructive

student(john). student(peter).

  • POSITIVE QUERIES
  • ?- student(john).

yes ?- student(rick). no

  • ?- student(X).

X = john ? ; X = peter ? ; no

  • NEGATIVE QUERIES
  • ?- +\ student(john).

no ?- +\ student(rick). yes

  • ?- neg(student(X)).

X = rick ?; X = anne ?; X = rose ?; ...

Fuzzy Prolog – p. 49

slide-56
SLIDE 56

Negation in Prolog - Constructive

student(john). student(peter).

  • POSITIVE QUERIES
  • ?- student(john).

yes ?- student(rick). no

  • ?- student(X).

X = john ? ; X = peter ? ; no

  • NEGATIVE QUERIES
  • ?- +\ student(john).

no ?- +\ student(rick). yes

  • ?- neg(student(X)).

X =/= john, X =/= peter ?; no

Fuzzy Prolog – p. 50

slide-57
SLIDE 57

Constructive Negation

?- neg(member(X,[1,2])). X =/= 1, X =/= 2 ?; no ?- neg((X =/= 0,member(X,[1,2]))). X = 0 ?; X =/= 0, X =/= 1, X =/= 2 ?; no

Fuzzy Prolog – p. 51

slide-58
SLIDE 58

Fuzzified Crisp Predicates

student(john). student(peter).

  • f1_student(X,V):-

student(X),!, V .=. 1. f1_student(X,0).

  • f2_student(X,V):-

student(X), V .=. 1. f2_student(X,V):- neg(student(X)), V .=. 0. ?- f1_student(X,1). X = john ? ; X = peter ? ; no

  • ?- f1_student(X,0).

no

  • ?- f2_student(X,0).

X =/= john, X =/= peter ? ; no

Fuzzy Prolog – p. 52

slide-59
SLIDE 59

Example (V) - Constructive Answers

?- compatible( [(mo,9), (tu,10), (we,8), (we,9)], [(mo,8), (we,11), (we,12), (D,10)], V), V .>. 0 . D =/= tu ? ; no

Day M T W T F 8 9 10 11 12 13 14 15 16 17 18 Hour

Fuzzy Prolog – p. 53

slide-60
SLIDE 60

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 54

slide-61
SLIDE 61

Borel Alg. vs Discrete Borel Alg.

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

slide-62
SLIDE 62

Discrete Union Aggregation

  • Given a discrete-interval-aggregation

F : Ed([0, 1])n → Ed([0, 1]) defined over discrete-intervals, a discrete-union-aggregation F : Bd([0, 1])n → Bd([0, 1]) is defined over union of discrete-intervals as follows: F(B1, . . . , Bn) = ∪{F(Ed,1, ..., Ed,n) | Ed,i ∈ Bi}

Fuzzy Prolog – p. 56

slide-63
SLIDE 63

Introduction to CLP(FD)

  • CLP(FD): (Arithmetical) constraints over Finite

Domains FD: Each variable ranges over a finite set of integers

  • Resolution is a combination of:

− Propagation: excludes problem inconsistent values from the range of the variables (deterministic) − Labeling: assigns values to variables (expensive search process which fires more propagation)

Fuzzy Prolog – p. 57

slide-64
SLIDE 64

Introduction to CLP(FD)

  • Example:

main(X,Y,Z) :- [X,Y,Z] in 1..5, X-Y .=. 2*Z, X+Y . ≥ . Z, labeling([X,Y,Z]).

Fuzzy Prolog – p. 58

slide-65
SLIDE 65

Fuzzy → CLP(FD) Translation

youth(45,V) ::˜ [0.2,0.5] v [0.8,1] youth(45,V) :- V in 2..5, V in 8..10. good_player(X,V)::˜min tall(X,Vt), swift(X,Vs). good_player(X,V) :- tall(X,Vt), swift(X,Vs), minim([Vt,Vs],V), V in 0..100.

Fuzzy Prolog – p. 59

slide-66
SLIDE 66

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 60

slide-67
SLIDE 67

Constraint Satisfaction Problems (CSP)

1 CANDIDATES X > W + X CONSTRAINTS V= ? GOAL W < V 0.5 > V 0.1 + V < W 0.55 0.15 0.32 0.89 0.31 ...

Fuzzy Prolog – p. 61

slide-68
SLIDE 68

Distributed CSP

1 CANDIDATES X > W + X CONSTRAINTS V= ? GOAL W < V 0.1 + V < W 0.55 0.15 0.32 0.89 0.31 ... 0.5 > V

A3 A1 A2

Fuzzy Prolog – p. 62

slide-69
SLIDE 69

Distributed CSP (I)

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

A3 A1 A2

Fuzzy Prolog – p. 63

slide-70
SLIDE 70

Distributed CSP (II)

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

A3 A1 A2

Fuzzy Prolog – p. 64

slide-71
SLIDE 71

Distributed CSP (III)

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

A3 A1 A2

Fuzzy Prolog – p. 65

slide-72
SLIDE 72

Asynchronous Backtracking Algorithm

  • Each agent owns exactly one variable and

asynchronously assigns a value to its variable and sends it to the other agents (for evaluation)

  • Each agent has a partial knowledge of the problem

determined by the agents connected to it: agent view

  • Messages exchanged:

− ok? : assignment made by the agent − nogood : agent view which detects an inconsistency − ack : acknowledgement (≡ consistency)

Fuzzy Prolog – p. 66

slide-73
SLIDE 73

Extended ABT (I)

  • CLP(FD) resolution simplifies having multiple

variables in each agent

  • Coordination between distributed propagation and

labeling

  • We use the Chandy-Lamport algorithm for detecting

when an agent is stable if: − It has no queued message − Its agent view is complete (there are no messages in transit)

Fuzzy Prolog – p. 67

slide-74
SLIDE 74

Extended ABT (II)

  • Distributed propagation ends when termination is

detected (all agents are in a stable state) → obtains a global fixpoint without inconsistent values

  • We use Dijkstra-Scholten algorithm that provide a

reduction of the search space → minimal exchange of propagation messages: minimal spanning tree

Fuzzy Prolog – p. 68

slide-75
SLIDE 75

Collaborative Fuzzy Problems

  • Collaborative Fuzzy Problems can be

modelled using a combination of: − Discrete Fuzzy Prolog − An implementation of Extended ABT (for distributed reasoning)

  • CLP(FD) is the link between these

components

  • This work has been implemented in Ciao

Prolog

Fuzzy Prolog – p. 69

slide-76
SLIDE 76

Example (I)

  • Criminal identification of suspects
  • Distributed knowledge about:

− physical aspects (V p) − psychical aspects (V s) − evidences (V e)

database Portrait

Vp Vs

Psicologist Police

Ve

Fuzzy Prolog – p. 70

slide-77
SLIDE 77

Example (II)

  • Discrete fuzzy program:

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).

  • Transformed CLP(FD) program:

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

slide-78
SLIDE 78

Distributed Knowledge

  • Partial knowledge stored in each agent is formulated in

terms of constraint expressions

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

slide-79
SLIDE 79

Agent Interaction (I)

  • Collaborative fuzzy agents interaction for

suspect(peter,V):

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

  • k Cp?
  • k Cp?

ack CpCe

  • k CsCp?

ack CsCpCe

Fuzzy Prolog – p. 73

slide-80
SLIDE 80

Agent Interaction (II)

  • Collaborative fuzzy agents interaction for

suspect(jane,V):

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

  • k Cp?
  • k Cp?

nogood nogood

Fuzzy Prolog – p. 74

slide-81
SLIDE 81

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 75

slide-82
SLIDE 82

Multi-adjoint logic

  • Rules with a truth degree of credibility

< R; α >

  • Fuzzy Prolog rule syntax

fpred(args) cred (aggrC, α) :∼ aggrO fpred1(args1), . . . , fpredN(argsN).

  • Example

good_player(J) cred (prod, 0.8) :˜ prod swift(J), tall(J), experience(J).

Fuzzy Prolog – p. 76

slide-83
SLIDE 83

Multi-adjoint logic

  • Fuzzy Prolog fact syntax

fpred(args) value truth_value.

  • Example

experience(john) value 0.9 . experience(karl) value 0.9 . experience(mike) value 0.9 . experience(lebron) value 0.4 . experience(deron) value 0.3 .

Fuzzy Prolog – p. 77

slide-84
SLIDE 84

Default values

  • Represent incomplete information
  • Fuzzy Prolog default value syntax

: − default (fpred/arity, default_value).

  • Example

:- default (experience/1, 0.9). experience(lebron) value 0.4 . experience(deron) value 0.3 .

Fuzzy Prolog – p. 78

slide-85
SLIDE 85

Type Properties

  • Fuzzy Prolog type properties syntax

: − prop type_name/arity. : − set_prop fpred(args) => type_name(args).

  • Example

:- prop typePlayer/1. typePlayer(john). ... typePlayer(deron). :- set_prop experience(J) => typePlayer(J).

Fuzzy Prolog – p. 79

slide-86
SLIDE 86

Complete Example I

:- module(good_player,_,[rfuzzy]). :- prop typePlayer/1. (good_player(J) cred (prop,0.8)) :˜ prop swift(J), tall(J), experience(J). typePlayer(john). ... typePlayer(deron). :- set_prop experience(J) >= typePlayer(J).

Fuzzy Prolog – p. 80

slide-87
SLIDE 87

Complete Example II

:- default (experience/1, 0.9). experience(lebron) value 0.4 . experience(deron) value 0.3 . :- default (tall/1, 0.6). tall(john) value 0.4 . tall(karl) value 0.8 . :- default (swift/1, 0.7). swift(john) value 1 .

Fuzzy Prolog – p. 81

slide-88
SLIDE 88

Fuzzy Queries

  • Fuzzy Prolog queries syntax

? − fpred(args, V ).

  • Example

?- good_player(john,V). V= 0.288 ?; no

Fuzzy Prolog – p. 82

slide-89
SLIDE 89

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 83

slide-90
SLIDE 90

Work proposals

  • “Models of Inexact Reasoning” work

− Modeling a Problem with Fuzzy/RFuzzy Prolog − Semantics for Fuzzy queries language − ...

  • Practical Project / Master thesis

− 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

slide-91
SLIDE 91

Work “Models of Inexact Reasoning”

  • Choose a topic (with the acknowledge of the

professor)

  • Send Feb 20th by e-mail to susana@fi.upm.es

− 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

slide-92
SLIDE 92

Overview

  • Basics

− Introduction − Description − Implementation

  • Extensions

− Incompleteness − Constructive negative Queries − Discrete Fuzzy Sets − Collaborative Fuzzy Agents − Fuzzy Rules with Credibility: RFuzzy

  • Work proposals

Fuzzy Prolog – p. 86

slide-93
SLIDE 93

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. 87