Lecture Nine - Forward Chaining and Backward Chaining
Lecture Nine - Forward Chaining and Backward Chaining
Chaining
Rule-Based Systems
• The actions will result in a new working memory, and the cycle
begins again.
• This cycle will be repeated until either no rules fire, or some specified
goal state is satisfied.
• Rule-based systems vary greatly in their details and syntax, so the
following examples are only illustrative
1. IF (lecturing X)
AND (marking-practicals X)
THEN ADD (overworked X)
2. IF (month february)
THEN ADD (lecturing ali)
3. IF (month february)
THEN ADD (marking-practicals ali)
4. IF (overworked X)
OR (slept-badly X)
THEN ADD (bad-mood X)
5. IF (bad-mood X)
THEN DELETE (happy X)
6. IF (lecturing X)
THEN DELETE (researching X)
Example
• (overworked ali)
(marking-practicals ali)
(lecturing ali)
(month february)
(happy ali)
(researching ali)
• Now rules 4 and 6 can apply. Suppose rule 4 fires,
and (bad-mood ali) is added to the working
memory.
• And in the next cycle rule 5 is chosen and fires, with
(happy ali) removed from the working memory.
Example
3. IF (month february)
THEN (marking-practicals ali)
4. IF (overworked X)
THEN (bad-mood X)
5. IF (slept-badly X)
THEN (bad-mood X)
6. IF (month february)
THEN (weather cold)
7. IF (year 1993)
THEN (economy bad)
Example