140 likes | 247 Views
Reaction System. To ‘bag’ groceries. It does the following: Checks to see if a ‘cross-sale’ can be made. Bags the large items, ensuring bottles are the first items to be bagged. Then bags the medium items, putting frozen items in an insulated bag as necessary.
E N D
Reaction System To ‘bag’ groceries. It does the following: Checks to see if a ‘cross-sale’ can be made. Bags the large items, ensuring bottles are the first items to be bagged. Then bags the medium items, putting frozen items in an insulated bag as necessary. NOTE: The system uses a Rule Ordering conflict resolution strategy!
Items to be Bagged: These items are placed in the working memory (WM)
Working Memory • Step is check order • Bag is Bag 1 • Beef to be bagged • Cornflakes to be bagged • Ice Cream to be bagged • Crisps to be bagged • Pepsi to be bagged
Rule 1 • Crisps are to be bagged • Pepsi is to be bagged • RULE DOES NOT FIRE!
Rule 2 • Step is Check Order • RULE FIRES! • WM: • Step is bag large items • Bag is Bag 1 • Beef to be bagged • Cornflakes to be bagged • Ice Cream to be bagged • Crisps to be bagged • Pepsi to be bagged
Rule 3 • Step is bag large items • There is a large item to bag • There is a bottle to bag • The bag has less than 6 large items • RULE 3 FIRES! • WM: • Step is bag large items • Bag is Bag 1 • Beef to be bagged • Cornflakes to be bagged • Ice Cream to be bagged • Crisps to be bagged
Rule 4 (1) • Step is bag large items • There is a large item to bag • The bag has less than 6 large items • WM: • Step is bag large items • Bag is Bag 1 • Beef to be bagged • Ice Cream to be bagged • Crisps to be bagged NOTE: This rule may fire several times if there are several large items!
Rule 4 (2) • Step is bag large items • There is a large item to bag • The bag has less than 6 large items • WM: • Step is bag large items • Bag is Bag 1 • Ice Cream to be bagged • Crisps to be bagged
Rule 5 • Step is bag large items • There is a large item to bag • The current bag is full • An empty bag is available • WM: • Step is bag large items • Bag is Bag 2 • Ice Cream to be bagged • Crisps to be bagged
Rule 6 • Step is bag large items • WM: • Step is bag medium items • Bag is Bag 2 • Ice Cream to be bagged • Crisps to be bagged
Rule 7 • Step is bag medium items • The medium item is frozen & not in insulated bag • WM: • Step is bag medium items • Bag is insulated bag • Crisps to be bagged
Rule 8 • Step is bag medium items • The current bag is insulated • There is a bag available • WM: • Step is bag medium items • Bag is Bag 3 • Crisps to be bagged
Rule 9 • Step is bag medium items • The current bag empty • A medium item is to be bagged • WM: • Step is bag medium items • Bag is Bag 3 NOTE: The antecedent is disjunctive, so we don’t need to check the other antecedents as the first antecedent is satisfied!
Rule 10 • Step is bag medium items • WM: • Step is done • END!