Rules-14

Rule-based Systems





Example (Theatre)

Rule

IF

THEN

T1

Distance > 5 miles

Means is "drive"

T2

Distance > 1 mile
and time < 15 min.

Means is "drive"

T3

Distance > 1 mile
and time > 15 min.

Means is "walk"

T4

Means is "drive"
and location is "downtown"

Action is "take a cab"

T5

Means is "drive"
and location not "downtown"

Action is "drive your car"

T6

Means is "walk"
and weather is "bad"

Action is "take a coat
and walk"

T7

Means is "walk"
and weather is "good"

Action is "walk"



Assertions: (in Working Memory)

A1: The theatre is located 6 miles away

A2: The weather is bad

A3: The theatre's location is downtown

A4: The film starts in 10 minutes.

Cycle

Rules

Rule selected

Add to Working Memory

0



A1, A2, A3, A4

1

T1,T2

T1

means is "drive"

2

T1,T2,T4

T2


3

T1,T2,T4

T4

action is "take a cab"

4

T1,T2,T4


stop



Conflict Resolution Strategies

  1. Specificity Ordering

  2. Rule Ordering

  3. Data Ordering

  4. Size Ordering

  5. Recency Ordering

  6. Context limiting

Example:

Rule

IF

THEN

I1

the animal has hair

it is a mammal

I2

the animal gives milk

it is a mammal

I3

the animal has feather

it is a bird

I4

the animal flies and
it lays eggs

it is a bird

I5

the animal is a mammal
it eats meat

it is a carnivore

I6

the animal is a mammal
it has pointed teeth
it has claws
its eyes point forward

it is a carnivore

I7

animal is a mammal
it has hoofs

it is an ungulate

I8

animal is a mammal
it chew cud

it is an ungulate
it is even-toed

I9

animal is a carnivore
it has a tawny color
it has dark spots

it is a cheetah

I10

animal is a carnivore
it has a tawny color
it has black strip

it is a tiger

I11

animal is an ungulate
it has long legs
it has long neck
it has a tawny color
it has dark spots

it is a giraffe

I12

animal is an ungulate
it has a white color
it has black strip

it is a zebra

I13

animal is a bird
it does not fly
it has long legs
it has a long neck
it is black and white

it is an ostrich

I14

animal is a bird
it does not fly
it swims
it is black and white

it is a penguin

I15

animal is a bird
it is a good flyer

it is an albatross



In a zoo, an unknown animal with the following observation:



Cycle

Rules selected

Add to Working Memory

1

I2

animal is mammal

2

I8

animal is ungulate

3

I11

animal is giraffe





Backward-Chaining Deduction



Example (Theatre)

Cycle

Rule Selected

Actions

0


Goal is action

1

T4

Mean=?
Location=?

2

T1

Distance > 5?

3

Ask Question

Distance=2

4


Rule 1 failed

5

T2

Distance > 1
Time < 15?

6

Ask Question

Time=10

7


Rule T2 succeeded
mean is "drive"

8

T3

Rule T3 failed

9

T4

Location=?

10

Ask Question

Location=Downtown

11


Rule T4 succeeded

12

T5,T6,T7

T5,T6,T7 failed

13


consultation done

14


action is "take a cab"



Animal Example

AND-OR Graph Representation of Backward Chaining




Grouping of Rules






Combination of Forward & Backward System



Example (Animal Example)



Including control knowledge

  1. Meta Rules

  2. Heuristic Function

  3. Rule Modification

Answer Questions about Deduction

  1. WHY do you ask this question?

  2. HOW do you get your conclusion.
    > Action is "take a cab"
    >> How?

    > since distance > 1 mile and time < 15 min, by rule 2, the mean to theatre is "drive". Location of theatre is at downtown. By rule 4, the action is take a cab.





AND-OR graph of the theatre example:

For the animal example:

How?

Animal is Cheetah?

Forward Vs Backward Systems

Forward Chaining System

Advantages:



Disadvantages:



Backward Chaining Systems

Advantage:



Disadvantages:



Choosing between forward and backward system