Lec2011 - 3 - AI - Fuzzy Logic

Embed Size (px)

Citation preview

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    1/108

    1

    159.320 FUZZY LOGICFUZZY LOGIC

    22

    Introduction, Inference System, Fuzzy Control

    System, Examples

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    2/108

    menu

    Fuzzy LogicFuzzy Logic

    • Introduction – What is Fuzzy Logic?

     – Applications of Fuzzy Logic – Classical Control System s! Fuzzy Control

    • "eeloping a Fuzzy Control System

    • #$amples• %heory of Fuzzy Sets

    • Fuzzy Inference Systems

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    3/108

    menu

    TopicsTopics

    • Introduction

    • &asic Algorithm

    • Control Systems

    • Sample Computations

    • Inerted 'endulum

    • Fuzzy Inference Systems – (amdani %ype

     – Sugeno %ype• Fuzzy Sets ) *perators

    • "efuzzification

    • (em+ership Functions

    Control Systems

    Inverted Pendulum

    Computations

    Sugeno

    amdani

    !asics

    Fuzzy Sets

    "efuzzification

    em# Fcns

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    4/108

    menu

    Fuzzy LogicFuzzy Logic

     A computational paradigm that is +ased on ho, humans thin-

    Fuzzy Logic loo-s at the ,orld in imprecise terms. in much the same ,ay

    that our +rain ta-es in information /e!g! temperature is hot. speed is slo,0.

    then responds ,ith precise actions!

    $%at is Fuzzy Logic&

    %he human +rain can reason ,ith uncertainties. agueness. and

     udgments! Computers can only manipulate precise aluations! Fuzzy logic

    is an attempt to com+ine the t,o techni2ues!

    3Fuzzy4 – a misnomer. has resulted in the mista-en suspicion that FL is

    someho, less e$acting than traditional logic

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    5/108

    menu

    Fuzzy LogicFuzzy Logic

    Fuzzy logic differs from classical logic in that statements are no longer

    +lac- or ,hite. true or false. on or off!In traditional logic an o+ect ta-es on a alue of either zero or one!

    In fuzzy logic. a statement can assume any real alue +et,een 5 and 1.

    representing the degree to ,hich an element +elongs to a gien set!

    $%at is Fuzzy Logic&

    It is a+le to simultaneously handle numerical data and linguistic

    -no,ledge!

     A techni2ue that facilitates the control of a complicated system ,ithout

    -no,ledge of its mathematical description!

    FL is in fact. a precise pro'lem(solving met%odologya precise pro'lem(solving met%odology!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    6/108

    menu

    Fuzzy LogicFuzzy Logic

    Professor Lotfi )# *ade%

    In +-.. Lotfi )# *ade% of the 6niersity of California at &er-eley pu+lished

    7Fuzzy Sets.7 ,hich laid out the mathematics of fuzzy set theory and. +y

    e$tension. fuzzy logic! 8adeh had o+sered that conentional computer logic

    couldn9t manipulate data that represented su+ectie or ague ideas. so he created

    fuzzy logic to allo, computers to determine the distinctions among data ,ith

    shades of gray. similar to the process of human reasoning!

    /istory of Fuzzy Logic

    Source0 )ugust 1, 23

    /Computer,orld0http:;;,,,!computer,orld!com;ne,s;

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    7/108menu

    Pioneering 4or5sPioneering 4or5s

    • Interest in fuzzy systems ,as spar-ed +y Sei6i  7asuno'u and So6i iyamoto of /itac%i. ,ho in +8. proided simulations thatdemonstrated the superiority of fuzzy control systems for the Sendairail4ay! %heir ideas ,ere adopted. and fuzzy systems ,ere used tocontrol accelerating and +ra-ing ,hen the line opened in +89!

    •  Also in +89. during an international meeting of fuzzy researchers in%o-yo. Ta5es%i 7ama5a4a demonstrated the use of fuzzy control.through a set of simple dedicated fuzzy logic chips. in an 7 invertedpendulum7 e$periment! %his is a classic control pro+lem. in ,hich aehicle tries to -eep a pole mounted on its top +y a hinge upright +ymoing +ac- and forth!

    • *+serers ,ere impressed ,ith this demonstration. as ,ell as latere$periments +y 7ama5a4a in ,hich he mounted a ,ine glasscontaining ,ater or een a lie mouse to the top of the pendulum!%he system maintained sta+ility in +oth cases! Bama-a,a eentually,ent on to organize his o,n fuzzysystems research la+ to help

    e$ploit his patents in the field!

    2 years after its conception

    http://en.wikipedia.org/wiki/Fuzzy_control_system

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    8/108

    eeting Lotfi in :ermanyeeting Lotfi in :ermany

    y Fuzzy Logic('ased;esearc%es

    • Do+ot Eaigation

     – Dealtime pathplanning/y+rid Fuzzy AG0

    • (achine Hision – Dealtime colouro+ect

    recognition

     – Colour correction

     – Fuzzy Colour ContrastFusion

     – Fuzzyenetic Colour

    Contrast Fusion

    th Fuzzy "ays /

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    9/108menu

    eeting Prof# 7ama5a4a in

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    10/108menu

    Fuzzy LogicFuzzy Logic

    Fuzzy Logic is one of the most tal-eda+out technologies to hit the em+edded

    control field in recent years! It has already transformed many product

    mar-ets in Mapan and orea. and has +egun to attract a ,idespread follo,ing

    In the 6nited States! Industry ,atchers predict that fuzzy technology is on its

    ,ay to +ecoming a multi+illiondollar +usiness!

    Introduction of FL in t%e Engineering 4orld =+>s?,

    Fuzzy Logic ena+les lo, cost microcontrollers to perform functions traditionally

    performed +y more po,erful e$pensie machines ena+ling lo,er cost products

    to e$ecute adanced features!

    Intel Corporation@s Em'edded icrocomputer "ivision Fuzzy Logic Aperation

    http:;;,,,!intel!com;design;mcsJ;designe$;

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    11/108

    Sample )pplicationsSample )pplications

    In t%e city of Sendai in

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    12/108

    Sample )pplicationsSample )pplications

    D)S) has studied fuzzy control for automated space

    doc5ing: simulations sho, that a fuzzy control system cangreatly reduce fuel consumption

    Canon deeloped an auto(focusing camera that uses a

    chargecoupled deice /CC"0 to measure the clarity of the

    image in si$ regions of its field of ie, and use the informationproided to determine if the image is in focus! It also trac-s the

    rate of change of lens moement during focusing. and controls

    its speed to preent oershoot!

    http:;;en!,i-ipedia!org;,i-i;FuzzyPsystem

    %he camera9s fuzzy control system uses +2 inputs: J to o+tain the current claritydata proided +y the CC" and J to measure the rate of change of lens moement!

    %he output is the position of the lens! %he fuzzy control system uses +1 rules and

    re2uires +#+ 5ilo'ytes of memory!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    13/108

    Sample )pplicationsSample )pplications

    /aier ESL(T2+ Top Load $as%er

    Miele WT94 Front !oad "ll#in#$ne Washer / %ryer 

     "&' !!()(* Front !oad Washer 

    +anussi +WF(4,*W Front !oad Washer 

    !' W%(4(-( Front !oad Washer 

    For 4as%ing mac%ines, Fuzzy Logic control is almost

    'ecoming a standard feature

    :E $P;!++$/ Top Load $as%er 

    *thers: Samsung. %oshi+a. Eational. (atsushita. etc!

    fuzzy controllers to load,eight. fa+ricmi$. and dirt sensors and automatically set the

    ,ash cycle for the +est use of po,er. ,ater. and detergent!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    14/108menu

    Control SystemsControl Systems

    • Conentional Control s! Fuzzy Control

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    15/108menu

    Control Systems in :eneralControl Systems in :eneral

    %he aim of any control system is to produce a set of

    desired outputs for a given set of inputs!

     A household thermostat ta-es a

    temperature input and sends a controlsignal to a furnace!

     A car engine controller responds to aria+les such as engine position.

    manifold pressure and cylinder temperature to regulate fuel flo, and

    spar- timing!

    Samples

    A'6ective

    Cran-shaft /red0. pistons /gray0 intheir cylinders /+lue0. and fly,heel

    /+lac-0

    Image0 %ttp0en#4i5ipedia#org4i5iCran5s%aft

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    16/108menu

    Conventional Control vs# FuzzyConventional Control vs# Fuzzy

    In the simplest case. a controller ta-es its cues from a loo-up ta+le. ,hich tells,hat output to produce for eery input or com+ination of inputs!

    %he ta+le might tell the controller.

    3IF temperature is 8., T/ED increase furnace fan speed to 1 ;P#4

    %he pro+lem ,ith the ta+ular approach is that the ta'le can get very longta'le can get very long.

    especially in situations ,here there are many inputs or outputs! And that. inturn. may reGuire more memory t%an t%e controller can %andlemay reGuire more memory t%an t%e controller can %andle. or more

    than is costeffectie!

    %a+ular control mechanisms may also gie a 'umpy, uneven response'umpy, uneven response. as the

    controller umps from one ta+le+ased alue to the ne$t!

    "ra4'ac5s

    Loo5(up ta'le

    Sample

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    17/108menu

    Conventional Control vs# FuzzyConventional Control vs# Fuzzy

    %he usual alternatie to loo-up ta+les is to hae the controller e$ecute a

    mathematical formula – a set of control eGuations t%at express t%e output

    as a function of t%e input!

    Ideally. these e2uations represent an accurate model of the system+ehaiour!

    For example:

    %he formulas can +e ery comple$. and ,or-ing them out in realtime may +e

    more than an afforda+le controller /or machine0 can manage!

    "o4nside

    at%ematical formula

    θ θ θ θ θ  sinsin)cos(cos)sin(2

    2

    2

    2

    mgl l l t 

    ml l  xt 

    m   =

    ∂−

    +

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    18/108menu

    Conventional Control vs# FuzzyConventional Control vs# Fuzzy

    It may +e difficult or impossi+le to derie a ,or-a+le mathematical model in the

    first place. ma-ing +oth ta+ular and formula+ased methods impractical!

    "o4nside of at%ematical modeling approac%

    %hough an automotie engineer might understand the general relationship

    +et,een say. ignition timing. air flo,. fuel mi$ and engine D'(. the e$act maththat underlies those interactions may +e completely o+scure!

    $%y use Fuzzy Logic&

    FL oercomes the disadantages of +oth ta+le+ased and formula+asedcontrol!

    Fuzzy has no un4ieldy memory reGuirementsno un4ieldy memory reGuirements of loo-up ta+les.

    and no %eavy num'er(crunc%ing demandsno %eavy num'er(crunc%ing demands of formula+ased solutions!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    19/108menu

    Conventional Control vs# FuzzyConventional Control vs# Fuzzy

    $%y use Fuzzy Logic&

    FL can ma-e deelopment and implementation much simpler!

    It needs no intricate mathematical models. only a practical understanding of the

    oerall system +ehaiour!

    FL mechanisms can result to %ig%er accuracy%ig%er accuracy and smoot%er controlsmoot%er control as ,ell!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    20/108menu

    Fuzzy Logic ExplainedFuzzy Logic ExplainedFuzzy Set T%eory

    Is a man ,hose height is @O 111;

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    21/108menu

    Fuzzy Logic ExplainedFuzzy Logic Explained

    Fuzzy Set T%eory

    Is a man ,hose height is @O 111;

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    22/108

    menu

    Fuzzy Inference ProcessFuzzy Inference Process

    • What are the steps inoled in creating a

    Fuzzy Control System?

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    23/108

    menu

    Fuzzy Inference ProcessFuzzy Inference Process

    Fuzzification ;ule

    Evaluation"efuzzification

    e!g! thetae!g! theta e!g! forcee!g! force

    Fuzzification0  %ranslate input into truth alues;ule Evaluation0  Compute output truth alues

    "efuzzification0  %ransfer truth alues into output

    Fuzzy Inference ProcessFuzzy Inference Process

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    24/108

    menu

    A'stacle )voidance Pro'lemA'stacle )voidance Pro'lem

    o'stacle

    /o+s$. o+sy0

    θ

    /$.y0

    Can you descri+e ho, the ro+ot

    should turn +ased on the position

    and angle of the o+stacle?

    ;o'ot Davigation

    "emonstration

    *+stacle Aoidance ) %arget 'ursuit

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    25/108

    Another example:Another example: Fuzzy Sets for Robot NavigationFuzzy Sets for Robot Navigation

     Angle and "istanceAngle and "istance

    Su' ranges for angles J distances overlapSu' ranges for angles J distances overlap**

    S)LL

    E"IB

    L);:E

    DE);

    F);

    KE;7 F);

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    26/108

    Fuzzy SystemsFuzzy Systems forfor A'stacle )voidanceA'stacle )voidance

     NEAR FAR VERY FAR

     SMALL Very Sharp Sharp Turn Med Turn

     MEDIUM  Sharp Turn Med Turn Mild Turn

     LARGE  Med Turn Mild Turn Zero Turn

    earest $stacle 0%istance and "ngle1

     NEAR FAR VERY FAR

     SMALL Very Slow Slow Speed Fast Fast

     MEDIUM  Slow Speed Fast Speed Very Fast

     LARGE  Fast Speed Very Fast Top Speed

    e#g# If  the Distance from the *+stacle is NEAR  and

    the Angle from the *+stacle is SMALL 

    T%en turn Very Sharply !

    Fuzzy System 1 =Steering?Fuzzy System 1 =Steering?

    Fuzzy System 3 =Speed )d6ustment?Fuzzy System 3 =Speed )d6ustment?

    e.g.  If  the Distance from the *+stacle is NEAR  and

    the Angle from the *+stacle is SMALL 

    T%en moe Very Slowly.

    Kision System

    )ngle)ngle

    SpeedSpeed

    http://var/www/apps/conversion/tmp/scratch_6/C:%5CCore%5CResearch%5CConferences%5C9th%20Fuzzy%20Days%202006%5CUnmanned%2030.7%20-%20Scaled%20+%20Waypoint%20-%20Dynamic%20Obstacles%20-%20NZ%5CUnmanned%2030.7%20-%20Scaled%20+%20Waypoint%20-%20Dynamic%20Obstacles%20-%20NZ%5CUnmanned.exe

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    27/108

    menu

    Fuzzy ControlFuzzy Control%i22erent stages o2 Fuzzy control %i22erent stages o2 Fuzzy control 

    Input aria+les are assigned degrees of mem+ership in arious classes

    +# Fuzzification

    e!g! A temperature input might +e graded according to its degree of coldness.

    coolness. ,armth or heat!

    $e 4ill see a complete$e 4ill see a complete

    example of t%e stepsexample of t%e steps

    involved later#involved later#

    %he purpose of fuzzificationfuzzification is to map t%e inputs from a set of sensors /or

    features of those sensors0 to values from  to ++ using a set of input

    mem+ership functions!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    28/108

    menu

    FuzzificationFuzzification

    5!5 5!@5!@ 1!51!5

    1!5

    5!5

    DE:)TIKEDE:)TIKE PASITIKEPASITIKE*E;A*E;A

    Fuzzy Sets Q R Eegatie. 8ero. 'ositie

    Fuzzi2ication &3ampleFuzzi2ication &3ample

    Crisp Input: x #2.x #2.$%at is t%e degree of$%at is t%e degree of

    mem'ers%ip of x in eac%mem'ers%ip of x in eac%

    of t%e Fuzzy Sets&of t%e Fuzzy Sets&

     Assuming that ,e are using trapezoidal mem+ership functions!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    29/108

    menu

    Sample CalculationsSample Calculationsx 0.25=

    ZE

    x a d xF (0.25) ax in !"! !0

     # a d c

    − −    =   ÷ ÷− −    

    0.25 ( ") " 0.25ax in !"! ! 0

    0.25 ( ") " 0.25

       − − −=   ÷ ÷− − − −    

    ( )( )ax in ".$%!"!" !0

    "

    =

    =

    &

    0.25 ( 0.5) ' 0.25F (0.25) ax in !"! ! 0

    0.5 ( 0.5) ' 0.25

       − − −=   ÷ ÷− − −    

    ( )( )ax in 0.%5!"!5.5 !0

    0.%5

    =

    =

     

    0.25 ( ') 0.5 0.25F (0.25) ax in !"! ! 0

    2.5 ( ') 0.5 ( 0.5)

       − − −=   ÷ ÷− − − − −    

    ( )( )ax in $.5!"!0.25 !0

    0.25

    =

    =

    Crisp Input:

     Fzero/5!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    30/108

    menu

    Sample CalculationsSample CalculationsCrisp Input:

     

    Fzero/5!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    31/108

    menu

    LeftTrapezoid

      LeftPSlope Q 5

      DightPSlope Q 1 ; /A &0

      CAS# 1: T U a

      (em+ership Halue Q 1

      CAS#

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    32/108

    menu

    Trapezoidal em'ers%ip FunctionsTrapezoidal em'ers%ip Functions

    ;ig%tTrapezoid

      LeftPSlope Q 1 ; /& A0

      DightPSlope Q 5

      CAS# 1: T UQ a

      (em+ership Halue Q 5

    CAS#

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    33/108

    menu

    Trapezoidal em'ers%ip FunctionsTrapezoidal em'ers%ip Functions

    ;egular Trapezoid

      LeftPSlope Q 1 ; /& A0

      DightPSlope Q 1 ; /C "0

      CAS# 1: T UQ a *r T VQ d  (em+ership Halue Q 5

    CAS#

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    34/108

    Inputs are applied to a set of  ift%en control rules!

    2# ;ule Evaluation

    e!g! IF temperature is ery hot. T/ED set fan speed ery high!

    Fuzzy ControlFuzzy Control%i22erent stages o2 Fuzzy control %i22erent stages o2 Fuzzy control 

    F C t lF C t l

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    35/108

    menu

    i2 (inpt! is mem"ership #nction!$ and/or (inpt% is mem"ership

    #nction%$ and/or &.

    then (otpt is otpt mem"ership #nction$.

    For e$ample. one could ma-e up a rule that says:

    i2 temperatre is high and hmi'ity is high then room is hot.

    Fuzzy rulesFuzzy rules are al4ays 4ritten in t%e follo4ing form0

    Fuzzy ControlFuzzy Control%i22erent stages o2 Fuzzy control %i22erent stages o2 Fuzzy control 

    F C t lF C t l

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    36/108

    Inputs are applied to a set of  ift%en control rules!

    2# ;ule Evaluation

    e!g! IF temperature is ery hot. T/ED set fan speed ery high!

    %he results of arious rules are smme' together  to generate a set of 3fuzzy

    outputs4!

    Fuzzy ControlFuzzy Control

      S S

     S ZE &S

    &S &S &

    %i22erent stages o2 Fuzzy control %i22erent stages o2 Fuzzy control 

    E 8# '

    E

    8#

    '

    F)F)

    *utputsELQ@

    ESQ

    8#Q5

    'SQ

    'LQ@!5

    W1 W4 W7

    W2 W5 W8

    W3 W6 W9

    x

    y

    F C t lF C t l

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    37/108

    menu

    Fuzzy ControlFuzzy Control

    [ ] [ ]

    [ ] [ ]

    [ ] [ ]

    [ ] [ ]

    [ ] [ ]

    "

    2 ZE

    ' &

    * ZE

    5 ZE ZE

    + in F (0.25)!F ( 0.25) in 0.25!0.%5 0.25

    + in F (0.25)!F ( 0.25) in 0.25!" 0.25

    + in F (0.25)!F ( 0.25) in 0.25!0.25 0.25

    + in F (0.25)!F ( 0.25) in "!0.%5 0.%5

    + in F (0.25)!F ( 0.25) in "!" "

    +

    = − = =

    = − = =

    = − = =

    = − = =

    = − = =

    [ ] [ ]

    [ ] [ ]

    [ ] [ ]

    [ ] [ ]

    $ ZE &

    % &

    , & ZE

    - & &

    in F (0.25)!F ( 0.25) in "!0.25 0.25

    + in F (0.25)!F ( 0.25) in 0.%5!0.%5 0.%5

    + in F (0.25)!F ( 0.25) in 0.%5!" 0.%5

    + in F (0.25)!F ( 0.25) in 0.%5!0.25 0.25

    = − = =

    = − = =

    = − = =

    = − = =

    ule &5aluation &3ampleule &5aluation &3ample

     Assuming that ,e are using the conunction operator /AE"0 in theantecedents of the rules. ,e calculate the rule firing strengt% $n!

      S S

     S ZE &S

    &S &S &

    E 8# '

    E

    8#

    '

    F)F)

    x

    y

    W1 W4 W7

    W2 W5 W8

    W3 W6 W9

    F C t lF C t l

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    38/108

    menu

    Fuzzy outputs are com+ined into discrete alues needed to drie the control

    mechanism

    $e 4ill see a complete$e 4ill see a complete

    example of t%e stepsexample of t%e steps

    involved later#involved later#

    1# "efuzzification

    /e!g! A cooling fan0

    Fuzzy ControlFuzzy Control%i22erent stages o2 Fuzzy control %i22erent stages o2 Fuzzy control 

    F C t lF C t l

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    39/108

    menu

    Fuzzy ControlFuzzy Control

    " 2 ' * 5 $ % , -

    -

    i

    i "

    (+ + S + &S + S + ZE + &S + S + &S + &)/T&/T

    +

    =

    × + × + × + × + × + × + × + × + ×=

    ( )

    ( )

    0.25 ( 5) 0.25 2.5 0.25 2.5 0.%5 2.5 " 0 0.25 2.5 0.%5 2.5 0.%5 2.5 0.25 5

    0.25 0.25 0.25 0.%5 " 0.25 0.%5 0.%5 0.25

    × − + × + × + × + × + × + × + × + ×=

    + + + + + + + +

    Q 1!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    40/108

    menu

    ExampleExample

    • LetOs loo- at the Inerted 'endulum

    'ro+lem

    S f StS f St

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    41/108

    menu

    Summary of StepsSummary of Steps

    1! determining a set of fuzzy rules

    N! com+ining the fuzzified inputs according to the fuzzy rules to esta+lish

    a rule strength.

    =! finding the conse2uence of the rule +y com+ining the rule strength andthe output mem+ership function /if itOs a mamdani FIS0.

    @! com+ining the conse2uences to get an output distri+ution. and

    J! defuzzifying the output distri+ution /this step applies only if a crisp

    output /class0 is needed0!

    To compute t%e output of t%is FIS given t%e inputs, one must go t%roug% six

    steps0

    I t d P d l P 'lI t d P d l P 'l

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    42/108

    menu

    Inverted Pendulum Pro'lemInverted Pendulum Pro'lem

     A pole ,ith a ,eight on top is mounted on a motordrien cart! %he pole

    can s,ing freely. and the cart must moe +ac- and forth to -eep it ertical!

     A controller monitors the angle and motion of the pole and directs the cartto e$ecute the necessary +alancing moements!

    ) Classic test case in em'edded control

    ) :limpse at /istory0  International Conference in %o-yo /1>K0 Ta5es%i 7ama5a4a 

    demonstrated the use of fuzzy control. through a set of simple dedicated fuzzy logic

    chips. in an 7inverted penduluminverted pendulum7 e$periment! /Later e$periments: mounted a ,ine

    glass containing ,ater or een a lie mouse to the top of the pendulum0!

    I t d P d l P 'lIn erted Pend l m Pro'lem

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    43/108

    Inverted Pendulum Pro'lemInverted Pendulum Pro'lem

    %he solution uses a secondorder differential e2uation thatdescri+es cart motion as a function of pole position and elocity:

    Conventional mat%ematical solution

    θ θ θ θ θ  sinsin)cos(cos)sin(2

    2

    2

    2

    mgl l l t 

    ml l  xt 

    m   =

    ∂∂

    +

    ∂∂

    I t d P d l P 'lInverted Pendulum Pro'lem

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    44/108

    menu

    Inverted Pendulum Pro'lemInverted Pendulum Pro'lem

    Sensed values0

    T – position of o+ect ,ith respect to the horizontal a$is

    θ  angle of pole relatie to the ertical a$is

    "erived values0

    TO Helocity along the $a$is

    θO Angular elocity

    Input varia'les0  sensed and deried alues

    Controller output0  FF – force to +e applied to the cart

    " i d I t K l"erived Input Kalues

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    45/108

    "erived Input Kalues"erived Input Kalues

    t%eta time t%eta@

    < 1

    15 < >

    N5 N

     A sample calculation of some of the deried Halues: angular

    elocity /thetaO0

    We can derie ne, input alues for our Fuzzy Control System

    using 'hysics e2uations!

    In erted Pend l m Pro'lemInverted Pendulum Pro'lem

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    46/108

    menu

    Inverted Pendulum Pro'lemInverted Pendulum Pro'lem

    origin

    Parameters for a Fuzzy SystemParameters for a Fuzzy System

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    47/108

    menu

    Parameters for a Fuzzy SystemParameters for a Fuzzy System

    1! specify the fuzzy sets to +e associated ,ith each aria+le!

    N! specify the shape of the mem+ership functions!

     Ance you %ave determined t%e appropriate inputsinputs andoutputsoutputs for your application, t%ere are t%ree steps to

    designing t%e parameters for a fuzzy system0

    Fuzzy SetsFuzzy Sets

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    48/108

    menu

    Fuzzy SetsFuzzy Sets

    We might +egin designing a fuzzy system +y su+diiding the t,o input

    aria+les /pole angle and angular elocity0 into mem+ership sets!

    %he angleangle could +e descri+ed as:

    1! Inclined to the Left /E0!

    N! Inclined to the Dight /'0!

    Fuzzy SetsFuzzy Sets

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    49/108

    menu

    Fuzzy SetsFuzzy Sets

    %he angular velocityangular velocity could +e descri+ed as:

    1! Falling to the Left /E0!

    N! Falling to the Dight /'0!

    Fuzzy ;ulesFuzzy ;ules

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    50/108

    menu

    Fuzzy ;ulesFuzzy ;ules

    Fuzzy rule +ase and the corresponding FA(( for the velocity and

    position ectors of the inerted pendulum+alancing pro+lem

    1! IF cart is on the left AE" cart is going left %#E largely push cart to the right

    J! IF cart is centered AE" cart is going right %#E slightly push cart to the left

    K! IF cart is on the right AE" cart is going left %#E donOt push cart

    >! IF cart is on the right AE" cart is not moing %#E push cart to the left

    ! IF cart is on the right AE" cart is going right %#E largely push cart to the left

    Fuzzy ;ulesFuzzy ;ules

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    51/108

    menu

    Fuzzy ;ulesFuzzy ;ules

    Fuzzy rule +ase and the corresponding FA(( for the angle

    and angular velocity ectors of the inerted pendulum+alancing pro+lem

    1! IF pole is leaning to the left AE" pole is dropping to the left %#E largely

    push cart to the left

    the cart

    ! and so on. and so forth

    !

    !

    Position vs KelocityPosition vs Kelocity

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    52/108

    menu

    Position vs# KelocityPosition vs# Kelocity

    If t%e cart is too near t%e end of t%e pat%, t%en regardless of t%e

    state of t%e 'room angle pus% t%e cart to4ards t%e ot%er end#

    1 x 1 F)

    )ngle vs )ngular Kelocity)ngle vs )ngular Kelocity

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    53/108

    menu

    )ngle vs# )ngular Kelocity)ngle vs# )ngular Kelocity

    If t%e 'room angle is too 'ig or c%anging too Guic5ly, t%en

    regardless of t%e location of t%e cart on t%e cart pat%, pus% t%ecart to4ards t%e direction it is leaning to#

    1 x 1 F)

    em'ers%ip Functionsem'ers%ip Functions

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    54/108

    em'ers%ip Functionsem'ers%ip Functionsem'ers%ip Functions for t%e Cart PositionPosition

    xx

    Trapezoid Vertices

    Left Trapezoid Regular Rigt

    1 2 1 ".5 1 "

    3 1 " 3 1 0.5 3 1 2

    4 1 0 4 1 0.5 4 1 0

    1 0 1 ".5 1 0

    Ta5e note of t%e

    position of t%e

    origin#

    Ta5e note of t%e

    position of t%e

    origin#

    em'ers%ip Functionsem'ers%ip Functions

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    55/108

    em'ers%ip Functionsem'ers%ip Functionsem'ers%ip Functions for t%e Cart KelocityKelocity

    Trapezoid Vertices

    Left Trapezoid Regular Rigt

    1 ' 1 ".5 1 0

    3 1 0 3 1 0.5 3 1 '

    4 1 0 4 1 0.5 4 1 0

    1 0 1 ".5 1 0

    em'ers%ip Functionsem'ers%ip Functions

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    56/108

    em'ers%ip Functionsem'ers%ip Functions

    em'ers%ip Functions for t%e Pole )ngle)ngle

    Trapezoid Vertices

    Left Trapezoid Regular Rigt

    1 0." 1 0." 1 0

    3 1 0 3 1 0.0' 3 1 0."

    4 1 0 4 1 0.0' 4 1 0

    1 0 1 0." 1 0

    em'ers%ip Functionsem'ers%ip Functions

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    57/108

    em'ers%ip Functionsem'ers%ip Functions

    em'ers%ip Functions for t%e !room )ngular Kelocity)ngular Kelocity

    Trapezoid Vertices

    Left Trapezoid Regular Rigt

    1 0." 1 0."5 1 0

    3 1 0 3 1 0.0' 3 1 0."

    4 1 0 4 1 0.0' 4 1 0

    1 0 1 0."5 1 0

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    58/108

    menu

    • *&S%ACL# AH*I"AEC# F688B

    L#C%6D#!doc

    • Lec< Fuzzy Logic Fuzzy#2ns!doc

    Fuzzy ;uleFuzzy ;ule

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    59/108

    menu

    Fuzzy ;uleFuzzy ;ule

    FDE);/"istance0 Q degree of

    mem+ership of the gien distance

    in the Fuzzy Set E#AD

    If   "istance is E#AD and  Angle is S(ALL T%en %urn Sharp Left!

    FS)LL/Angle0 Q degree of

    mem+ership of the gien angle

    in the Fuzzy Set S(ALL

    Could +e aconstant or

    another

    (F

    amdani Inference Systemamdani Inference System

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    60/108

    menu

    amdani Inference Systemamdani Inference System

    IF T/ED;uleStrengt%

    Input "istri'utionAutput

    "istri'ution

    Mo  7o

    xo yo

    and

    and

    T4o input, t4o rule amdani FIS 4it% crisp inputs

    Fuzzy rules are a collection of linguistic statements that descri+e ho, the FIS should

    ma-e a decision regarding classifying an input or controlling an output!

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    61/108

    menu

    ore detailsNore detailsN

    • Fuzzy Inference Systems =FIS?Fuzzy Inference Systems =FIS?• Fuzzy ;ulesFuzzy ;ules• Fuzzy Com'ination AperatorsFuzzy Com'ination Aperators• em'ers%ip functionsem'ers%ip functions

    Fuzzy InferenceFuzzy Inference

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    62/108

    menu

    Fuzzy InferenceFuzzy Inference

    Fuzzy inference is the process of formulating the mapping from a gien input to

    an output using fuzzy logic! %he mapping then proides a +asis from ,hichdecisions can +e made. or patterns discerned! %he process of fuzzy inference

    inoles all of the pieces that are descri+ed in the preious sections: (em+ership

    Functions. Logical *perations. and If%hen Dules!

    amdani FISamdani FIS

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    63/108

    menu

    amdani FISamdani FIS

    amdani(type inference. e$pects the output mem+ership functions to +e fuzzy

    sets! After the aggregation process. there is a fuzzy set for each output aria+le thatneeds defuzzification!

    http:;;,,,!math,or-s!com;access;helpdes-;help;tool+o$;fuzzy;inde$!html?;access;helpdes-;help;tool+o$;fuzzy;+pK>lJP1!html)http:;;,,,!math,or-s!com;cgi+in;te$is;,e+inator;search;?

    d+Q(SS)pro$Qpage)rorderQK@5)rpro$QK@5)rdfre2Q@55)r,fre2Q@55)rleadQ

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    64/108

    menu

    amdani FISamdani FIS

    amdani FISamdani FIS

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    65/108

    menu

    amdani FISamdani FIS

    Flo4 of Fuzzy InferenceFlo4 of Fuzzy Inference

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    66/108

    Flo4 of Fuzzy InferenceFlo4 of Fuzzy Inference

    In this figure. the flo, proceeds up from the inputs in the lo,er left. then

    across each ro,. or rule. and then do,n the rule outputs to finish in the lo,er

    right! %his compact flo, sho,s eerything at once. from linguistic aria+le

    fuzzification all the ,ay through defuzzification of the aggregate output!

    amdani FISamdani FIS

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    67/108

    menu

    amdani FISamdani FIS

    http:;;en!,i-ipedia!org;,i-i;FuzzyPsystem

    (a$min inferencing and centroid defuzzification for a system ,ith input aria+les 7$7.

    7y7. and 7z7 and an output aria+le 7n7! Eote that 7mu7 is standard fuzzylogic

    nomenclature for 7truth alue7:

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    68/108

    menu

    Sample0 amdaniSample0 amdani

    Consider a pro+lem ,ith < input aria+les. size and 4eig%t. and one output aria+le.

    Guality, ,ith the follo,ing lingustic term sets associated0

    Classical Inference Engine0 max(min(C:max(min(C:

    %he semantics of these linguistic terms are defined 'y triangular(s%aped

    mem'ers%ip functions0

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    69/108

    menu

    Sample0 amdaniSample0 amdani

    ;ule !ase =;!?0

    Classical Inference Engine0 max(min(C:max(min(C:

    Let us consider a sample input to the system. Mo  2, 2.Q size, 4eig%tQ

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    70/108

    menu

    Sample0 amdaniSample0 amdani

    ;ule !ase0

    Classical Inference Engine0 max(min(C:max(min(C:

    Let us consider a sample input to the system. Mo  2, 2.Q#

    T%is input is matc%ed against t%e rule antecedents in order to determine t%e rule(rule(

    firing strengt%firing strengt% hhi i  of eac% rule ;i  in t%e ;ule !ase#

    6sing a minimum %norm as conunctie. the follo,ing results are o+tained:

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    71/108

    menu

    Sample0 amdaniSample0 amdaniClassical Inference Engine0 max(min(C:max(min(C:

    ;ule(firing strengt%;ule(firing strengt% %i  of eac% rule ;i  in t%e ;ule !ase0

    %he inference system applies the%he inference system applies the compositional rule of inferencecompositional rule of inference to o+tain theto o+tain the

    inferred fuzzy sets !inferred fuzzy sets !i >>

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    72/108

    menu

    Sample0 amdaniSample0 amdani;ule(firing strengt%;ule(firing strengt% %i  of eac% rule ;i  in t%e ;ule !ase0

     Application of Application of compositional rule of inferencecompositional rule of inference to o+tain theto o+tain the inferred fuzzy sets !inferred fuzzy sets !i >>

    raphical representation:raphical representation:

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    73/108

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    74/108

    menu

    Sample0 amdaniSample0 amdaniraphical representation:raphical representation:

    %he final output is calculated +y defuzzification using%he final output is calculated +y defuzzification using Centre of :ravity =C:?Centre of :ravity =C:?

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

     Aggregation of the = indiidual output fuzzy sets +y means of the Aggregation of the = indiidual output fuzzy sets +y means of the maximum t(conormmaximum t(conorm

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    75/108

    menu

    Sample0 amdaniSample0 amdaniraphical representation:raphical representation:

    %he final output is calculated +y defuzzification using%he final output is calculated +y defuzzification using Centre of :ravity =C:?Centre of :ravity =C:?

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    76/108

    menu

    Sample0 amdaniSample0 amdani

    ode )(F)TI 4it% ax ( Centre of :ravity =C:? strategyode )(F)TI 4it% ax ( Centre of :ravity =C:? strategy

    RRFirst )ggregate, T%en InferFirst )ggregate, T%en Infer

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

    T%e final crisp output is 7T%e final crisp output is 7oo  #1-8 #1-8

    Sample0 amdaniSample0 amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    77/108

    menu

    Sample0 amdaniSa p e a da)lternatively, =RFirst Infer, T%en )ggregate?)lternatively, =RFirst Infer, T%en )ggregate?

    ode !(FIT) 4it% aximum Kalue 4eig%ted 'y t%e matc%ing strategyode !(FIT) 4it% aximum Kalue 4eig%ted 'y t%e matc%ing strategy

    e2erence: :enetic fuzzy systems 'y Ascar CordOn, Francisco /errera, Fran5 /offmann

    amdani FISamdani FIS

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    78/108

    menu

    amdani FIS

    • It is possi+le. and in many cases much more efficient. to use asingle spi5e as the output mem'ers%ip function rather than a

    distri+uted fuzzy set!

    • %his type of output is sometimes -no,n as a singleton output

    mem'ers%ip function. and it can +e thought of as a predefuzzified

    fuzzy set!

    • It enhances the efficiency of the defuzzification process +ecause it

    greatly simplifies the computation re2uired +y the more general(amdani method. ,hich finds the centroid of a 2(" function!

    • Dather than integrating across the t,odimensional function to find

    the centroid. you use the 4eig%ted average of a fe4 data points!

    ABTPBT E!E;S/IP FBDCTIAD

    Sugeno FISSugeno FIS

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    79/108

    menu

    Sugeno FISg

     A typical rule in a Sugeno fuzzy model has the form:

      If Input 1 Q $ and Input < Q y. then *utput is z ax 'y c

    For a zero(order Sugeno model. the output leel zz is a constant /aQ+ Q50!

    Sugeno FIS is similar to the (amdani method in many respects! %he first t,o parts of

    the fuzzy inference process. fuzzifying the inputs and applying the fuzzy operator. are

    e$actly the same! %he main difference +et,een (amdani and Sugeno is that theSugeno output mem+ership functions are either linear or constant!

    Sugeno FISSugeno FIS

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    80/108

    menu

    Suge o Sg

    FIS0 Sugeno vs# amdaniFIS0 Sugeno vs# amdani

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    81/108

    menu

    gg

    )dvantages of t%e amdani et%od

    It is intuitie!

    It has ,idespread acceptance!

    It is ,ell suited to human input!

    )dvantages of t%e Sugeno et%od

    It is computationally efficient!

    It can +e used to model any inference system in ,hich the

    output mem+ership functions are either linear or constant!

    It ,or-s ,ell ,ith linear techni2ues /e!g!. 'I" control0!

    It ,or-s ,ell ,ith optimization and adaptie techni2ues!

    It has guaranteed continuity of the output surface!

    It is ,ell suited to mathematical analysis!

    Fuzzy SetsFuzzy Sets

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    82/108

    menu

    yy

    Fuzzy Set !Fuzzy Set )

    #$amples:

    We ,ill use the follo,ing fuzzy sets in e$plaining the different fuzzy

    operators that follo,s ne$t!

    Fuzzy com'inations =T(norms?

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    83/108

    y = ?In ma-ing a fuzzy rule. ,e use the concept of 3and4. 3or 4. and sometimes

    3not4! %he sections +elo, descri+e the most common definitions of these

    3fuzzy com+ination4 operators! Fuzzy com+inations are also referred to as3T(norms4!

    Fuzzy Rand

    %he fuzzy 3and4 is ,ritten as:

    ,here   A is read as 3the mem+ership in class A4 and  ) is read as 3themem+ership in class &4!

    Intersection of A and &

    #$ample:

    Fuzzy RFuzzy Randand

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    84/108

    menu

    yy

    *ade% ( min= 6  " =x?, 6 7 =x??

    %his techni2ue. named after the inentor of fuzzy set

    %heoryY it simply computes the 3and4 +y ta-ing the minimum of the t,o /or

    more0 mem+ership alues! %his is the most common definition of the fuzzy

    3and4!

    Product ( 6  " =x? U 6 7 =x? 

    %his techni2ue computes the fuzzy 3and4 +y multiplying the t,o mem+ership

    alues!

    %here are many ,ays to compute 3and4! %he t,o most common are:

    Fuzzy RFuzzy Randand

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    85/108

    menu

    yy!ot% tec%niGues %ave t%e follo4ing t4o properties0

    T=,? T=a,? T=,a?

    T=a,+? T=+,a? a

    *ne of the nice things a+out +oth definitions is that they also can +e used to

    compute the &oolean 3and4! %he fuzzy Rand is an e$tension of the !oolean

    Rand to num+ers that are not ust 5 or 1. +ut +et,een 5 and 1!

    Fuzzy Ror 

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    86/108

    menu

    y

    Fuzzy Ror

    %he fuzzy 3or4 is ,ritten as:

    ,here   A is read as 3the mem+ership in class A4 and  ) is read as 3themem+ership in class &4!

    6nion of ) and ! 

    #$ample:

    Fuzzy RFuzzy Ror or 

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    87/108

    menu

    yy

    T%e fuzzy Ror is an extension of t%e !oolean Ror to

    num'ers t%at are not 6ust or +, 'ut 'et4een and +#

    Fuzzy RFuzzy Ror or 

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    88/108

    menu

    yy

    *ade%ma$/   A /$0.  ) /$00 

    it simply computes the 3or4 +y ta-ing the maximum of the t,o /or more0

    mem+ership alues! %his is the most common definition of the fuzzy 3or4!

    Product

    /   A /$0 X  ) /$00 – /   A /$0 G  ) /$00

    %his techni2ue uses the difference +et,een the sum of the t,o /or more0

    mem+ership alues and the product of their mem+ership alues!

    %here are many ,ays to compute 3or 4! %he t,o most common are:

    Similar to the fuzzy 3and4. +oth definitions of the fuzzy 3or4 also can +e used to

    compute the &oolean 3or4!

    ( ! ) ax( ! ) x y x yσ    =

    ( ! ) x y x y xyσ    = + −

    Fuzzy RFuzzy Ror or 

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    89/108

    yy

    Lu5asie4icz "is6unction

    min/1. A /$0 X ) /$00 

    *ther ,ays to compute Fuzzy 3or 4:

    ( ! ) in("! ) x y x yσ    = +

    /amac%er "is6unction "is6unction

    2

    ( ! ) "

     x y xy

     x y  xyσ 

      + −

    = −

    )()("

    )()(2)()(

     x x

     x x x x

     B A

     B A B A

     µ  µ 

     µ  µ  µ  µ 

    −+

    Fuzzy RFuzzy Ror or 

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    90/108

    yy*ther ,ays to compute Fuzzy 3or 4:

    Einstein "is6unction

    )()(")()(

     x x x x

     B A

     B A

     µ  µ  µ  µ 

    + +

    ( ! )"

     x y x y

     xyσ 

      +=

    +

    Fuzzy RFuzzy Rnotnot

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    91/108

    menu

    y

    DAT =)? + ( )

    Eegation of )

    #$ample:

    Fuzzy set )

    Fuzzy Set operationsFuzzy Set operations

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    92/108

    menu

    y p

    Fuzzy logic is a supersetsuperset of conventional=!oolean? logic

     All other operations on classical sets also hold for fuzzy sets. e$cept for

    the e$cluded middle la,s!

    0≠∩

    ≠∪

     A A

     X   A A

    ConseGuenceConseGuence

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    93/108

    menu

    T%e conseGuence of a fuzzy rule is computed using t4o steps0

    Computing the rule strength +y com+ining the fuzzified inputs

    using the fuzzy com'ination process

    IF T/ED;uleStrengt%

    Input "istri'ution Autput

    "istri'ution

    Mo  7o

    xo yo

    and

    and

    In this e$ample. the fuzzy 3and4 is used to com+ine the mem+ership functions to compute the rule strength!

    +

    ConseGuenceConseGuence

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    94/108

    menu

    Clipping the output mem+ership function at the rule strength!

    IF T/ED;uleStrengt%

    Input "istri'ution Autput

    "istri'ution

    Mo  7o

    xo yo

    and

    and

    In this e$ample. the fuzzy 3and4 is used to com+ine the mem+ership functions to compute the rule strength!

    2

    ConseGuenceConseGuence1

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    95/108

    menu

    %he outputs of all of the fuzzy rules must no, +e com+ined to o+tain one

    fuzzy output distri+ution! %his is usually. +ut not al,ays. done +y using the

    fuzzy 3or4! %he figure +elo, sho,s an e$ample of this!

    IF T/ED;uleStrengt%

    Input "istri'ution Autput

    "istri'ution

    Mo  7o

    xo yo

    and

    and

    %he output

    mem+ershipfunctions on the

    right hand side of

    the figure are

    com+ined using the

    fuzzy 3or 4 to o+tain

    the outputdistri+ution sho,n

    on the lo,er right

    corner of the figure!

    "efuzzification of Autput"i t i' ti

    .

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    96/108

    "istri'ution

    In many instances. it is desired to come up ,ith a single crisp output from aFIS! For e$ample. if one ,as trying to classify a letter dra,n +y hand on a

    dra,ing ta+let. ultimately the FIS ,ould hae to come up ,ith a crisp num+er

    to tell the computer ,hich letter ,as dra,n! %his crisp num+er is o+tained in a

    process -no,n as defuzzification!

    %here are t,o common techni2ues for defuzzifying:

    Center of mass  %his techni2ue ta-es the output distri+ution found inthe preious slide and finds its center of mass to come up ,ith one crisp

    num+er! %his is computed as follo,s:

    ,here z is the center of mass and Zc is

    the mem+ership in class c at alue 8 !

     An e$ample outcome of this

    computation is sho,n in the figure at the

    right!

    a?

    "efuzzification of Autput"i t i' ti

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    97/108

    "istri'ution

    ean of maximum  %his techni2ue ta-es the output distri+utionfound in the preious section and finds its mean of ma$ima to come up ,ith

    one crisp num+er! %his is computed as follo,s:

    '?

    ,here z is the mean of ma$imum. * 6 is the point at ,hich

    the mem+ership function is ma$imum. and l is the num+er

    of times the output distri+ution reaches the ma$imum leel!

     An e$ample outcome of this computation is sho,n the

    figure at the right!

    amdani FIS 4it% a Fuzzy Inputamdani FIS 4it% a Fuzzy Input

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    98/108

    menu

    IF T/ED;uleStrengt%

    and

    and

    ) t4o Input, t4o rule amdani FIS 4it% a fuzzy input

    sho,s a modification

    of the (amdani FIS,here the input y5 is

    fuzzy. not

    crisp!

    %his can +e used to

    model inaccuracies in

    the measurement!

    For e$ample. ,e may

    +e measuring theoutput of a pressure

    sensor! #en ,ith the

    e$act same pressure

    applied. the sensor is

    measured to hae

    slightly different

    oltages!%he fuzzy input

    mem+ership

    function models this

    uncertainty!

    %he input fuzzy function is com+ined ,ith the rule input mem+ership function +y using the fuzzy

    3and4

    em'ers%ip Functionsem'ers%ip Functions

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    99/108

    menu

    sigmf/$.[a c\0. as gien in the follo,ing e2uation +y f/$.a.c0 is a mapping on a ector

    $. and depends on t,o parameters a and c!

    T%e Sigmoidal function

    em'ers%ip Functionsem'ers%ip Functions

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    100/108

    menu

    T%e :aussian function

    %he symmetric aussian function depends on t,o parameters and c as gien +yσ 

    em'ers%ip Functionsem'ers%ip Functions

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    101/108

    menu

    T%e Trapezoidal function

    or 

    %he trapezoidal cure is a function of a ector. $. and depends on four scalarparameters a. +. c. and d. as gien +y

    %he parameters a and d locate the 7feet7 of the trapezoid and the parameters + and c

    locate the 7shoulders!7

    /edges/edges http:;;+log!peltarion!com;

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    102/108

    '.")( x A

     µ 

    %.")( x A µ 

    2)( x A

     µ 

    ')( x A µ 

    *)( x A µ 

    2

    "

    )( x A µ 

    5.0)(0i6  )(22 ≤≤   x x  A A   µ  µ 

    ) little) little

    Slig%tlySlig%tly

    KeryKery

    ExtremelyExtremely

    Kery veryKery very

    Some4%atSome4%at

    IndeedIndeed

    /edge EffectAperator 

    ")(0.5i6  ))("(2" 2 ≤

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    103/108

    Sigma N!@=

    c @

    Fuzzy Logic )pplicationsFuzzy Logic )pplications

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    104/108

    menu

    •Inverted Pendulum – Analyze the simulation /see implementation0

     – Hariations of settings:

    • /N$N. @$@ FA((S0

    • Shape of mem+ership functions

    • Fuzzy *utput alues settings. time delay

     – 6tilisation of #ulerOs (ethod in the simulation

    /see pdf0

    Fuzzy Logic )pplicationsFuzzy Logic )pplications

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    105/108

    menu

    •;o'ot Davigation – "eriation of e2uations for motion

     – Hariations of settings:

    • FA((

    • Shape of mem+ership functions

    • Fuzzy *utput alues settings. time delay

     – Startup codes

    ;eferences;eferences

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    106/108

    menu

    • enetic fuzzy systems +y *scar Cord]n. Francisco errera. Fran-

    offmann• Eeural Eet,or- and Fuzzy Logic Applications in C;CXX /Wiley 'rofessional

    Computing0 +y Stephen Welstead

    • Fuzzy Logic ,ith #ngineering Applications +y %imothy Doss

    • Fuzzy Sets and 'attern Decognition +y &enamin napp

    Euler et%odEuler et%od

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    107/108

    menu

    • In mathematics and computational science. the Euler met%od.

    named after Leonhard #uler. is a numerical procedure forsoling ordinary differential e2uations /*"#s0 ,ith a gieninitial alue! It is the most +asic -ind of e$plicit method fornumerical integration for ordinary differential e2uations!

    Sorce: http:**www.answers.com*topic*eler+metho'+!,cat-technology 

    Euler et%odEuler et%od

  • 8/17/2019 Lec2011 - 3 - AI - Fuzzy Logic

    108/108

    • %he idea is that ,hile the cure is initially un-no,n. its starting point. ,hich,e denote +y A5. is -no,n /see the picture on top right0! %hen. from thedifferential e2uation. the slope to the cure at A5 can +e computed. andso. the tangent line!

    • %a-e a small step along that tangent line up to a point A1! If ,e pretendthat A1 is still on the cure. the same reasoning as for the point A5 a+oecan +e used! After seeral steps. a polygonal cure A5 A1 A