Top Banner
Fuzzy Prolog Susana Mu ˜ noz-Hern ´ andez Facultad de Inform ´ atica Universidad Polit ´ ecnica de Madrid 28660 Madrid, Spain [email protected] Fuzzy Prolog – p. 1
93

Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Apr 17, 2018

Download

Documents

dotuyen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzzy PrologSusana Munoz-Hernandez

Facultad de Informatica

Universidad Politecnica de Madrid

28660 Madrid, Spain

[email protected]

Fuzzy Prolog – p. 1

Page 2: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 3: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 4: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Modeling Real World

• Knowledge:− Uncertainty− Probability− Fuzziness− Incompleteness− Distributed knowledge

• Reasoning:− Logic

Fuzzy Prolog – p. 4

Page 5: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Uncertainty-Probability-Fuzziness

?

• If we through the cube... which value willappear at the top?

Fuzzy Prolog – p. 5

Page 6: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Uncertainty

?

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

Fuzzy Prolog – p. 6

Page 7: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Uncertainty-Probability-Fuzziness

3?

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

Fuzzy Prolog – p. 7

Page 8: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Probability

3?

01 2 3 4 5 6

1probability

1 / 6

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

Fuzzy Prolog – p. 8

Page 9: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Uncertainty-Probability-Fuzziness

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

Fuzzy Prolog – p. 9

Page 10: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness

small1

01 2 3 4 5 6

small(X = 3) = 0.6

Value 3 is slightly small

Fuzzy Prolog – p. 10

Page 11: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness level: Example

Let’s define the concept of youth

Fuzzy Prolog – p. 11

Page 12: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness level

1

0Age

Youth

20 6040·

CRISP

Fuzzy Prolog – p. 12

Page 13: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness level

1

0Age

Youth

20 6040·

CRISP

1

0Age

Youth

20 40 60

·

FUZZY

Fuzzy Prolog – p. 12

Page 14: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness level

1

0Age

Youth

20 6040·

CRISP

1

0Age

Youth

20 40 60

·

FUZZY

1

0Age

Youth

20 40 60

INTERVAL VALUED FUZZY

Fuzzy Prolog – p. 12

Page 15: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness level

1

0Age

Youth

20 6040·

CRISP

1

0Age

Youth

20 40 60

·

FUZZY

1

0Age

Youth

20 40 60

INTERVAL VALUED FUZZY

1

0Age

Youth

20 40 60

INTERVAL UNION VALUED FUZZY

Fuzzy Prolog – p. 12

Page 16: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 17: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 18: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness - Uncertainty

• New Laptop is a branch of computers with two laptopmodels (VZX and VZY). One model is very slow andthe other one is very fast.

1

0

Speed

ModelVZX VZY

− VZX speed [0.02, 0.08]

− VZY speed [0.75, 0.90]

Fuzzy Prolog – p. 15

Page 19: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzziness - Uncertainty

• New Laptop is a branch of computers with two laptopmodels (VZX and VZY). One model is very slow andthe other one is very fast.

1

0

Speed

ModelVZX 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

Page 20: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Modeling Real World

• Knowledge:

Constraints←

Uncertainty

Probability

Fuzziness

Incompleteness

Distributed knowledge

• Reasoning:

Prolog ← Logic

Fuzzy Prolog – p. 16

Page 21: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 22: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 23: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Syntax

• If A is an atom, A← v is a fuzzy fact , where v, a truthvalue, is an element in B([0, 1]) expressed asconstraints over the domain [0, 1].

• Let A,B1, . . . , Bn be atoms. A fuzzy clause is a clauseof the form A v ←F B1 v1, . . . , Bn vn where F is anaggregation operator of truth values represented asconstraints over the domain [0, 1]. Theinterval-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) thatrepresents a truth value in B([0, 1]).

Fuzzy Prolog – p. 19

Page 24: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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 andcontinuous, then it is called aggregation operator

Fuzzy Prolog – p. 20

Page 25: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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 andcontinuous, then it is called aggregation operator

• Given an aggregation f : [0, 1]n → [0, 1] aninterval-aggregation F : E([0, 1])n → E([0, 1]) isdefined as follows:

F ([xl1, x

u1 ], ..., [x

ln, xu

n]) = [f(xl1, ..., x

ln), f(xu

1 , ..., xun)]

Fuzzy Prolog – p. 20

Page 26: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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 ofintervals as follows:

F(B1, . . . , Bn) = ∪{F (E1, ..., En) | Ei ∈ Bi}

Fuzzy Prolog – p. 21

Page 27: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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]), toeach element of BI .

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

Fuzzy Prolog – p. 22

Page 28: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Interval Inclusion

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

I

I 2

1

dc

a b

Fuzzy Prolog – p. 23

Page 29: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Borel Inclusion

Def:[Borel inclusion ⊆BI ] Given two unions ofintervals 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

Page 30: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Interpretation Inclusion - Valuation

Def:[interpretation inclusion ⊑] I ⊑ I ′ iff BI ⊆ BI ′

and for all B ∈ BI , VI(B) ⊆BI VI ′(B), whereI = 〈BI , VI〉, I ′ = 〈BI ′, VI ′〉 are interpretations.

Def:[valuation] A valuation σ of an atom A is anassignment of elements of U to variables of A.So σ(A) ∈ B is a ground atom.

Fuzzy Prolog – p. 25

Page 31: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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 thefollowing holds:for all valuation σ, if σ(Bi) ∈ BI , 1 ≤ i ≤ n, andv = F(VI(σ(B1)), . . . , VI(σ(Bn))) then σ(A) ∈ BI andv ⊆BI VI(σ(A)), where F is the union aggregationobtained from F .

• I is a model of a fuzzy program, if it is a model for thefacts and clauses of the program.

Fuzzy Prolog – p. 26

Page 32: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Semantics Equivalence

Given a program P , the three semantics:

1. Least model lm(P ), under the ⊑ ordering.

2. Declarative meaning lfp(TP ), least fixpoint fora 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

Page 33: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Operational Semantics

• A sequence of transitions between differentstates 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

Page 34: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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, andsolvable(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 valueobtained applying the union-aggregator F on the truthvariables of B, and solvable(S ∧ c).

3. 〈A ∪ a, σ, S〉 → fail if none of the above are applicable.Fuzzy Prolog – p. 29

Page 35: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 36: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 37: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 38: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Syntactic Sugar

6

-

CCCCCC

1

010 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

Page 39: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 40: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 41: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 42: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Solution: Default Knowledgestudent(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

Page 43: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Default Value

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

• If the Closed World Assumption is used, thendefault(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

Page 44: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

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

Fuzzy Prolog – p. 39

Page 45: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 46: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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 andsolvable(S ∧ µa = v) where µa = default(a).

Fuzzy Prolog – p. 40

Page 47: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Example (I) - Shifts Compatibility

Hour

Day

M T W T F8

9

10

11

12

13

14

15

16

17

18

Hour

Day

M T W T F8

9

10

11

12

13

14

15

16

17

18

HourDay

M T W T F8

9

10

11

12

13

14

15

16

17

18

Timetables of compatible shiftsShift T1

Shift T2

Fuzzy Prolog – p. 41

Page 48: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

0

1

1 2 3 4 5

few_days

days

0

1

0 1 2 3 4 5 6 7 8 hours

without_gaps

Fuzzy Prolog – p. 42

Page 49: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 50: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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 F8

9

10

11

12

13

14

15

16

17

18

Hour

Fuzzy Prolog – p. 44

Page 51: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Evaluation

• Representation of real problems: INCOMPLETENESS

• Crisp + Fuzzy logic: EXPRESIVITY

• [0, 1] to represent total uncertainty (0 ≤ v ∧ v ≤ 1). Lackof information do not stop the evaluation: ACCURACY

• Provides answers: CONSTRUCTIVE

Fuzzy Prolog – p. 45

Page 52: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Evaluation and Further Work

• Representation of real problems: INCOMPLETENESS

• Crisp + Fuzzy logic: EXPRESIVITY

• [0, 1] to represent total uncertainty (0 ≤ v ∧ v ≤ 1). Lackof 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

Page 53: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 54: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Negation in Prolog - As Failurestudent(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

Page 55: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Negation in Prolog - Constructivestudent(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

Page 56: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Negation in Prolog - Constructivestudent(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

Page 57: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 58: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 59: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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 F8

9

10

11

12

13

14

15

16

17

18

Hour

Fuzzy Prolog – p. 53

Page 60: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 61: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Borel Alg. vs Discrete Borel Alg.

0

0.2

1

0.80.9

0.70.60.50.40.3

0.1

x x

0.10.20.30.40.50.60.70.80.91

0

Discrete Borel AlgebraBorel 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

Page 62: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Discrete Union Aggregation

• Given a discrete-interval-aggregationF : Ed([0, 1])n → Ed([0, 1]) defined overdiscrete-intervals, a discrete-union-aggregation

F : Bd([0, 1])n → Bd([0, 1]) is defined over union ofdiscrete-intervals as follows:

F(B1, . . . , Bn) = ∪{F (Ed,1, ..., Ed,n) | Ed,i ∈ Bi}

Fuzzy Prolog – p. 56

Page 63: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Introduction to CLP( FD)

• CLP(FD): (Arithmetical) constraints over FiniteDomains FD: Each variable ranges over a finite set ofintegers

• Resolution is a combination of:

− Propagation: excludes problem inconsistent valuesfrom the range of the variables (deterministic)

− Labeling: assigns values to variables (expensivesearch process which fires more propagation)

Fuzzy Prolog – p. 57

Page 64: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 65: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 66: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 67: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Constraint Satisfaction Problems (CSP)

10

CANDIDATES

X > W + X

CONSTRAINTS

V= ?GOAL

W < V

0.5 > V

0.1 + V < W

0.550.15

0.32

0.89

0.31...

Fuzzy Prolog – p. 61

Page 68: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Distributed CSP

10

CANDIDATES

X > W + X

CONSTRAINTS

V= ?GOAL

W < V

0.1 + V < W

0.550.15

0.32

0.89

0.31...

0.5 > V

A3

A1

A2

Fuzzy Prolog – p. 62

Page 69: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Distributed CSP (I)

10

CANDIDATES

V= ?GOAL

0.550.15

0.32

0.89

0.31...

0.1 + V < W

0.5 > V

W < V

X > W + X

CONSTRAINTS − AGENTS

A3

A1A2

Fuzzy Prolog – p. 63

Page 70: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Distributed CSP (II)

10

CANDIDATES

V= ?GOAL

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

A1A2

Fuzzy Prolog – p. 64

Page 71: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Distributed CSP (III)

10

CANDIDATES

V= ?GOAL

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

A1A2

Fuzzy Prolog – p. 65

Page 72: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Asynchronous Backtracking Algorithm (ABT)

• Each agent owns exactly one variable andasynchronously assigns a value to its variable andsends it to the other agents (for evaluation)

• Each agent has a partial knowledge of the problemdetermined by the agents connected to it: agent view

• Messages exchanged:

− ok? : assignment made by the agent

− nogood : agent view which detects aninconsistency

− ack : acknowledgement (≡ consistency)

Fuzzy Prolog – p. 66

Page 73: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Extended ABT (I)

• CLP(FD) resolution simplifies having multiplevariables in each agent

• Coordination between distributed propagation andlabeling

• We use the Chandy-Lamport algorithm for detectingwhen an agent is stable if:

− It has no queued message

− Its agent view is complete (there are no messagesin transit)

Fuzzy Prolog – p. 67

Page 74: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Extended ABT (II)

• Distributed propagation ends when termination isdetected (all agents are in a stable state)→ obtains aglobal fixpoint without inconsistent values

• We use Dijkstra-Scholten algorithm that provide areduction of the search space→ minimal exchange ofpropagation messages: minimal spanning tree

Fuzzy Prolog – p. 68

Page 75: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Collaborative Fuzzy Problems

• Collaborative Fuzzy Problems can bemodelled using a combination of:− Discrete Fuzzy Prolog− An implementation of Extended ABT (for

distributed reasoning)

• CLP(FD) is the link between thesecomponents

• This work has been implemented in CiaoProlog

Fuzzy Prolog – p. 69

Page 76: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Example (I)

• Criminal identification of suspects

• Distributed knowledge about:− physical aspects (V p)

− psychical aspects (V s)

− evidences (V e)

databasePortrait

Vp Vs

Psicologist

Police

Ve

Fuzzy Prolog – p. 70

Page 77: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 78: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Distributed Knowledge

• Partial knowledge stored in each agent is formulated interms of constraint expressionsCp: 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

Page 79: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Agent Interaction (I)

• Collaborative fuzzy agents interaction forsuspect(peter,V) :

Cp

Ce

Cp

Cp

Cs

CpCe CsCp

CpCeCs

CpCeCs CpCeCs

CsCpCeCpCeCsCpCe CsCpCe

CpCe

5..9Vs in

a1 a1

a1 a1

a2 a2 a2

a2 a2

a3 a3 a3

a3 a3

Vs Vp Vs Vp Vs

VeVeVe

Vp Vs Vp=10

Ve Ve=10T4 T5

T2T1 T3

a1

Vp

ack CsCpCe

ok Cp?

ok Cp?

ack CpCeok CsCp?

ack CsCpCe

Fuzzy Prolog – p. 73

Page 80: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Agent Interaction (II)

• Collaborative fuzzy agents interaction forsuspect(jane,V) :

Cp

Ce

Cp

Vp Vs Vp Vs Vp Vs

VeVeVe

CsCp

CpVp Vs

Ve

a1 a1 a1 a1a2 a2 a2 a2

a3 a3 a3 a3

T1 T2 T3 T4

ok Cp?

ok Cp?nogood

nogood

Fuzzy Prolog – p. 74

Page 81: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 82: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Multi-adjoint logic

• Rules with a truth degree of credibility

< R;α >

• Fuzzy Prolog rule syntaxfpred(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

Page 83: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 84: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 85: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 86: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 87: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 88: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzzy Queries

• Fuzzy Prolog queries syntax

?− fpred(args, V ).

• Example

?- good_player(john,V).

V= 0.288 ?;

no

Fuzzy Prolog – p. 82

Page 89: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 90: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 91: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Work “Models of Inexact Reasoning”

• Choose a topic (with the acknowledge of theprofessor)

• Send Feb 20th by e-mail to [email protected]− 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

Page 92: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

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

Page 93: Fuzzy Prolog - DIA | Departamento de Inteligencia Artificialdia.fi.upm.es/~mgremesal/MIR/slides/09 - MIR - Fuzzy...Fuzzy Prolog Susana Munoz-Hern˜ andez´ Facultad de Informatica´

Fuzzy PrologSusana Munoz-Hernandez

Facultad de Informatica

Universidad Politecnica de Madrid

28660 Madrid, Spain

[email protected]

Fuzzy Prolog – p. 87