14
Reaction System To ‘bag’ groceries. It does the following: 1. Checks to see if a ‘cross-sale’ can be made. 2. Bags the large items, ensuring bottles are the first items to be bagged. 3. Then bags the medium items, putting frozen items in an insulated bag as necessary. NOTE: The system uses a Rule Ordering conflict resolution strategy!

Reaction System

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Page 1: Reaction System

Reaction System

To ‘bag’ groceries. It does the following:

1. Checks to see if a ‘cross-sale’ can be made.2. Bags the large items, ensuring bottles are the

first items to be bagged.3. Then bags the medium items, putting frozen

items in an insulated bag as necessary.

NOTE: The system uses a Rule Ordering conflict resolution strategy!

Page 2: Reaction System

Items to be Bagged:

Item Packaging Size Frozen?Joint of Beef Styrofoam Tray Medium NoCornflakes Box Large NoIce Cream Tub Medium Yes

Crisps Bag Medium NoPepsi Bottle Large No

These items are placed in the working memory (WM)

Page 3: Reaction System

Working Memory

Step is check orderBag is Bag 1Beef to be baggedCornflakes to be baggedIce Cream to be baggedCrisps to be baggedPepsi to be bagged

Page 4: Reaction System

Rule 1

Crisps are to be baggedPepsi is to be bagged RULE DOES NOT FIRE!

Page 5: Reaction System

Rule 2Step is Check OrderRULE 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

Page 6: Reaction System

Rule 3Step is bag large itemsThere is a large item to bagThere is a bottle to bagThe bag has less than 6 large itemsRULE 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

Page 7: Reaction System

Rule 4 (1)Step is bag large itemsThere is a large item to bagThe bag has less than 6 large itemsWM: 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!

Page 8: Reaction System

Rule 4 (2)Step is bag large itemsThere is a large item to bagThe bag has less than 6 large itemsWM: Step is bag large items Bag is Bag 1 Ice Cream to be bagged Crisps to be bagged

Page 9: Reaction System

Rule 5Step is bag large itemsThere is a large item to bagThe current bag is fullAn empty bag is available WM: Step is bag large items Bag is Bag 2 Ice Cream to be bagged Crisps to be bagged

Page 10: Reaction System

Rule 6

Step is bag large itemsWM: Step is bag medium items Bag is Bag 2 Ice Cream to be bagged Crisps to be bagged

Page 11: Reaction System

Rule 7

Step is bag medium itemsThe medium item is frozen & not in insulated bagWM: Step is bag medium items Bag is insulated bag Crisps to be bagged

Page 12: Reaction System

Rule 8

Step is bag medium itemsThe current bag is insulatedThere is a bag availableWM: Step is bag medium items Bag is Bag 3 Crisps to be bagged

Page 13: Reaction System

Rule 9

Step is bag medium itemsThe current bag emptyA medium item is to be baggedWM: 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!

Page 14: Reaction System

Rule 10

Step is bag medium itemsWM: Step is done END!