# Fuzzy logic

##### Citation preview

CHAPTER 7 INTRODUCTION TO CLASSICAL SETS AND FUZZY SETS

1

FUZZY LOGIC  Fuzzy logic is the logic underlying approximate, rather than exact, modes of reasoning.  It is an extension of multivalued logic: Everything, including truth, is a matter of degree.  It contains as special cases not only the classical two-value logic and multivalue logic systems, but also probabilistic logic.  A proposition p has a truth value • 0 or 1 in two-value system, • element of a set T in multivalue system, • Range over the fuzzy subsets of T in fuzzy logic. 2

FUZZY LOGIC

 Fuzzy logic is a set of mathematical principles for knowledge representation and reasoning based on degrees of membership. 3

TYPES AND MODELING OF UNCERTAINTY

4

FUZZY vs PROBABILITY  Fuzzy ≠ Probability  Probability deals with uncertainty an likelihood  Fuzzy logic deals with ambiguity an vagueness

5

FUZZY vs PROBABILITY

6

NEED OF FUZZY LOGIC  Based on intuition and judgment.  No need for a mathematical model.  Provides a smooth transition members and nonmembers.

between

 Relatively simple, fast and adaptive.  Less sensitive to system fluctuations.  Can implement design objectives, difficult to express mathematically, in linguistic or descriptive rules. 7

CLASSICAL SETS (CRISP SETS) Conventional or crisp sets are Binary. An element either belongs to the set or does not. {True, False} {1, 0}

8

CRISP SETS

9

OPERATIONS ON CRISP SETS  UNION:  INTERSECTION:  COMPLEMENT:  DIFFERENCE:

10

PROPERTIES OF CRISP The various properties ofSETS crisp sets are as follows:

11

PROPERTIES OF CRISP SETS

12

FUZZY SETS

13

FUZZY SETS

14

FUZZY SETS

15

OPERATIONS ON FUZZY SETS

16

PROPERTIES OF FUZZY SETS

17

PROPERTIES OF FUZZY SETS

18

PROPERTIES OF FUZZY SETS

19

RELATIONS  Relations represent mappings between sets and connectives in logic.  A classical binary relation represents the presence or absence of a connection or interaction or association between the elements of two sets.  Fuzzy binary relations are a generalization of crisp binary relations, and they allow various degrees of relationship (association) between elements. 20

CRISP CARTESIAN PRODUCT

21

CRISP RELATIONS

22

CRISP RELATIONS

23

CRISP BINARY RELATIONS Examples of binary relations

24

OPERATIONS ON CRISP RELATIONS

25

PROPERTIES OF CRISP The properties of crisp sets (given below) RELATIONS hold good for crisp relations as well.  Commutativity,  Associativity,  Distributivity,  Involution,  Idempotency,  DeMorgan’s Law,  Excluded Middle Laws. 26

COMPOSITION ON CRISP RELATIONS

27

FUZZY CARTESIAN Let R be a fuzzy subset of M and S be a fuzzy subset of N. PRODUCT Then the Cartesian product R × S is a fuzzy subset of N × M such that

Example: Let R be a fuzzy subset of {a, b, c} such that R = a/1 + b/0.8 + c/0.2 and S be a fuzzy subset of {1, 2, 3} such that S = 1/1 + 3/0.8 + 2/0.5. Then R x S is given by

28

FUZZY RELATION

29

FUZZY RELATION

30

OPERATIONS ON FUZZY The basic operation on fuzzy sets also apply on fuzzy RELATION relations.

31

OPERATIONS ON FUZZY RELATION

32

PROPERTIES OF FUZZY RELATIONS The properties of fuzzy sets (given below) hold good for fuzzy relations as well.  Commutativity,  Associativity,  Distributivity,  Involution,  Idempotency,  DeMorgan’s Law,  Excluded Middle Laws. 33

COMPOSITION OF FUZZY RELATIONS

34

COMPOSITION OF FUZZY RELATIONS

35

COMPOSITION OF FUZZY RELATIONS

36

COMPOSITION OF FUZZY RELATIONS

37

CLASSICAL EQUIVALENCE RELATION

38

CLASSICAL TOLERANCE RELATION

39

FUZZY EQUIVALENCE RELATION

40

FUZZY TOLERANCE A binary fuzzy relation that possesses the properties of RELATION reflexivity and symmetry is called fuzzy tolerance relation or resemblance relation.

The equivalence relations are a special case of the tolerance relation. The fuzzy tolerance relation can be reformed into fuzzy equivalence relation in the same way as a crisp tolerance relation is reformed into crisp equivalence relation, i.e.,

where ‘n’ is the cardinality of the set that defines R1. 41

CRISP MEMBERSHIP FUCNTIONS

 Crisp membership functions (µ ) are either one or zero.  Consider the example: Numbers greater than 10. The membership curve for the set A is given by

42

REPRESENTING A DOMAIN IN FUZZY LOGIC

43

FUZZY MEMBERSHIP FUCNTIONS

44

FUZZY MEMBERSHIP FUCNTIONS The set B of numbers approaching 2 can be represented by the membership function

45

FUZZINESS vs PROBABILITY

46

LINGUISTIC VARIABLE

47

LINGUISTIC VARIABLE  Let x be a linguistic variable with the label “speed”.  Terms of x, which are fuzzy sets, could be “positive low”, “negative high” from the term set T: T = {PostiveHigh, PositiveLow, NegativeLow, NegativeHigh, Zero}

 Each term is a fuzzy variable defined on the base variable which might be the scale of all relevant velocities.

48

MEMBERSHIP FUCNTIONS

49

MEMBERSHIP FUCNTIONS

50

FEATURES OF MEMBERSHIP FUNCTIONS  CORE:  SUPPORT:  BOUNDARY:

51

FUZZIFICATION

52

FUZZIFICATION  Use crisp inputs from the user.  Determine membership values for all the relevant classes (i.e., in right Universe of Discourse).

53

EXAMPLE FUZZIFICATION

54

FUZZIFICATION OF HEIGHT

55

FUZZIFICATION OF WEIGHT

56

METHODS OF MEMBERSHIP VALUE The various methods of assigning membership values are: ASSIGNMENT 

Intuition,

Inference,

Rank ordering,

Angular fuzzy sets,

Neural networks,

Genetic algorithm,

Inductive reasoning.

57

DEFUZZIFICATION  Defuzzification is a mapping process from a space of fuzzy control actions defined over an output universe of discourse into a space of crisp (nonfuzzy) control actions.  Defuzzification is a process of converting output fuzzy variable into a unique number .  Defuzzification process has the capability to reduce a fuzzy set into a crisp single-valued quantity or into a crisp set; to convert a fuzzy matrix into a crisp matrix; or to convert a fuzzy number into a crisp number.

58

LAMBDA CUT FOR FUZZY SETS

59

LAMBDA CUT FOR FUZZY RELATIONS

60

METHODS OF DEFUZZIFICATION Defuzzification is the process of conversion of a fuzzy quantity into a precise quantity. Defuzzification methods include: 

Max-membership principle,

Centroid method,

Weighted average method,

Mean-max membership,

Center of sums,

Center of largest area,

First of maxima, last of maxima. 61

FUZZY DECISION

62

MAX MEMBERSHIP  Fuzzy set with the METHOD largest membership value is selected.  Fuzzy decision: Fn = {P, F. G, VG, E} Fn = {0.6, 0.4, 0.2, 0.2, 0}  Final decision (FD) = Poor Student  If two decisions have same membership max, use the average of the two.

63

CENTROID METHOD This method is also known as center-of-mass, center-ofarea, or center-of-gravity method. It is the most commonly used defuzzification method. The defuzzified output x* is defined as

where the symbol ∫ denotes an algebraic integration.

64

WEIGHTED AVERAGE METHOD

65

MEAN MAX MEMBERSHIP METHOD

66

CENTER OF SUMS This method employs the algebraic sum of the individual fuzzy subsets instead of their unions. The calculations here are very fast but the main drawback is that the intersecting areas are added twice. The defuzzified value x* is given by

67

CENTER OF LARGEST AREA This method can be adopted when the output consists of at least two convex fuzzy subsets which are not overlapping. The output in this case is biased towards a side of one membership function. When output fuzzy set has at least two convex regions then the center-ofgravity of the convex fuzzy subregion having the largest area is used to obtain the defuzzified value x*. This value is given by

where up

is the convex subregion that has the largest area making

68

FIRST OF MAXIMA (LAST OF The steps used for obtaining crisp values are as follows: MAXIMA)

69

SUMMARY Defuzzification process is essential because some engineering applications need exact values for performing the operation. Example: If speed of a motor has to be varied, we cannot instruct to raise it “slightly”, “high”, etc., using linguistic variables; rather, it should be specified as raise it by 200 rpm or so, i.e., a specific amount of raise should be mentioned. The method of defuzzification should be assessed on the basis of the output in the context of data available. 70

FUZZY ARITHMETIC  Distributions do not have to be precise.  Requires no correlations.  Fuzzy measures probability.

assumption

are

upper

bounds

on

 Fuzzy arithmetic might be a conservative way to do risk assessments.

71

FUZZY NUMBERS AND THEIR ARITHMETIC  Fuzzy numbers • Fuzzy sets of the real line, • Unimodal, • Reach possibility level one.

 Fuzzy arithmetic • Interval arithmetic at each possibility level.

72

FEATURES OF FUZZY ARITHMETIC  Fully developed arithmetic and logic • Addition, subtraction, multiplication, division, min, max; • Log, exp, sqrt, abs, powers, and, or, not; • Backcalculation, updating, mixtures, etc.

 Very fast calculation and convenient software.  Very easy to explain.  Distributional answers (not just worst case).  Results robust to choice about shape. 73

TYPES OF NUMBERS  Scalars are well-known or mathematically defined integers and real numbers.  Intervals are numbers whose values are not know with certainty but about which bounds can be established.  Fuzzy numbers are uncertain numbers for which, in addition to knowing a range of possible values, one can say that some values are more plausible than others. 74

FUZZY NUMBERS  Fuzzy set that is unimodal and reaches 1.  Nested stack of intervals.

1

no

no

YES

0.5 0

75

LEVEL-WISE INTERVAL ARITHMETIC

76

FUZZY INTERVALS BY TRAPEZOIDAL SHAPES

77

A

0.5 0

0

B 2

A+B 4

6

8

 Subtraction, multiplication, division, minimum, maximum, exponentiation, logarithms, etc. are also defined.  If distributions are multimodal, possibility theory (rather than just simple fuzzy arithmetic) is required. 78

FUZZY ARITHMETIC Interval Arithmetic [a, [a, [a, [a,

b] + [d, e] = [a+d, b+e] b] - [d, e] = [a-e, b-d] b] x [d, e] = [min(a.d, a.e, b.d, b.e), max(a.d, a.e, b.d, b.e)] b]/[d, e] = [min(a/d, a/e, b/d, b/e), max(a/d, a/e, b/d, b/e)]

79

FUZZY ARITHMETIC

80

FUZZY ARITHMETIC

81

EXTENSION PRINCIPLE

82

VARIOUS FUZZY MEASURES  Belief and Plausibility Measure.  Probability Measure.  Possibility and Necessity Measure.

83

POSSIBILITY MEASURE  No single definition.  Many definitions could be used: • Subjective assessments. • Social consensus. • Measurement error. • Upper betting rates (Giles) • Extra-observational ranges (Gaines). 84

FUZZY SET AS POSSIBILITY MEASURE

85

GETTING FUZZY INPUTS  Subjective assignments: • Make them up from highest, lowest and best-guess estimates.  Objective consensus: • Stack up consistent interval estimates or bridge inconsistent ones.  Measurement error: • Infer from measurement protocols. 86

SUBJECTIVE ASSIGNMENTS  Triangular fuzzy numbers, e.g. [1,2,3].

Possibility

 Trapezoidal fuzzy numbers, e.g. [1,2,3,4].

1

1

0.5

0.5

0

0 0

1

2

3

4

0

1

2

3

4

5 87

OBJECTIVE CONSENSUS [1000, 3000] [2000, 2400] [500, 2500] [800, 4000] [1900, 2300]

1

Possibility

    

0.5

0 0

2000

4000 88

 46.8 ± 0.3  [46.5, 46.8, 47.1]

Possibility

MEASUREMENT ERROR 1

0

46.5

46.7

46.9

47.1

 [12.32]  [12.315, 12.32, 12.325]

Possibility

1

0 12.31

12.32

12.33

89

SHAPE OF X AFFECTING aX+b

90

ROBUSTNESS OF THE ANSWER Different choices for the fuzzy number X yield very similar distributions for aX + b

all

91

PROBABILITY MEASURE A fuzzy number F is said to “enclose” a probability distribution P if, • the left side of F is larger than P(x) for each x, • the right side of F is larger than 1-P(x) for each x. For every event X < x and x < X, possibility is larger than the probability, so it is an upper bound.

92

POSSIBILITY MEASURE

93

ADVANTAGES OF FUZZY ARITHMETIC  Requires little data.  Applicable to all kinds of uncertainty.  Fully comprehensive.  Fast and easy to compute.  Doesn’t require information about correlations.  Conservative, but not hyper-conservative  In between worst case and probability.  Backcalculations easy to solve. 94

LIMITATIONS OF FUZZY ARITHMETIC  Controversial.  Are alpha levels comparable for different variables?  Not optimal when there're a lot of data.  Can’t use knowledge of correlations to tighten answers.  Not conservative against all possible dependencies.  Repeated variables make calculations cumbersome.

95

SOFTWARES FOR FUZZY ARITHMETIC  FuziCalc • (Windows 3.1) FuziWare, 800-472-6183  Fuzzy Arithmetic C++ Library • (C code) anonymous ftp to mathct.dipmat.unict.it and get \fuzzy\fznum*.*  Cosmet (Phaser) • (DOS, soon for Windows) [email protected]  Risk Calc • (Windows) 800-735-4350; www.ramas.com

96

SCREEN SHOT OF FUZZY CALCULATOR - FzCalc

97

SUMMARY This chapter has given an overview on Fuzzy Arithmetic and Fuzzy Measures.

98

FUZZY RULES AND REASONING The degree of an element in a fuzzy set corresponds to the truth value of a proposition in fuzzy logic systems.

99

LINGUISTIC VARIABLES  A linguistic variable is a fuzzy variable. • The linguistic variable speed ranges between 0 and 300 km/h and includes the fuzzy sets slow, very slow, fast, … • Fuzzy sets define the linguistic values.  Hedges are qualifiers of a linguistic variable. • • • •

All purpose: very, quite, extremely Probability: likely, unlikely Quantifiers: most, several, few Possibilities: almost impossible, quite possible 100

LINGUISTIC HEDGES (LINGUISTIC QUANTIFIERS)  Hedges modify the shape of a fuzzy set.

101

TRUTH TABLES Truth tables define logic functions of two propositions. Let X and Y be two propositions, either of which can be true or false. The operations over the propositions are: 1.Conjunction (∧): X AND Y. 2.Disjunction (∨): X OR Y. 3.Implication or conditional (⇒):

IF X THEN Y.

4.Bidirectional or equivalence (⇔): X IF AND ONLY IF Y. 102

FUZZY RULES A fuzzy rule is defined as the conditional statement of the form If x is A THEN y is B where x and y are linguistic variables and A and B are linguistic values determined by fuzzy sets on the universes of discourse X and Y.

103

FUZZY RULES  The decision-making process is based on rules with sentence conjunctives AND, OR and ALSO.  Each rule corresponds to a fuzzy relation.  Rules belong to a rule base.  Example: If (Distance x to second car is SMALL) OR (Distance y to obstacle is CLOSE) AND (speed v is HIGH) THEN (perform LARGE correction to steering angle θ ) ALSO (make MEDIUM reduction in speed v).  Three antecedents (or premises) in this example give rise to two outputs (consequences). 104

FUZZY RULE FORMATION IF height is tall THEN weight is heavy. Here the fuzzy classes height and weight have a given range (i.e., the universe of discourse). range (height) = [140, 220] range (weight) = [50, 250]

105

FORMATION OF FUZZY RULES

Three general forms are adopted for forming fuzzy rules. They are:

 Assignment statements,  Conditional statements,  Unconditional statements. 106

FORMATION OF FUZZY Assignment Statements RULES Unconditional Statements

Conditional Statements

107

DECOMPOSITION OF FUZZY RULES A compound rule is a collection of several simple rules combined together.  Multiple conjunctive antecedent,  Multiple disjunctive antecedent, 

Conditional

statements

(with

ELSE

and

UNLESS).

108

DECOMPOSITION OF Multiple Conjunctive FUZZY RULES Multiple disjunctive Antecedants

antecedent

Conditional Statements ( With Else and Unless)

109

AGGREGATION OF FUZZY RULES Aggregation of rules is the process of obtaining the overall consequents from the individual consequents provided by each rule.  Conjunctive system of rules.  Disjunctive system of rules.

110

AGGREGATION OF FUZZY Conjunctive system of rules RULES

Disjunctive system of rules

111

FUZZY RULE - EXAMPLE Rule 1: If height is short then weight is light. Rule 2: If height is medium then weight is medium. Rule 3: If height is tall then weight is heavy.

112

FUZZY RULE - EXAMPLE Problem: Given (a) membership functions for short, medium-height, tall, light, medium-weight and heavy; (b) The three fuzzy rules; (c) the fact that John’s height is 6’1” estimate John’s weight.

113

FUZZY RULE - EXAMPLE Solution: (1) From John’s height we know that John is short (degree 0.3) John is of medium height (degree 0.6). John is tall (degree 0.2). (2) Each rule produces a fuzzy set as output by truncating the consequent membership function at the value of the antecedent membership. 114

FUZZY RULE - EXAMPLE

115

FUZZY RULE - EXAMPLE

116

FUZZY RULE - EXAMPLE

117

FUZZY RULE - EXAMPLE  The cumulative fuzzy output is obtained by ORing the output from each rule.  Cumulative fuzzy output (weight at 6’1”).

118

FUZZY RULE - EXAMPLE 1. De-fuzzify to obtain a numerical estimate of the output. 2. Choose the middle of the range where the truth value is maximum. 3. John’s weight = 80 Kg. 119

FUZZY REASONING There

exist

four

modes

of

fuzzy

approximate reasoning, which include: 1. Categorical reasoning, 2. Qualitative reasoning, 3. Syllogistic reasoning, 4. Dispositional reasoning. 120

REASONING WITH FUZZY RULES  In classical systems, rules with true antecedents fire.  In fuzzy systems, truth (i.e., membership in some class) is relative, so all rules fire (to some extent).

121

REASONING WITH FUZZY RULES

122

SINGLE RULE WITH SINGLE ANTECEDANT

123

SINGLE RULE WITH MULTIPLE ANTECEDANTS

124

MULTIPLE ANTECEDANTS IF x is A AND y is B THEN z is C IF x is A OR y is B THEN z is C Use unification (OR) or intersection (AND) operations to calculate a membership value for the whole antecedent.

125

MULTIPLE RULE WITH MULTIPLE ANTECEDANTS

126

MULTIPLE CONSEQUENTS IF x is A THEN y is B AND z is C Each consequent is affected equally by the membership in the antecedent class(es). E.g., IF x is tall THEN x is heavy AND x has large feet.

127

FUZZY INFERENCE SYSTEMS (FIS)

 Fuzzy rule based systems, fuzzy models, and fuzzy expert systems are also known as fuzzy inference systems.  The key unit of a fuzzy logic system is FIS.  The primary work of this system is decisionmaking.  FIS uses “IF...THEN” rules along with connectors “OR” or “AND” for making necessary decision rules. 128

FUZZY INFERENCE SYSTEMS  The input to FIS may be fuzzy or crisp, but the output from FIS is always a fuzzy set.  When FIS is used as a controller, it is necessary to have crisp output.  Hence, there should be a defuzzification unit for converting fuzzy variables into crisp variables along FIS. 129

BLOCK DIAGRAM OF FIS

130

TYPES OF FIS There

are

two

types

of

Fuzzy

Inference

Systems:

 Mamdani FIS(1975)  Sugeno FIS(1985)

131

MAMDANI FUZZY INFERENCE SYSTEMS  Fuzzify input variables: (FIS) Determine membership values.

 Evaluate rules:

Based on membership values of (composite) antecedents.

 Aggregate rule outputs:

Unify all membership values for the output from all rules.

 Defuzzify the output:

COG: Center of gravity (approx. by summation). 132

SUGENO FUZZY INFERENCE SYSTEMS (FIS) The main steps of the fuzzy inference process namely, 1.fuzzifying the inputs and 2.applying the fuzzy operator are exactly the same as in MAMDANI FIS. The main difference between Mamdani’s and Sugeno’s methods is that Sugeno output membership functions are either linear or constant.

133

SUGENO FIS

134

FUZZY EXPERT SYSTEMS An expert system contains three major blocks:  Knowledge base that contains the knowledge specific to the domain of application.  Inference engine that uses the knowledge in the knowledge base for performing suitable reasoning for user’s queries.  User interface that provides a smooth communication between the user and the system.

135

BLOCK DIAGRAM OF FUZZY EXPERT SYSTEMS

Examples of Fuzzy Expert System include Z-II, MILORD. 136

SUMMARY  Advantages of fuzzy logic • Allows the use of vague linguistic terms in the rules.  Disadvantages of fuzzy logic • Difficult to estimate membership function • There are many ways of interpreting fuzzy rules, combining the outputs of several fuzzy rules and de-fuzzifying the output. 137

FUZZY DECISION MAKING Decision making is a very important social, economical and scientific endeavor. The

decision-making

process

involves

three steps: 1. Determining the set of alternatives, 2. Evaluating alternatives, 3. Comparison between alternatives. April 2007

138

FUZZY DECISION MAKING Certain fuzzy decision-making process are as follows:  Individual decision making,  Multiperson decision making,  Multiobjective decision making,  Multiattribute decision making,  Fuzzy Bayesian decision making.

April 2007

139

INDIVIDUAL DECISION MAKING

April 2007

140

MULTIPERSON DECISION In multiperson decision making, the decision makers have MAKING access to different information upon which to base their decision.

April 2007

141

MULTIOBJECTIVE DECISION MAKING In making a decision when there are several objectives to be

realized, then the decision making is called multiobjective decision making. Many decision processes may be based on single objectives such as cost minimization, time consumption, profit maximization and so on. The main issues in multiobjective decision making are:  To acquire proper information related to the satisfaction of the objectives by various alternatives.  To weigh the relative importance of each objective.

April 2007

142

MULTIATTRIBUTE DECISION MAKING  The evaluation of alternatives can be carried out based on several attributes of the object called multiattribute decision making.  The attributes may be classified into numerical data, linguistic data and qualitative data.

April 2007

143

MULTIATTRIBUTE DECISION The problem of decision-making structure in multiattributes MAKING deals with determination of an evaluation structure for the multiattribute

decision

making

from

the

available

multiattribute data xi (i = 1 to n) and alternative evaluations y shown in the table.

April 2007

144

FUZZY BAYESIAN DECISION MAKING

 Probability theory.  Bayesian inference: • Use probability theory and information about independence. • Reason diagnostically [from evidence (effects) to conclusions (causes)] or casually (from causes to effects).  Bayesian networks: • Compact representation of probability distribution over a set of propositional random variables. • Take advantage of independence relationships.

April 2007

145

FUZZY BAYESIAN DECISION MAKING

April 2007

146

FUZZY BAYESIAN DECISION MAKING Expected Utility

April 2007

147

FUZZY BAYESIAN DECISION MAKING

April 2007

148

SUMMARY The chapter has discussed the various decision-making process. In many decision-making situations, the goals, constraints and consequences of the defined alternatives are known imprecisely, which is due to ambiguity and vagueness. Methods for addressing this form of imprecision are important for dealing with many of the uncertainties we deal within human systems.

April 2007

149
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}