840 likes | 1.27k Views
Production Systems. Symbolic based Rule based system Based on simple working principle System consists of: production rules working memory recognise-act control Cycle. Production Rules (Productions). Production Rules are: Condition – Action Pair .
E N D
Production Systems • Symbolic based Rule based system • Based on simple working principle • System consists of: • production rules • working memory • recognise-act control Cycle. CS 331/531 Dr M M Awais
Production Rules (Productions) • Production Rules are: • Condition – Action Pair Pattern that determines when to apply rule Defines the associated problem-solving step. CS 331/531 Dr M M Awais
Working Memory • Contains the description of current state • WM state is compared with the condition part of the production rules to determine the type of action required. • Always changes when productions are applied CS 331/531 Dr M M Awais
Recognise – Act Cycle Initialise Working Memory • Productions - Conditions (if the two match) (Enabled) Conflict Set (one pattern taken at a time) Production - (Fired) Conflict Resolution Match the WM memory with the conditions of rules CS 331/531 Dr M M Awais
Recognise – Act Cycle Initialise Working Memory • Productions - Conditions (if the two match) (Enabled) Conflict Set (one pattern taken at a time) Production - (Fired) Conflict Resolution Productions can only fire when conditions in production-conditions are matched in the working memory (WM). If they match a subset of productions is formed called Conflict Set. Part of Production That Are Enabled CS 331/531 Dr M M Awais
Recognise – Act Cycle Initialise Working Memory • Productions - Conditions (if the two match) (Enabled) Conflict Set (one pattern taken at a time) Production - (Fired) Conflict Resolution It chooses a rule from conflict set for firing. Selection of any rule may be based on complex rule selection heuristics. CS 331/531 Dr M M Awais
Recognise – Act Cycle Initialise Working Memory • Productions - Conditions (if the two match) (Enabled) Conflict Set (one pattern taken at a time) Production - (Fired) Conflict Resolution Fire a rule and update the WM CS 331/531 Dr M M Awais
P A1 P A2 - - - - Pattern Action WM Patterns Feedback in the Systems in which no conflict resolution remains. All conflicts are resolved A Production System CS 331/531 Dr M M Awais
acbcc abccc Example: • Production Set: • ba ab • ca ac • cb bc • (whenever a pattern on the LHS appears replace it with the one on the RHS ) • Working Memory = acbcc • Conflict Set = 3 • Rule fired = 3 CS 331/531 Dr M M Awais
Example:Production Set: • ba ab • ca ac • cb bc CS 331/531 Dr M M Awais
ba ab • ca ac • cb bc Example:Production Set: CS 331/531 Dr M M Awais
ba ab • ca ac • cb bc Example:Production Set: CS 331/531 Dr M M Awais
ba ab • ca ac • cb bc Example:Production Set: CS 331/531 Dr M M Awais
ba ab • ca ac • cb bc Example:Production Set: CS 331/531 Dr M M Awais
ba ab • ca ac • cb bc Example:Production Set: CS 331/531 Dr M M Awais
ba ab • ca ac • cb bc Example:Production Set: CS 331/531 Dr M M Awais
ba ab • ca ac • cb bc Example:Production Set: CS 331/531 Dr M M Awais
Data Driven Search in Production System • Production Set: • p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • Start v ^ r ^ q • IF symbols on the LHS appear then add the symbols on the RHS to the WM CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
start v r q CS 331/531 Dr M M Awais
start v r q s CS 331/531 Dr M M Awais
start v r q s p CS 331/531 Dr M M Awais
start v r q s p goal CS 331/531 Dr M M Awais
start v r q s p goal CS 331/531 Dr M M Awais
start v r q s p goal CS 331/531 Dr M M Awais
start v r q s p goal CS 331/531 Dr M M Awais
GOAL Driven Search in Production System • Production Set: • p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • Start v ^ r ^ q CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r q • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r p • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
p ^ q goal • r ^ s p • w ^ r p • t ^ u q • v s • start v ^ r ^ q Data Driven: Production Set: CS 331/531 Dr M M Awais
goal p q CS 331/531 Dr M M Awais
goal p q w r CS 331/531 Dr M M Awais
goal p q w s r r CS 331/531 Dr M M Awais
goal p q u w t s r r CS 331/531 Dr M M Awais
goal p q u w t s r r v CS 331/531 Dr M M Awais
goal p q u w t s r r v start CS 331/531 Dr M M Awais
goal p q u w t s r r v start CS 331/531 Dr M M Awais
Hearsay – II (Erman et.al 1980) • One of the first developed project • AIMED at speech recognition system CS 331/531 Dr M M Awais
Rule Based System • Modeled as Production systems • Production Systems implemented as Cause-Effect rules • RBS have IF-THEN rules in their structures • Working principle is same as production system • Capable of handling vague concepts CS 331/531 Dr M M Awais
Rule Based System • Find all the rules which have the IF part satisfied • Select one rule using conflict resolution • Perform action and modify the Working memory • Repeat until all the rules have been fired or the goal have been reached. CS 331/531 Dr M M Awais
Example: RBS with 5 Rules • R1: If hot and smoky then add fire • R2: If alarmbeepsthen add smoky • R3: If fire then add switch on the sprinklers • R4: If dryThen add switch on humidifier • R5: If switch on sprinklers then Delete dry • Given Facts: Alarm beeps, hot, dry • If you associate every fact with symbols it becomes a production system CS 331/531 Dr M M Awais
R1: If hot and smoky then add fire • R2: If alarm beepsthen add smoky • R3: If fire then add switch on the sprinklers • R4: If dryThen add switch on humidifier • R5: If switch on sprinklers then Delete dry • Given Facts: Alarm beeps, hot, dry Forward Chaining:Rule firing • R2 and R4 can be fired • If R2 fired then • R1, R3, and R5 will follow • As a result: Dry will be deleted from WM • If R4 is fired • R2, R1, R3, and R5 will be fired • As a result: Dry will be deleted from WM • R4 is fired Aimlessly CS 331/531 Dr M M Awais