• No results found

Pushpak Bhattacharyya

N/A
N/A
Protected

Academic year: 2022

Share "Pushpak Bhattacharyya"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

CS344: Introduction to Artificial Intelligence

Intelligence

(associated lab: CS386)

Pushpak Bhattacharyya

CSE Dept., IIT Bombay

Lecture–4: Fuzzy Control of Inverted

P d l P i i l C l l b d

Pendulum + Propositional Calculus based puzzles

(2)

Lukasiewitz formula for Fuzzy Implication

„

t(P) = truth value of a proposition/predicate In

„

t(P) truth value of a proposition/predicate. In fuzzy logic t(P) = [0,1]

t(

P Q

) = min[1 1 t(P)+t(Q)]

„

t( ) = min[1,1 -t(P)+t(Q)]

P Q Lukasiewitz definition of implication

(3)

Use Lukasiewitz definition Use Lukasiewitz definition

„ t(pÆq) = min[1,1 -t(p)+t(q)]

W h ( ) [1 1 ( ) ( )]

„ We have t(p->q)=c, i.e., min[1,1 -t(p)+t(q)]=c

„ Case 1:

1 i 1 t( )+t( )> 1 i t( )>

„ c=1 gives 1 -t(p)+t(q)>=1, i.e., t(q)>=a

„ Otherwise, 1 -t(p)+t(q)=c, i.e., t(q)>=c+a-1 Combining t(q)=max(0 a+c 1)

„ Combining, t(q)=max(0,a+c-1)

„ This is the amount of truth transferred over the channel pÆq

channel pÆq

(4)

ANDING of Clauses on the LHS of implication

Eg: If Pressure is high AND Volume is low then make Temperature

)) (

), (

min(

)

( P Q t P t Q

t ∧ =

Eg: If Pressure is high AND Volume is low then make Temperature Low

High Pressure Low

Volume Volume

Low Temperature

P /V l /T

P0 T0 V0

Mu(P0)<Mu(V0) Pressure/Volume/Temp ( 0) ( 0)

Hence Mu(T0)=Mu(P0)

(5)

Fuzzy Inferencing

Core

The Lukasiewitz rule

t( ) = min[1,1 + t(P) – t(Q)]

An example Q P

An example

Controlling an inverted pendulum

θ

θ

.

= d θ / dt

= angular velocity

Motor i=current

(6)

The goal: To keep the pendulum in vertical position (θ=0)

i d i ilib i Wh h d l d

in dynamic equilibrium. Whenever the pendulum departs from vertical, a torque is produced by sending a current ‘i’

Controlling factors for appropriate current

A l θ A l l it θ.

Angle θ, Angular velocity θ Some intuitive rules

If θ is +ve small and θ. is –ve small then current is zero

then current is zero

If θ is +ve small and θ. is +ve small then current is –ve medium

(7)

-ve ve +ve +ve

Control Matrix θ

ve

ve

med -ve

small Zero +ve small

+ve

θ. θ med -ve med

-ve +ve +ve Region of

small Zero

+ve med

+ve small +ve Z -ve

Zero Region of

interest e o

+ve

ve small -ve -ve

+ve

small Zero ve Z

small +ve

ve ve med

small Zero

med

(8)

Each cell is a rule of the form If θ i d θ. i

If θ is <> and θ is <>

then i is <>

4 “Centre rules”

1 if θ Z d θ. Z th i Z

1. if θ = = Zero and θ = = Zero then i = Zero

2. if θ is +ve small and θ. = = Zero then i is –ve small 3. if θ is –ve small and θ.= = Zero then i is +ve small 4 if θ = = Zero and θ. is +ve small then i is ve small 4. if θ = = Zero and θ is +ve small then i is –ve small 5. if θ = = Zero and θ. is –ve small then i is +ve small

(9)

Linguistic variables 1 Zero

1. Zero

2. +ve small 3. -ve small

Profiles

zero 1

+ve small -ve small

1

ε ε

ε2

2

3 ε3

Quantity (θ, θ., i)

(10)

Inference procedure

1. Read actual numerical values of θ and θ.

2 Get the corresponding μ values μZ μ(+ ll)

2. Get the corresponding μ values μZero, μ(+ve small), μ(-ve small). This is called FUZZIFICATION

3. For different rules, get the fuzzy i values from

3. For different rules, get the fuzzy i values from the R.H.S of the rules.

4. “Collate” by some method and get ONE current y g value. This is called DEFUZZIFICATION

5. Result is one numerical value of i.

(11)

Rules Involved

if θ is Zero and dθ/dt is Zero then i is Zero

if θ is Zero and dθ/dt is +ve small then i is ve small if θ is Zero and dθ/dt is +ve small then i is –ve small if θ is +ve small and dθ/dt is Zero then i is –ve small

if θ +ve small and dθ/dt is +ve small then i is -ve medium

zero 1

+ve small -ve small

1

ε ε

ε2

2

3 ε3

Quantity (θ, θ., i)

(12)

Fuzzification

Suppose θ is 1 radian and dθ/dt is 1 rad/sec μ =1)=0 8 (say)

μzero =1)=0.8 (say)

μ +ve-small =1)=0.4 (say) μzero(dθ/dt =1)=0.3 (say)

μ+ve-small(dθ/dt =1)=0.7 (say)

μ+ve small( ) ( y)

zero 1

+ve small -ve small

1

ε 1 rad/sec ε

ε2

2

3 ε3

Quantity (θ, θ., i) 1rad

(13)

Fuzzification

Suppose θ is 1 radian and dθ/dt is 1 rad/sec μzero =1)=0.8 (say)

μ +ve small =1)=0.4 (say) μ +ve-small 1) 0.4 (say) μzero(dθ/dt =1)=0.3 (say)

μ+ve-small(dθ/dt =1)=0.7 (say)

if θ is Zero and dθ/dt is Zero then i is Zero min(0.8, 0.3)=0.3

hence μ e o(i)=0.3 hence μzero(i) 0.3

if θ is Zero and dθ/dt is +ve small then i is –ve small min(0.8, 0.7)=0.7

hence μ-ve-small(i)=0.7

if θ i ll d dθ/dt i Z th i i ll

if θ is +ve small and dθ/dt is Zero then i is –ve small min(0.4, 0.3)=0.3

hence μ-ve-small(i)=0.3

if θ +ve small and dθ/dt is +ve small then i is -ve medium/ min(0.4, 0.7)=0.4

hence μ-ve-medium(i)=0.4

(14)

Finding i

di

-ve small

zero 1

-ve small -ve medium

ve small

0.4 0.7

2 3

-4.1 -2.5 ε ε

0.3 Possible candidates:

i=0.5 and -0.5 from the “zero” profile and μ=0.3

i 0 1 and 2 5 f om the “ e small” p ofile and 0 3 i=-0.1 and -2.5 from the “-ve-small” profile and μ=0.3 i=-1.7 and -4.1 from the “-ve-small” profile and μ=0.3

(15)

Defuzzification: Finding i

by the centroid method

Required i value Centroid of three

-ve small -ve medium

trapezoids

zero

-4.1 -2.5 ε ε

Possible candidates:

i is the x-coord of the centroid of the areas given by the bl e t ape i m the g een t ape i ms and the black t ape i m blue trapezium, the green trapeziums and the black trapezium

(16)

Propositional Calculus and Puzzles

(17)

Propositions

Stand for facts/assertions

Declarative statements

As opposed to interrogative statements (questions) or imperative statements (request, order)

Operatorsp

) ( (~),

), ( ),

( OR NOT IMPLICATION AND

=> and ¬ form a minimal set (can express other operations) - Prove it.

Tautologies are formulae whose truth value is always T, whatever the assignment is

(18)

Model

In propositional calculus any formula with n propositions has 2n models (assignments)

- Tautologies evaluate to T in all models.

Examples:

1) )

PP

2)

P P ∨ ¬

) (

)

(PQPQ

2)

e Morgan with AND

) (

)

(PQ ⇔ ¬P ∨ ¬Q

¬

-e Morgan with AND

(19)

Semantic Tree/Tableau method of proving tautology

Start with the negation of the formula

α-formula

)]

( )

(

[¬ PQ ¬P¬Q

¬ - α - formula

β-formula α-formula

- α - formula - β - formula

)

( P Q

¬

)

( P Q

p q

α formula

) (¬P ¬Q

¬

q

¬q

¬ p

(20)

Example 2:

- formula) X )]

( ) (

) (

[ A B C A B A C

¬

α-formula ¬A ¬C

- formulae) )

( B C

A

)) (

)

(( A B A C

¬

¬A ¬B ¬A ¬B

)

( A B

¬

A (β - formulae)

)) ( A C

¬

A B C

A

B C A

B C

A B C

B C B C

Contradictions in all paths

(21)

A puzzle A puzzle

(Zohar Manna, Mathematical Theory of Computation 1974)

Computation, 1974)

From Propositional Calculus

(22)

Tourist in a country of truth- sayers and liers

„ Facts and Rules: In a certain country, people either always speak the truth or always

lie A tourist T comes to a junction in the lie. A tourist T comes to a junction in the country and finds an inhabitant S of the

country standing there. One of the roads at the junction leads to the capital of the

the junction leads to the capital of the

country and the other does not. S can be asked only yes/no questions.

Q i Wh i l / i T

„ Question: What single yes/no question can T ask of S, so that the direction of the capital is revealed?

(23)

Diagrammatic representation

Capital Capital

S (either always says the truth Or always lies)

Or always lies) T (tourist)

(24)

Deciding the Propositions: a very difficult Deciding the Propositions: a very difficult step- needs human intelligence

„

P: Left road leads to capital

„

Q: S always speaks the truth

„

Q: S always speaks the truth

(25)

Meta Question: What question should the tourist ask

„

The form of the question

„

Very difficult: needs human intelligence

„

Very difficult: needs human intelligence

„

The tourist should ask

„

Is R true?

„

Is R true?

„

The answer is “yes” if and only if the left road leads to the capital p

„

The structure of R to be found as a

function of P and Q

(26)

A more mechanical part: use of truth table

P Q S’s

Answer R

T T Yes T

T F Yes F

F T N F

F T No F

F F No T

F F No T

(27)

Get form of R: quite mechanical

„

From the truth table

„

R is of the form (P x-nor Q) or (P

Q)

„

R is of the form (P x nor Q) or (P

Q)

(28)

Get R in

English/Hindi/Hebrew…

„ Natural Language Generation: non-trivial

„ The question the tourist will ask isq

„ Is it true that the left road leads to the capital if and only if you speak the truth?

„ Exercise: A more well known form of this

question asked by the tourist uses the X-OR t i t d f th X N Wh t h

operator instead of the X-Nor. What changes do you have to incorporate to the solution, to get that answer?

get that answer?

References

Related documents

„ E: advise; H: paraamarsh denaa (advice give): Noun Incorporation- very common Indian Language Phenomenon. Incorporation very common Indian

ash -- (strong elastic wood of any of various ash trees; used for furniture and tool handles and sporting goods such as baseball bats). „ The verb ash has 1 sense (no senses

motivations, but must balance the multiple conflicting policies and regulations for both fossil fuels and renewables 87 ... In order to assess progress on just transition, we put

A cone is a surface generated by rotating a straight line such that it always keep contact with a closed curve called base, and contains a fixed point (apex) which does not lie in

Shifting cultivation systems are usually richer in crop biodiversity than other traditional farming systems, and defi nitely more so than modern farming systems. The

Assistant Statistical Officer (State Cad .. Draughtsman Grade-I Local Cadre) ... Senior Assistant (Local

These gains in crop production are unprecedented which is why 5 million small farmers in India in 2008 elected to plant 7.6 million hectares of Bt cotton which

Deputy Statistical Officer (State Cadre) ... Deputy Statistical Officer (Local