程序代写代做代考 ant algorithm CM3112 Artificial Intelligence

CM3112 Artificial Intelligence
Fuzzy logic:
Conjunctive model of approximate reasoning
Steven Schockaert
SchockaertS1@cardiff.ac.uk
School of Computer Science & Informatics Cardiff University

Implicative vs conjunctive model
The approach we have discussed so far is called the implicative model
Its intuition is based on logic
‣ rules are seen as constraints on possible values
‣ adding more rules means that fewer values will remain possible, leading to more precise results
There is a popular alternative which is called the conjunctive model
Its intuition is based on defining a function by a collection of “fuzzy patches” ‣ every rule corresponds to a “fuzzy patch”
‣ adding more rules means that more values become possible, leading to less precise results

Conjunctive model
if X is very low then Y is very low if X is low then Y is medium
if X is medium then Y is low if X is large then Y is large
if X is very large then Y is low
very low low
medium
large
very large

X
I(T (A2(x), C2(z)), D(u))⇥
i=1
is A then Y is B is then interpreted as y is B is A(x)-certain Conjunctive model
n
C⇥(z) = supmin(Su(x),Sv(y),minI(T(Ai(x),Bi(y)),Ci(z)))
if X is A and Y is B then Z is C 1n 1 i=11
… i=1
if X is An and Y is Bn then Z i⇤s Cn
X = u x,y Y= v
n
We only consider crisp inputs for the conjunctive model
i=1
= min(Su(u),Sv(v),minI(T(Ai(u),Bi(v)),Ci(z)))
if X is A and Y is B then Z is C 222
= minI(T(A (u),B (v)),C (z))
Z is C’
i=1 T-norm modeling
1 ifx=u 0 otherwise
iii
Su(x) =
n
C⇥ =maxT1(T2(Ai(u),Bi(v)),Ci(z))
T-norm modeling conjunctions in the antecedent
if-then rules
n
C⇥ =minI(T(Ai(u),Bi(v)),Ci(z))

Su(x) =
A rule if X is A then Y is B is then interpreted as y is B is A(x)-certain
Implicative vs conjunctive model
⇤I(B (y),C (z)), ⇥ 1 2ifx=2u
I0(T (oAth(exrw),iCse (z)), D(u)) 22
n
C⇥ =maxT1(T2(Ai(u),Bi(v)),Ci(z))
i=1
C⇥(z) = supmin(S (x),S (y),minI(T(A (x),B (y)),C (z)))
Implicative model
n
u v i=1 i i i
x,y
n ⇥n
C = minI(T(A (u),B (v)),C (z))
= min(S (u),S (v),minI(T(A (u),B (v)),C (z)))
ui=1v i iiii i i=1
n
‣ = min I(T (Ai(u), Bi(v)), Ci(z))
Rule modelled using an implicator I
i=1
‣Rules combined using the minimum
Conjunctive model
n
C⇥ =maxT1(T2(Ai(u),Bi(v)),Ci(z))
i=1
‣Rule modelled using a t-norm
to be possible
‣⇤
Rules are restrictions on the possible values
Su(x) =
51 ifx=u 0 otherwise
‣Rules combined usning the maximum
‣ C⇥ = minI(T(A (u),B (v)),C (z))
Rules express combinations of values which are asserted
i=1
iii

Fuzzy control: Mamdani inference
dirtiness greasiness
Mamdani inference
washing time
Measured by input sensors
Mamdani inference = conjunctive model using the minimum
Required control action

Fuzzy control: Mamdani inference
1
Low
Medium High
1
Very short
Short
Average
Very Long
25 50 75 100
25 50 75 100
Fuzzy sets for the output variable
Fuzzy sets for the input variables
Long

Fuzzy control: Mamdani inference
if Dirtiness is low and Greasiness is low
if Dirtiness is low and Greasiness is medium
if Dirtiness is low and Greasiness is high
if Dirtiness is medium and Greasiness is low
if Dirtiness is medium and Greasiness is medium then
if Dirtiness is medium and Greasiness is high if Dirtiness is high and Greasiness is low
if Dirtiness is high and Greasiness is medium if Dirtiness is high and Greasiness is high
Washing time is average then Washing time is long
then Washing time is average then Washing time is long
then Washing time is very long
Dirtiness = 75, Greasiness = 40
then Washing time is very short then Washing time is short then Washing time is long
then Washing time is short

Fuzzy control: Mamdani inference
if Dirtiness is low and Greasiness is low
if Dirtiness is low and Greasiness is medium
if Dirtiness is low and Greasiness is high
if Dirtiness is medium and Greasiness is low
if Dirtiness is medium and Greasiness is medium then
then Washing time is very short then Washing time is short then Washing time is long
then Washing time is short
if Dirtiness is medium and Greasiness is high if Dirtiness is high and Greasiness is low
if Dirtiness is high and Greasiness is medium if Dirtiness is high and Greasiness is high
Washing time is average then Washing time is long
then Washing time is average then Washing time is long
then Washing time is very long
Dirtiness: Low(75)=0 Medium(75)=0.5 High(75)=0.5 Greasiness: Low(40)=0.2 Medium(40)=0.8 High(40)=0

Fuzzy control: Mamdani inference
if Dirtiness is medium and Greasiness is low
if Dirtiness is medium and Greasiness is medium
if Dirtiness is high and Greasiness is low
if Dirtiness is high and Greasiness is medium
Activation levels
then Washing time is short then Washing time is average
then Washing time is average then Washing time is long
short: min(medium(75),low(40))=min(0.5,0.2)=0.2
average: max(min(medium(75),medium(40)), min(high(75),low(40)) =max(min(0.5,0.8),min(0.5,0.2)) = 0.5
long: min(high(75),medium(40))=min(0.5,0.8)=0.5

Fuzzy control: Mamdani inference
1
Very short Average
Very Long
Short
Long
Activation levels
25 50 75 100
short: min(medium(75),low(40))=min(0.5,0.2)=0.2
average: max(min(medium(75),medium(40)), min(high(75),low(40)) =max(min(0.5,0.8),min(0.5,0.2)) = 0.5
long: min(high(75),medium(40))=min(0.5,0.8)=0.5

Fuzzy control: Mamdani inference
1
Very short Average
Very Long
Short
Long
Activation levels
25 50 75 100
short: min(medium(75),low(40))=min(0.5,0.2)=0.2
average: max(min(medium(75),medium(40)), min(high(75),low(40)) =max(min(0.5,0.8),min(0.5,0.2)) = 0.5
long: min(high(75),medium(40))=min(0.5,0.8)=0.5

Fuzzy control: Mamdani inference
1
Very short Average
Very Long
Short
Long
Activation levels
25 50 75 100
short: min(medium(75),low(40))=min(0.5,0.2)=0.2
average: max(min(medium(75),medium(40)), min(high(75),low(40)) =max(min(0.5,0.8),min(0.5,0.2)) = 0.5
long: min(high(75),medium(40))=min(0.5,0.8)=0.5

Fuzzy control: Mamdani inference
1
Very short Average
Very Long
Short
Long
25 50 75 100
The final result is obtained after defuzzification of this fuzzy set

Mamdani inference: summary
Step 1: determine the activation levels of each of the output fuzzy sets
Step 2: cut off the output fuzzy sets at their activation level Step 3: take the union of the resulting fuzzy sets
Step 4: determine the output value by defuzzification

Obtaining the fuzzy rules
‣ Manually define the fuzzy sets and fuzzy rules
– Convenient when trying to implement an initial prototype – Requires careful tuning to obtain accurate results
‣ Manually define fuzzy sets, and learn rules from training data
– Use variants of any rule-based learner (e.g. based on genetic algorithms or ant colony
optimisation)
– Result often robust, and rules are guaranteed to be easily interpretable
‣ Manually define the rules, and use a machine learning technique to tweak the definitions of the fuzzy sets
– Often neural networks are used to adapt the fuzzy sets
– Resulting system is a combination of our intuition about the behaviour of a system, and an analysis of the training data
– Ideal when training data is too sparse to use more standard machine learning approaches