MSIM4112 L7 Fuzzy

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

About this lecture

 Understand the basic concepts of fuzzy logics


MSIM4112 - Systems Simulation
Fuzzy Logic  Using the Fuzzy Logic to provide decision support
in supply chain applications
Dr George Ho
D604-B1
(georgeho@hsmc.edu.hk)
Tel: 3963 5587

1 2

Reasons to use information Reasons to use information


system to support workflow system to support workflow
management management
 Improve the process quality
Provide Decision Support in each process
 minimal waste of time, effort and/or money
 accurate, easy to read and understand
Process within the integrated workflow

Suggest
IF SOMETHING HAPPENED THEN you should…
in the process

Information System
(Fuzzy Logic)

Workflow
Ensure “Do it right” in each process
3 4
What is Fuzziness?
 Fuzziness occurs when the boundary of a piece of information is not
clear-cut

Fuzzy Logic Concept in


 E.g. Concepts such as young, tall, good, or high are fuzzy
 What quantitative value can define a person as young?

Responsive Replenishment
 Age 25, 30, 30 or 40
 On the basis of fuzzy set theory, an element belongs to a set with a certain
grade of membership

System
 More formally a fuzzy set A in a universe of discourse (the numerical range
of the inputs) U is characterized by a membership function:
A : U  [0,1] --- (a)
 In this case the elements of the universe of discourse can belong to the
fuzzy set with any value between 0 and 1
 This value is called the grade of membership. If an element has a value
close to 1, the degree of membership, or truth value is high
 The characteristic function of a fuzzy set is called the membership function,
for it gives the degree of membership for each element of the universe of
discourse
5 6

Fuzzy Term – Young Possibility Distribution


 The fuzzy term young might be defined by the fuzzy set as  From equation (a), it
shown below: can be written as: The possibility distribution in graph:

μyoung (25) = 1
Age Grade of Membership μyoung (30) = 0.8
25 1.0 μyoung (50) = 0
30 0.8

35 0.6  Grade of membership


40 0.4 values constitute a
45 0.2 possibility distribution of
the term young
50 0.0

7 8
Development of a Responsive Conceptual Model of an RRS
Replenishment System (RRS)
 The RRS is developed for managing the right supply of goods
particularly for the convenience store business
 The proposed system helps to leverage the responsiveness of
relevant operations to meet market demands
 RRS consists of six stages
1. Situation analysis
Some How much you
2. Knowledge acquisition historical need to reorder
3. Data collection sales data RRS
of
4. Fuzzification specified
5. Fuzzy inference engine product
The expertise knowledge is
6. Defuzzification stored in IF-THEN rules format

Some expertise knowledge The procedures comprising fuzzification to defuzzification can be grouped to
stored in IF-THEN rules format9 form the fuzzy system, which embraces the fuzzy logic principle
10

Data Collection Knowledge Acquisition


 The input data received from the external world may exist in  Required knowledge needs to be extracted from the
dissimilar formats such as related domains followed by the procedure to turn it
 crisp numeric data, bivalent data, linguistic data, statistical data into IF-THEN rules which form part of the fuzzy
and a set of crisp values system.
 Data need to be transformed into a right format and a right size  Knowledge acquisition can be conducted in different
before being delivered to the fuzzy system as the input data set ways such as interviews of domain experts and
data mining of historical data.

11 12
Fuzzification Membership Function
 It is mainly concerned with the conversion of the  Characteristics of the fuzzy set are determined by the
membership function, e.g. for the fuzzy set A:
input data set (from the data collection process) into

A
fuzzy sets. n
 A ( xi )
 To carry out this fuzzification process, two decisive
factors have to be specified in order to determine i 1 xi
the overall features of the fuzzy sets, i.e.
 The equation is the general mathematical expression of fuzzy
1.Universe of discourse subset A of x where x is the whole data set and x is an element
of subset A, and μA(xi) is the membership function of element xi
2.Membership function in the universe of discourse when the support set is a finite set
X = {x1, x2, x3 … xn}

13 14

Composition of Fuzzy Sets (1) Composition of Fuzzy Sets (2)


E.g. Representing Time(t) in Fuzzy Logic
 The universe of discourse is normally divided into T = {S, RS, N, RL, L} where S is short, RS is relatively short, N is
several regions which belong to different predicates normal, RL is relatively long and L is long
such as short (S), relatively short (RS), normal (N), µT(t) µT(t) µT(t)

relatively long (RL) and long (L)


S RS N
1 1 1

 Graphs in the next slide show how the predicate


functions form the composition of the fuzzy set
4 8 12 16 20 24 t 4 8 12 16 20 24 t 4 8 12 16 20 24 t

 These predicates have special shapes, heights and


(hour) (hour) (hour)

line styles to represent their membership functions


µT(t) µT(t) µT(t)
RL L S RS N RL L
1 1 1

15 16
4 8 12 16 20 24 t 4 8 12 16 20 24 t 4 8 12 16 20 24 t
(hour) (hour) (hour)
Fuzzy Set Intersections Fuzzy Set Intersections
 Calculate Membership value to  Calculate Membership value to
 E.g. Representing Time(t) in Fuzzy Logic Normal (μN) Relatively Long (μRL)
 If the average time of selling all soft drink to customer is 15 hours µ T(t)
µ T (t)
RL
 Then, the time is associated with the Fuzzy Set of Normal (μN)
N 1
1

and Relatively Long (μRL) µ RL(t)

Membership Value µ T(t)


S RS N RL L µN (t)
1
t t
4 8 12 16 20 24
µ RL(t)
4 8 12 16 20 24
15
Step 1: Find Slope (m) Step 1: Find Slope (m)
15

= (1-0)/(12-16) = -0.25 = (1-0)/(16-12) = 0.25


µ N(t) Step 2: Find c = y – mx Step 2: Find c = y – mx
= 0 – (-0.25)(16) = 4 = 0 – (0.25)(12) = -3
4 8 12 16 20 24
t Step 3: μN = mx + b Step 3: μN = mx + b
= (-0.25)(15) + 4 = 0.25 = (0.25)(15) + (-3) = 0.75
17 18
15

Fuzzy Set Intersections Fuzzy Inference Engine


 The average time of selling all soft drink to customer is 15 hours  To convert the input fuzzy set into an output fuzzy
indicates that it has a membership values of (μN) 0.25 to Normal
and (μRL) 0.75 to Relatively Long set through an inference process
 The Inference process includes:
Membership Value µ T (t) Rule block formation
1
S RS N RL L
Rule composition
µ RL(t)
μRL (t)=0.75 Rule firing
Implication
Aggregation
µ N(t)
μN (t)=0.25

t
4 8 12 16 20 24
15
19 20
Defuzzification
Application Example: Soft Drink
Replenishment in Convenience Store Chains
 In convenience store chains, needed items of goods have to
 Final stage in the fuzzy system be supplied to the stores in a timely manner
 Crisp values or linguistic values can be obtained through  The fluctuation of the soft drink sales can be fairly significant
the process of defuzzification.  In certain cases, the stores can be completely sold out within 12 hours
 Means that the shelves are totally empty in the next 12 hours of the day,
 The crisp value is commonly used in various industrial and this situation may cause discontent among customers
and control systems where only exact numerical values  On the other hand, items unsold within a 24 hours period will remain on
are needed during actual control operations the shelves, resulting in the occupation of precious space in the stores
 The store manager needs to maximize the utilization
 Normally, the most suitable method is used subject to of the limited space of the store so as to be more
the conditions of operation. Center of area is the cost-effective
most commonly used techniques due to their simplicity  Data for three days’ sales are selected for the study
and ease of use  Three kinds of input data and one value of output data
were selected as the input and output of the fuzzy system
21 22

Input and Output Data Input Fuzzy Sets (1)


Input and output of the fuzzy system via the fuzzy inference engine:
 Input 1: Average time for the
complete sell-out of coca-cola
after replenishment per day.
 T is the fuzzy set, ti is an
element in the data set, μT(ti) is
the membership function and
T = {S, RS, N, RL, L}
 Input data: If – then Rule
 Where S is short, RS is
 The average time for a complete sell-out of coca-cola after relatively short, N is normal, RL
replenishment per day (T)
is relatively long and L is long
 The average number of customers engaged in purchasing coca-cola per
day (C) 4 8 16 20
 The average quantity of coca-cola sold per day (P) Average time (Hour)
 Output data:
 Inventory change (IC): Range from -100% to 100%, indicate the
percentage change of the inventory size 23 24
Input Fuzzy Sets (2) Input Fuzzy Sets (3)
 Input 2: Average number of  Input 3: Average quantity of
customers engaged in coca-cola sold per day.
purchasing coca-cola per day.
 P is the fuzzy set, p1 is an
 C is the fuzzy set, ci is an element in the set, μP(pi) is the
element in the data set, μC(ci) is membership function and
the membership function and
P = {S, RS, N, RL, L}
C = {F, RF, N, RM, M}
 Where S is small, RS is
 Where F is few, RF is relatively relatively small, N is normal,
few, N is normal, RM is relatively RL is relatively large and L is
many and M is many. large.
14 28 56 70
14 28 56 70
No. of Cans
No. of Customers

25 26

Output Fuzzy Sets: Inventory


Change
Input Data for Evaluations
 IC is the fuzzy set, ic, is an  3 inputs are chosen for evaluating the timely demand of
element in the set, μIC(ici) is specified items
the membership function and
 The statistical data for these three inputs were worked out
the expression is
based on the information shown in the table below.
IC = {SuD, SiD, SlD, NC, SlI,
SiI, SuI} Day 1 Day 2 Day 3 Average

 Where SuD is substantially T (hr) 24* 4.5 24* 17.5


decreased, SiD is significantly C (people) 27 53 10 30
decrease, SlD is slightly
decreased, NC is no change, P (can) 48 84 18 50
SlI is slightly increased, SiI is -75 -25 0 25 75 24* indicates that the coca-cola cannot be sold out within 24 hours
significantly increased and SuI

Output Data: Inventory Change = ?


Inventory Change
is substantially increased

27 28
Membership Functions (1) Membership Function of μT
 Calculate the membership value of t = 17.5, the crisp
 According to the situation analysis, the universe of value intersects with the predicates function of RL and L
discourse for
and the resultant membership values are
a) t in fuzzy set T is 0 – 24 hours
μ17.5 = μL(t)|t=17.5 = 0.375
b) p in fuzzy set P is 0 – 84 cans as there are seven
dozen in an order and μ17.5 = μRL(t)|t=17.5 = 0.625
c) c in fuzzy set C is 0 – 84 customers (assuming every
customer buys only one can of soft drink)
 The three day’s sales information shown in the 0.625

previous table is used to evaluate the average values


for the crisp input data in the different fuzzy sets so as
to determine the membership values
0.375

29 4 8 16 20 30
Average time (Hour)

Membership Function of μC Membership Function of μP


 Calculate the membership  Calculate the membership
value of c = 30, the crisp value of p = 50, the crisp
value intersects with the value intersects with the
predicates function of RF and predicates function of RL and
N and the resultant N and the resultant
membership values are membership values are
μ30 = μRF(c)|c=30 = 0.71 μ50 = μN(p)|p=50 = 0.43
μ30 = μN(c)|c=30 = 0.29 μ50 = μRL(p)|p=50 = 0.57

14 28 56 70 84 p
14 28 56 70
No. of Cans
No. of Customers

31 32
Rule Tables (Blocks) of the Fuzzy
Rules Composition System
Average Time (T)
 Rules can be displayed in table format which can easily Average Number
be searched of Customer (C) RL

 Rule tables including three input dimensions are shown


S RS N RL L
Average
in the next slide
F X SiD SlD SlD NC
Quantity (Q)
RF X SlD SlD NC NC
 The indicator is able to pinpoint the position of the N X SlD NC NC SlI
associated three dimensions. RM X NC NC SlI SlI
M X NC SlI SlI SiI
Average Time (T)
Average Quantity (P) L
Average S RS N RL L
Number of F SuD SiD SiD SlD SlD
Customer Inventory Change (IC) RF SiD SiD SlD SlD NC
(C) N SiD SlD SlD NC NC
RM SlD SlD NC NC SlI
33
M SlI NC NC SlI SlI 34

Rule Firing (1) Rule Firing (2)


 Assume there are only eight successful fired rules, these are:
Rule 4
IF Average time IS long AND
Rule 1
Average number of customers IS normal AND
IF Average time IS relatively long AND
Average quantity IS normal
Average number of customers IS relatively few AND
THEN Inventory change IS slightly decreased
Average quantity IS normal
THEN Inventory change IS slightly decreased
Rule 5
Rule 2 IF Average time IS relatively long AND
IF Average time IS long AND Average number of customers IS relatively few AND
Average number of customers IS relatively few AND Average quantity IS relatively large
Average quantity IS normal THEN Inventory change IS no change
THEN Inventory change IS slightly decreased
Rule 6
Rule 3 IF Average time IS long AND
IF Average time IS relatively long AND Average number of customers IS relatively few AND
Average number of customers IS normal AND Average quantity IS relatively large
Average quantity IS normal THEN Inventory change IS slightly decreased
35 36
THEN Inventory change IS no change
Rule Firing (3) Implication (1)
 Refer to the IF-part of the rules above
Rule 7 Rule 1: IF Average time IS relatively long AND
Average number of customers IS relatively few
Get the Minimum
IF Average time IS relatively long AND
AND Average quantity IS normal value in 0.625,
Average number of customers IS normal AND
0.71 and 0.43
Average quantity IS relatively large 0.625

THEN Inventory change IS no change Rule Composition result


0.375 Rule 1 (0.625 ^ 0.71 ^ 0.43) = 0.43
Rule 8 Rule 2 (0.375 ^ 0.71 ^ 0.43) = 0.375
Rule 3 (0.625 ^ 0.29 ^ 0.43) = 0.29
4 8 16 20
IF Average time IS long AND
Average time (Hour)
Average number of customers IS normal AND Rule 4 (0.375 ^ 0.29 ^ 0.43) = 0.29
Average quantity IS relatively large
Rule 5 (0.625 ^ 0.71 ^ 0.57) = 0.57
THEN Inventory change IS no change
Rule 6 (0.375 ^ 0.71 ^ 0.57) = 0.375
Rule 7 (0.625 ^ 0.29 ^ 0.57) = 0.29 p
84
Rule 8 (0.375 ^ 0.29 ^ 0.57) = 0.29
14 28 56 70

No. of Cans
37 14 28 56 70
Note: ^ denotes the function of intersection 38
No. of Customers

Implication (2) Implication Results (1)


Inventory Change (IC)
 The eight results are then put into the implication process
which is used to determine the output fuzzy set. The result of
the rules is based on the following mathematical expression:
 μ(x,y) = f[μA(x), μB(y)] = μA(x) ^ μB(y)
where the implicator operator is denoted by f, the input
membership function by μA(x), the output membership
function by μB(y) and the intersection function by ^. The
implication results are shown in the next few slides.

-100% -75 -50 -25 25 50 75 100% -100% -75 -50 -25 25 50 75 100%
0.375
Rule 1 Rule 2
Inventory change IS slightly decreased Inventory change IS slightly decreased

39 40
Implication Results (2) Implication Results (3)
Inventory Change (IC) Inventory Change (IC)

50 50
-100% -75 -50 -25 25 75 100% -100% -75 -50 -25 25 75 100%
-100% -75 -50 25 50 75 100% 0.375
-100% -75 -50 -25 25 50 75 100% -25

Rule 5 Rule 6
Rule 3 Rule 4
Inventory change IS no change Inventory change IS slightly decreased
Inventory change IS no change Inventory change IS slightly decreased

41 42

Implication Results (4) The Aggregation Output


Inventory Change (IC)
Rule 7 & Rule 8 (The same implication result is obtained)  The eight results are fused for aggregation by using the
aggregation operator to generate the final fuzzy set

-100% -75 -50 -25 25 50 75 100%


-75 -25 25 75

Inventory change IS no change


43 44
Calculated Results of Each
Defuzzificaion Polygon (Rule)
 To determine the crisp value, a defuzzication
process is required Polygon Area (A)
Center of
Weight (w) A*C*w A*w
gravity (C)
 The method of center of area is selected. The
Rule 1 16.89 – 25 1 – 422.25 16.89
general equation is


Rule 2 15.39 – 25 1 – 384.75 15.39

w j C j Aj
N
Rule 3 12.40 0 1 0 12.40
Y
Inventory


j 1
Rule 4 12.40 – 25 1 – 310 12.40
Change
w j Aj
N
Rule 5 20.38 0 1 0 20.38
j 1
Rule 6 15.39 – 25 1 – 384.75 15.39
 w, C and A denote the weight, center of gravity and Rule 7 12.40 0 1 0 12.40
area respectively for each individual implication Rule 8 12.40 0 1 0 12.40
result Sum: -1501.75 117.65
45 46

Calculated Results References


 The preliminary calculated
results are:
 After the process, the  Dhar, V., & Stein, R. (1997). Intelligent decision support
center of area is – 12.76% methods : The science of knowledge work. Upper
 wCA  1501.75
Rule 8
 The store manager should Saddle River, N.J.: Prentice Hall.
Rule1 decrease the inventory size
 Lee, C.K.H., Choy, K.L., Ho, G.T.S, & Lin, C. (2016).
 w A  117.65
Rule 8 by 12.76% for the next
order of coca-cola. A cloud-based responsive replenishment system in
a franchise business model using a fuzzy logic
Rule1

 Therefore, the defuzzification


result is approach. Expert Systems, 33(1), 14-29.

 w j C j Aj  Kacprzyk, J. (1997). Multistage fuzzy control : A


N

 12.76

model-based approach to fuzzy control and decision
j 1

w j Aj
N
j 1
making. Chichester ; New York: Wiley.
47 48

You might also like