Fuzzy Logic Jan Jantzen jj@inference.dk 2013 Logic is based on set theory, and when we switch to...

Post on 24-Dec-2015

218 views 1 download

transcript

Fuzzy Logic

Jan Jantzen

jj@inference.dk

www.inference.dk

2013

Logic is based on set theory, and when we switch to fuzzy sets it will have an effect on logic.

2

Summary

• Fuzzy logic is computing with words (Zadeh)• Approximate reasoning • Consistency Computers can make

decisions even with statements that are true to a degree between 0 and 1

If we build a logic on fuzzy sets, will the usual laws still hold?

Intelligent computers

3

Inference by Computer

• If room is warm then set cooling power to 500 watts

• Temperature is 21 deg C• Cooling = 250 watts

• If T > 21 C then Cooling = on• If T ≤ 21 C then Cooling = off

Fuzzy controller

Classical controller

4

Key Concepts

• And, or, not, nor, xor, etc.• implication*, equivalence*• rules of inference*, tautologies*• *) difficult

5

Fuzzy reasoning: True Love

Wife: Do you love me?

Husband (Boolean logician): Yes.

Wife: How much?

6

FAQ: Why fuzzy logic?

A: • It is tolerant• Mathematically consistent (almost)• Operational (= executable by computers)• A way to communicate with computers

7

Example: Betting On Baseball

If either the Pirates or the Cubs loose and the Giants win, then the Dodgers will be out of first place, and I will loose a bet.

(( p c) g) ( d b)

This expression can be programmed on a computer.

8

Exhaustive Search Solution

• 25 = 32 possible combinations• 23 legal combinations, 9 illegal• 10 possible cases where I will win the bet

(b=1)

p c g d b

0 0 0 0 1

0 0 0 1 1

0 1 0 0 1

0 1 0 1 1

1 0 0 0 1

1 0 0 1 1

1 1 0 0 1

1 1 0 1 1

1 1 1 0 1

1 1 1 1 1The validity is guaranteed !

9

BOOLEAN LOGIC

10

Define disjunction (OR)

p q p q 0 0 0 0 1 1 1 0 1 1 1 1

Truth table

11

Boolean OR as a Cayley Table

p q

0 1 q

0 0 1

1 1 1

p

It contains the same information, only reorganised into a two-dimensional array.

12

Define negation (NOT)

p = 1 - p

p = p

The law of involution is valid

If p is 0 then 'not p' = 1, and if p is 1 then 'not p' = 0.

13

Assume DeMorgan's Laws

qpqp

qpqp

These two laws provide a connection between AND and OR by means of negation.

14

Derive NAND

qpqp

The left hand side is clearly 'not AND', which is NAND. The right hand side contains only OR and NOT, which we have already defined previously. We have thus derived a new operation based on existing definitions.

15

NAND table

(p) (q)

0 1 q

0 1 1

1 1 0

p

Example. Suppose p = 0 and q = 0, corresponding to the upper left cell. Then NOT p = 1 and NOT q = 1. Use the previously defined OR table to find the result 1, which is the truth value in the upper left cell.

16

Derive conjunction (AND)

qpqp

The left hand side is obviously AND. The right hand side is the negation of NAND, which is also AND. It contains only OR and NOT, which we have already defined previously. We have again derived a new operation based on existing definitions.

17

AND table

((p) (q))

0 1 q

0 0 0

1 0 1

p

We get this from the NAND table by negating the content of all cells.

18

Short recap

• Starting from OR, NOT, and DeMorgan's laws,

• we derived NAND and AND • (and also NOR, not shown but easy; even

XOR could be derived in a similar manner)

19

Fuzzy OR

p q p q 0 0 0 0 0.5 0.5 0 1 1

0.5 0 0.5 0.5 0.5 0.5 0.5 1 1 1 0 1 1 0.5 1 1 1 1

We work with only three truth values 0, 0.5 and 1 to preserve space. Actually, these three are sufficient representatives of all truth values, as long as we only work with AND, OR, and NOT.

20

Fuzzy OR as a Cayley Table

p q

0 0.5 1 q

0 0 0.5 1

0.5 0.5 0.5 1

1 1 1 1

p

It contains the same information, only reorganised into a two-dimensional array.

21

Derive fuzzy NAND

(p) (q)

0 0.5 1 q

0 1 1 1

0.5 1 0.5 0.5

1 1 0.5 0

p

We do exactly as before in order to find the contents of the cells.

22

Derive fuzzy AND

((p) (q))

0 0.5 1 q

0 0 0 0

0.5 0 0.5 0.5

1 0 0.5 1

p

Again, we get this from the NAND table by negating the content of each cell.

23

Short recap

• When fuzzy OR is defined as MAX,• then the derived fuzzy AND is consistent

with MIN• (we could go on and derive fuzzy NOR

and fuzzy XOR)

24

Fuzzy Baseball Example

If either the Pirates or the Cubs loose and the Giants win, then the Dodgers will be out of first place, and I will loose a bet.

(( p c) g) ( d b)

25

Exhaustive Search Solution

• 35 = 243 (was 32) possible combinations• 33 (was 10) possible cases where I will

win the bet (b = 1) p c g d b

0.5 0.5 0 1 1

One example of awinning outcome:

Could be interpreted as 'maybe'

26

Triangular Norms

xyyxyx

xyyx

:sum ticProbabilis

:Product

If we define AND as product (×), instead of min, then OR must be 'probabilistic sum' in order to keep the DeMorgan laws satisfied. In that case, we go through the previously developed scheme again in order to derive the remaining operations.

Candidates for AND. OR candidates are called triangular conorms.

27

Summary

• Fuzzy and, or, not, nor, etc. can be defined in a consistent manner (DeMorgans laws hold).

28

Applications

• Automatic control, robots• Expert systems• Medical diagnosis• Financial decision support• Image processing• Intelligent computers