Resource Allocation with Fuzzy Logic

Armin Shmilovici
Ben-Gurion University, Israel
[email protected]
Credits for some slides
 S.Natarajan, Fuzzy Decision Making
 J.-S.R. Jang, Neuro-Fuzzy and Soft Computing
 M. Casey, Lectures on Artificial Intelligence –
CS364
Fuzzy Vs. Probability
Walking in the desert, close to being dehydrated, you
find two sealed bottles:
The first labeled water - 95% probability
The second labeled water - 0.95% similarity
Which one will you choose to drink from???
3
Uncertainty
 Information can be incomplete inconsistent, uncertain, or
all three.
 Uncertainty is defined as the lack of the exact knowledge
that would enable us to reach a perfectly reliable
conclusion.
 Some Sources of Uncertain Knowledge:
 Weak implications
 Imprecise language. Our natural language is ambiguous
and imprecise.
 Unknown data. When the data is incomplete or missing
 views of different experts.
Definition
 Many decision-making and problem-solving tasks are too
complex to be understood quantitatively, however, people
succeed by using knowledge that is imprecise rather
than precise.
 Fuzzy set theory resembles human reasoning in its use of
approximate information and uncertainty to generate
decisions.
 It was specifically designed to mathematically represent
uncertainty and vagueness and provide formalized tools for
dealing with the imprecision intrinsic to many problems.
More Definitions
 Fuzzy logic is a set of mathematical principles for knowledge
representation based on degrees of membership.
 Unlike two-valued Boolean logic, fuzzy logic is multi-valued. It deals
with degrees of membership and degrees of truth.
 Fuzzy logic uses the continuum of logical values between 0 (completely
false) and 1 (completely true). Instead of just black and white, it
employs the spectrum of colours, accepting that things can be partly
true and partly false at the same time.
0
0
0 1
1
(a) Boolean Logic.
1
0 0
0.2
0.4
0.6
0.8
1 1
(b) Multi-valued Logic.
Crisp Vs Fuzzy Sets
The x-axis represents the
Degree of
universe of discourse
– the
Membership
range of all possible 1.0
values
0.8
applicable to a chosen
variable.
0.6
In our case, the variable
is the
0.4
man height. According
to this
0.2
representation, the universe
of
0.0
men’s heights consists 150
of all 160
tall
Degree of
men.
Membership
Crisp Sets
Tall Men
170
180
190
200
210
Height, cm
Fuzzy Sets
1.0
The y-axis represents0.8the
membership value of
0.6 the fuzzy
set. In our case, the 0.4
fuzzy set of
0.2 values
“tall men” maps height
0.0
into corresponding membership
150
160
values.
170
180
190
200
210
Height, cm
A Fuzzy Set has Fuzzy Boundaries
 In the fuzzy theory, fuzzy set A of universe X is defined by function
µA(x) called the membership function of set A
µA(x) : X  {0, 1}, where
µA(x) = 1 if x is totally in A;
µA(x) = 0 if x is not in A;
0 < µA(x) < 1 if x is partly in A.
This set allows a continuum of possible choices. For any element x of
universe X, membership function µA(x) equals the degree to which x is
an element of set A. This degree, a value between 0 and 1, represents
the degree of membership, also called membership value, of
element x in set A.
Fuzzy Set Representation
 First, we determine the membership functions. In our “tall
men” example, we can obtain fuzzy sets of tall, short and
average men.
 The universe of discourse – the men’s heights – consists of
three sets: short, average and tall men. As you will see, a
man who is 184 cm tall is a member of the average men set
with a degree of membership of 0.1, and at the same time,
he is also a member of the tall men set with a degree of 0.4.
(see graph on next page)
Fuzzy Set Representation
Degree of
Membership
1.0
Crisp Sets
Short
0.8
Average
Short
Tall
Tall Men
0.6
0.4
0.2
0.0
150
160
170
180
190
200
210
Height, cm
Degree of
Membership
1.0
Fuzzy Sets
0.8
Short
0.6
Tall
Average
0.4
Tall
0.2
0.0
150
160
170
180
190
200
210
Fuzzy Sets
 Formal definition:
A fuzzy set A in X is expressed as a set of ordered pairs:
A  {( x ,  A ( x ))| x  X }
Fuzzy set
Membership
function
(MF)
Universe or
universe of discourse
A fuzzy set is totally characterized by a
membership function (MF).
‫תשע"ז‬/‫אב‬/'‫ו‬
11
Fuzzy
Sets
Discrete
 Fuzzy
setwith
C = “desirable
city toUniverses
live in”
X = {SF, Boston, LA} (discrete and nonordered)
C = {(SF, 0.9), (Boston, 0.8), (LA, 0.6)}
 Fuzzy set A = “sensible number of children”
X = {0, 1, 2, 3, 4, 5, 6} (discrete universe)
A = {(0, .1), (1, .3), (2, .7), (3, 1), (4, .6), (5, .2), (6, .1)}
‫תשע"ז‬/‫אב‬/'‫ו‬
12
Fuzzy Sets with Cont. Universes
 Fuzzy set B = “about 50 years old”
X = Set of positive real numbers (continuous)
B = {(x, mB(x)) | x in X}
B(x) 
‫תשע"ז‬/‫אב‬/'‫ו‬
1
 x  50 
1 

 10 
2
13
Alternative Notation
 A fuzzy set A can be alternatively denoted as follows:
X is discrete
X is continuous
A

A
( xi ) / xi
xi X
A    A( x) / x
X
Note that S and integral signs stand for the union of
membership grades; “/” stands for a marker and does
not imply division.
‫תשע"ז‬/‫אב‬/'‫ו‬
14
Fuzzy Partition
 Fuzzy partitions formed by the linguistic values
“young”, “middle aged”, and “old”:
lingmf.m
‫תשע"ז‬/‫אב‬/'‫ו‬
15
Linguistic Variables and Hedges
 The range of possible values of a linguistic variable
represents the universe of discourse of that variable. For
example, the universe of discourse of the linguistic variable
speed might have the range between 0 and 220 km/h and
may include such fuzzy subsets as very slow, slow, medium,
fast, and very fast.
 A linguistic variable carries with it the concept of fuzzy set
qualifiers, called hedges.
 Hedges are terms that modify the shape of fuzzy sets. They
include adverbs such as very, somewhat, quite, more or less
and slightly.
Linguistic Variables and Hedges
Degree of
Membership
1.0
Short
0.8
Short
Tall
Average
0.6
0.4
0.2
Very Short
Very
VeryTall
Tall
Tall
0.0
150
160
170
180
190
200
210
Height, cm
Linguistic Variables and Hedges
Hedge
Mathematical
Expression
A little
[A ( x )]1.3
Slightly
[A ( x )]1.7
Very
[A ( x )]2
Extremely
[A ( x )]3
Graphical Representation
Operations on Fuzzy Sets
(x)
(x)
B
1
1
A
A
0
x
1
0
B
1
A
Not A
0
Complement
x
(x)
1
0
Containment
x
(x)
A
1
B
0
1
x
x
AB
A
B
0
x
1
AB
0
Intersection
x
0
Union
x
Note: Membership Functions
 For the sake of convenience, usually a fuzzy set is denoted
as:
A = A(xi)/xi + …………. + A(xn)/xn
where A(xi)/xi (a singleton) is a pair “grade of
membership” element, that belongs to a finite universe of
discourse:
A = {x1, x2, .., xn}
Basic definitions & Terminology
 Support(A) = {x  X | A(x) > 0}
 Core(A) = {x  X | A(x) = 1}
 Normality: core(A)    A is a normal fuzzy set
 Crossover(A) = {x  X | A(x) = 0.5}
  - cut: A = {x  X | A(x)  }
 Strong  - cut: A’ = {x  X | A(x) > }
‫תשע"ז‬/‫אב‬/'‫ו‬
21
Set-Theoretic Operations
 Subset:
A  B  A  B
 Complement:
A  X  A  A ( x )  1  A ( x )
 Union:
C  A  B  c ( x )  max( A ( x ), B ( x ))  A ( x ) B ( x )
 Intersection:
C  A  B  c ( x )  min( A ( x ), B ( x ))  A ( x ) B ( x )
‫תשע"ז‬/‫אב‬/'‫ו‬
22
Set-Theoretic Operations
subset.m
‫תשע"ז‬/‫אב‬/'‫ו‬
fuzsetop.m
23
MF Formulation

x a c  x 
,
 , 0
b a c b 
 Triangular MF:
trimf ( x ; a , b , c )  max min
Trapezoidal MF:

d  x 
 x a
trapmf ( x ; a , b , c , d )  max min
, 1,
 , 0
b a
d c  

Gaussian MF:

gaussmf ( x ; a , b , c )  e
Generalized bell MF:
‫תשע"ז‬/‫אב‬/'‫ו‬
gbellmf ( x ; a , b , c ) 
1  x c 
 

2  
2
1
x c
1
b
2b
24
MF Formulation
disp_mf.m
‫תשע"ז‬/‫אב‬/'‫ו‬
25
Equality
 Fuzzy set A is considered equal to a fuzzy set B, IF AND
ONLY IF (iff ):
A(x) = B(x), xX
A = 0.3/1 + 0.5/2 + 1/3
B = 0.3/1 + 0.5/2 + 1/3
therefore A = B
Inclusion
 Inclusion of one fuzzy set into another fuzzy set. Fuzzy set
A  X is included in (is a subset of) another fuzzy set, B 
X:
A(x)  B(x), xX
Consider X = {1, 2, 3} and sets A and B
A = 0.3/1 + 0.5/2 + 1/3;
B = 0.5/1 + 0.55/2 + 1/3
then A is a subset of B, or A  B
Cardinality
 Cardinality of a non-fuzzy set, Z, is the number of elements in Z. BUT
the cardinality of a fuzzy set A, the so-called SIGMA COUNT, is
expressed as a SUM of the values of the membership function of A,
A(x):
cardA = A(x1) + A(x2) + … A(xn) = ΣA(xi),
for i=1..n
Consider X = {1, 2, 3} and sets A and B
A = 0.3/1 + 0.5/2 + 1/3;
B = 0.5/1 + 0.55/2 + 1/3
cardA = 1.8
cardB = 2.05
Empty Fuzzy Set
 A fuzzy set A is empty, IF AND ONLY IF:
A(x) = 0, xX
Consider X = {1, 2, 3} and set A
A = 0/1 + 0/2 + 0/3
then A is empty
Alpha-cut
 An -cut or -level set of a fuzzy set A  X is an ORDINARY SET A 
X, such that:
A={A(x), xX}.
Consider X = {1, 2, 3} and set A
A = 0.3/1 + 0.5/2 + 1/3
then A0.5 = {2, 3},
A0.1 = {1, 2, 3},
A1 = {3}
Normalized Fuzzy Sets
 A fuzzy subset of X is called normal if there exists at least one element
xX such that A(x) = 1.
 A fuzzy subset that is not normal is called subnormal.
 All crisp subsets except for the null set are normal. In fuzzy set theory,
the concept of nullness essentially generalises to subnormality.
 The height of a fuzzy subset A is the large membership grade of an
element in A
height(A) = maxx(A(x))
Fuzzy Sets Core and Support
 Assume A is a fuzzy subset of X:
 the support of A is the crisp subset of X consisting of all
elements with membership grade:
supp(A) = {x A(x)  0 and xX}
 the core of A is the crisp subset of X consisting of all
elements with membership grade:
core(A) = {x A(x) = 1 and xX}
Fuzzy Set Math Operations
 aA = {aA(x), xX}
Let a =0.5, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
Aa = {0.25/a, 0.15/b, 0.1/c, 0.5/d}
 Aa = {A(x)a, xX}
Let a =2, and
A = {0.5/a, 0.3/b, 0.2/c, 1/d}
then
Aa = {0.25/a, 0.09/b, 0.04/c, 1/d}
 …
Classical Decision Making
 Alternative actions {drill/not drill}
 Alternative states of nature {oil in ground}
 Relations between action/state/outcome
 Utility or objective function(s)
 Weakness:
 Assume utility is known and accurate
 Assume relations are known and accurate
 Assumptions not correct ->solution not accurate!
Fuzzy Logic
Simulating the process of human reasoning
 framework to computing with words and
perception, using linguistics variables.
 Deals with uncertainties
 Dreative decision-making process
35
Fuzzy Decision Making
 A model for decision making in a fuzzy environment.
 Object function and constraints are characterized as
their membership functions.
 The intersection of fuzzy constraints and fuzzy
objection function.
36
Example
Objective function:
x should be larger than 10
Constraint:
x should be in the vicinity
of 11
37
Fuzzy decision-making method
The method consists of three main steps:
Representation
of the decision problem
Fuzzy set evaluation
of the decision alternatives
Different classical decision-making
Selection of the
optimal alternative
38
Fuzzy Decision-Solution
39
Example-Job Selection
 Choose one of four alternative job offers {a1,a2,a3,a4}
 Following criteria
 High Salary (G1)
 Interesting Job (C1/G2)
 Close driving time (C2)
 Salaries in Eu {40k,45k,50k,60k}
 Time in minutes {42, 12, 18, 4}
Job
Selection – Cont.
 Fuzzify the goals and constraints according to your personal









utility functions. For example, for a linear salary utility function
(membership function) such as 37K is a 0.0 membership in
“High Salary”, and 64k is a 1.0 membership in “High Salary”,then
G1=0.11/a1+0.3/a2+0.48/a3+0.8/a4
C1 is fuzzy by its nature, for example
C1=0.4/a1+0.6/a2+0.2/a3+0.2/a4
For a linear driving time utility function (membership function)
such as 8 minutes is a 0.0 membership in “Close driving time ”,
and 50 minutes is a 1.0 membership in “Close driving time ”,then
C2=0.1/a1+0.9/a2+0.7/a3+1.0/a4
Find D by minimizing across alternatives
D=0.1/a1+0.3/a2+0.2/a3+0.2/a4
Choose alternative which maximize D -> a2
Note that a2 is the best, but its not good (only 0.2)
MULTIOBJECTIVE DECISION MAKING
 Most simple decision processes are based on a
single objective, such as minimizing cost,
maximizing profit, minimizing run time, and so
forth. Often, however, decisions must be made in
an environment where more than one objective
function governs constraints on the problem, and
the relative value of each of these objectives is
different.
 For example, we are designing a new computer,
and we want simultaneously to minimize the cost,
maximize CPU, maximize Random Access
Memory (RAM), and maximize reliability.
42
Multi-objective Decision Making
A = {a1,a2,…,an}: set of alternatives
O = {o1,o2,…,or}: set of objectives
The degree of membership of alternative a in Oj is given
below.
Decision function: D  O1  O2  ...  Or
O a   min O a ,..., O a 
1
r
The optimum decision a*
 D a*   max  D a 
aA
43
 bi is a parameter measuring how important is the
objective to a decision maker for a given decision
 D = M(O1,b1) ∩ M(O2,b2) ∩ .. ∩ M(Or,br)
 This function is represented as the intersection of r
tuples of a decision measure, M(Oi,bi), involving
the objectives and preferences,
 The classical implication satisfies the
requirements. Of preserving the linear ordering
the preference set, and at the same time relates the
two quantities in a logical way where negation is
also accommodated.
 The decision measure for a particular alternative,
a, can be replaced with a classical implication of
the form M(Oi(ai), bi) = bi --> Oi(a) = b¯i V Oi(a)
44
Multi-objective Decision Making
Define a set of preferences {P}
Parameter bi is contained on set {P}
D  M O1 , b1   M O2 , b2   ...  M Or , br 
  M Oi , bi 
M Oi a , bi   bi  Oi a 
 bi  Oi a 
'


D   bi  Oi a 
Let
'
Ci  bi  Oi
'


 C a   max  b a ,  O a 
i
'
i
i
Hence,
 D a *   max min  C a ,  C a ,...,  C a 
a A
1
2
r
45
 EXAMPLE – Multi-Objective Decision
 A construction engineer on a construction project
must retain the mass of soil form sliding into a
building site. Alternatives :
MSE - mechanically stabilized embankment
Conc - a mass concrete spread wall
Gab -a gabion wall
 Four objectives that impact his decision:
Cost
C
Maintainability M
Standard
S
Environment E
A = { MSE, Conc, Gab} = {a1, a2, a3}
O = {C, M, S, E} = {O1, O2, O3, O4}
P = {b1, b2, b3, b4}
[0,1]
46
O1 = { 0.4/MSE + 1/Conc + 0.1/Gab }
O2 = { 0.7/MSE + .8/Conc + 0.4/Gab}
O3 = {0.2/MSE + .4/Conc + 1/Gab }
O4 = {1/MSE + 0.5/Conc + 0.5/Gab }
1
.5
0
Mse conc
Gab
O1 O2
O3
O4
47
48
49
Multiple-Choice Multiple-Criteria
A  Ai i  1,2,..., n
C  Ct t  1,2,..., k
50
Example – Cooling an nuclear Reactor
(Step1:representation of decision problem)
Decision Alternatives A ={A1,A2,A3}
A1: flooding the reactor cavity)
A2 :depressurizing the primary system
A3 :doing nothing
Decision Criteria C={C1,C2,C3,C4,C5}
C1:feasibility of the strategy
C3:possibility of adverse effects
C2:effectiveness of the strategy
C4:amount of information needs
C5:compatibility with existing procedures
51
Step1:representation of decision problem(Cont.)
C1
C2
C3
C4
C5
A1
A2
A3
52
Step1:representation of decision problem (Cont.)
C1
C2
A1
C3
C4
A2
C5
A
3
Hierarchical structure of an example problem
53
Fuzzy set evaluation of decision alternatives
The step consist of three activities
(1) Choosing sets of the preference ratings for the
importance weights of the decision
Preference ratings include Linguistic variable and
triangular fuzzy number
Example:The preference ratings for the importance
weights of the decision criteria can be defined as
follows:T importance={very low, low, medium,
high,very high}
54
Fuzzy set evaluation of decision
alternatives(Cont.)
The triangular fuzzy numbers are used as membership
functions corresponding to the elements in term set
Where a,b and c are real numbers and a ≦ b ≦ c
55
Linguistic variable and triangular fuzzy number
1
VL
0
L
M
H
0.25
0.5
0.75
VH
1
56
Fuzzy set evaluation of decision alternatives
Choosing sets of the preference ratings for the
importance weights of the decision
57
Fuzzy set evaluation of decision
alternatives(Cont.)
(2) Evaluating the importance weights of the criteria and
the degrees of appropriateness of the decision
alternatives
(3) Aggregating the weights of the decision criteria
58
Fuzzy set evaluation of decision
alternatives(Cont.)
Substituting Sit and Wt with triangular fuzzy numbers, that
is, Sit = (oit, pit, qit) and Wt =(at, bt, ct), Fi is approximated as
where
For i =1,2,…,n and t = 1,2,..,k
59
Evaluating and Aggregating
0.2375
0.5375
0.8625
0.2125
0.5
0.7625
0.275
0.5625
0.8
60
Selection of the optimal alternative
This step includes two activities
 Prioritization of the decision alternatives using the
aggregated assessments
 Choice of the decision alternative with highest
priority as the optimal
61
Selection of the optimal
alternative(Cont.)
The total integral value method
Let the total integral value for triangular fuzzy number
F=(a, b, c)
α
α = index, the degree of optimism of the decision-maker
0≦ α ≦ 1
Larger Fi means the higher appropriateness of the decision
alternative
62
Selection of the optimal alternative
0.54375 (2)
0.3875 (2)
0.7 (1)
0.49375 (3)
0.35625 (3)
0.63125 (3)
0.55 (1)
0.41875 (1)
0.68125 (2)
If α =0 then A3 is Best!
If α =0.5 then A3 is Best!
If α =1.0 then A1 is Best!
63
64
Fuzzy
 y1 = 5Ordering, y2 = 2 , y1 >= contd
y2, usually no ambiguity in the ranking, so we have
CRISP ordering
 Situations where issues or actions are associated with uncertainty,
random or fuzzy , ranking is necessary
 Uncertainty in rank is random – we can use pdf ( probability density
function), use Gaussian normal function involving standard deviation
and solve
 Plot of pdf function is there in the previous slide
 Example of uncertain ranking – x1 height of Italians and x2 is the height
of Swedes
 Are Swedes taller than Italians ? Assign membership function µ1 for
Swedes and membership function µ2 for Italians.
65
Fuzzy Ordering
66
67
Fuzzy Expert Systems
 Used to capture human procedural knowledge in the
form of linguistic variable
 Fuzzy rules: If oven’s temperature=HIGH then cooking
time=SHORT
 A fuzzy expert system can chain rules together via the
process of inferencing.
 Many successful application, especially for control of
nonlinear systems.
Fuzzy
Reasoning
 Single
rule with multiple antecedent
Rule: if x is A and y is B then z is C
Fact: x is A’ and y is B’
Conclusion: z is C’
 Graphic Representation:
A’ A
B’ B
T-norm
C2
w
X
A’
x is A’
‫תשע"ז‬/‫אב‬/'‫ו‬
Y
B’
X
Z
y is B’
C’
Y
z is C’
Z
69