Lecture 08.1: Rule-Based Expert Systems
An introduction to Expert Systems, their architecture, and the mechanics of Forward and Backward Chaining.
A computer program capable of performing at a human-expert level in a narrow problem domain area is called an Expert System. Rather than relying on traditional algorithmic logic, these systems use specific knowledge and rules to simulate human decision-making.
The Architecture of a Rule-Based Expert System
The production system model, introduced in the 1970s, forms the core of modern rule-based expert systems. It separates the "rules" of the world from the specific "facts" of the current problem.
- Knowledge Base: Contains domain-specific knowledge formatted as a set of
IF-THENproduction rules (Long-term memory). - Database: Contains facts that are utilized to match the
IFpart of the production rules (Short-term memory). - Inference Engine: The brain of the system. It connects the rules from the knowledge base with the facts in the database to derive solutions.
- Explanation Facilities: Allows the user to ask the system why a particular conclusion was reached or why a specific fact is needed.
- User Interface: The communication medium between the system and the user.
The Five Categories of Rules
In an expert system, rules do not just represent simple conditional tests; they model different facets of human expertise and reasoning. Here are the five primary categories:
1. Relation
Expresses a static relationship or physical link between entities in the domain.
IF the 'fuel tank' is empty
THEN the car is dead2. Recommendation
Advises a specific course of action based on environmental conditions.
IF the season is autumn
AND the sky is cloudy
AND the forecast is drizzle
THEN the advice is 'take an umbrella'3. Directive
Gives a specific command or instruction to resolve a detected problem state.
IF the car is dead
AND the 'fuel tank' is empty
THEN the action is 'refuel the car'4. Strategy
Outlines sequential, procedural steps to troubleshoot or analyze a problem.
IF the car is dead
THEN the action is 'check the fuel tank'; step1 is complete
IF step1 is complete
AND the 'fuel tank' is full
THEN the action is 'check the battery'; step2 is complete5. Heuristic
Represents a rule-of-thumb, shortcut, or empirical observation used by human experts to solve problems quickly without full physical models.
IF the spill is liquid
AND the 'spill pH' < 6
AND the 'spill smell' is vinegar
THEN the 'spill material' is 'acetic acid'Inference Techniques: Forward vs. Backward Chaining
To understand how the Inference Engine reasons, let us use a consistent Knowledge Base and Database:
- Knowledge Base (Rules):
- Rule 1:
- Rule 2:
- Rule 3:
- Rule 4:
- Rule 5:
- Database (Initial Facts):
- Goal: Prove
1. Forward Chaining (Data-Driven Reasoning)
Forward chaining starts with the known facts in the database and works forward, firing rules whose conditions are met to deduce new facts.
Step-by-Step Execution Trace
- Cycle 1:
- Match: The database satisfies the antecedents of Rule 3 (needs ) and Rule 4 (needs ).
- Conflict Resolution: Suppose we fire the topmost matching rule, Rule 3.
- Action: The database is updated: we add the fact .
- New DB: .
- Cycle 2:
- Match: The new database satisfies the antecedent of Rule 2 (needs , which are all present) and Rule 4 (needs ).
- Action: We fire Rule 2.
- New DB: .
- Cycle 3:
- Match: The database satisfies Rule 1 (needs ) and Rule 4 (needs ).
- Action: We fire Rule 1, adding to the database.
- New DB: .
- Cycle 4:
- The goal is now in the database. Reasoning terminates successfully!
- Best Used When: You have all or many facts known, and you want to discover everything that follows from them (e.g., system monitoring, real-time alerts).
2. Backward Chaining (Goal-Driven Reasoning)
Backward chaining starts with the goal we want to prove () and recursively works backward to find rules that can establish it.
Step-by-Step Execution Trace
- Pass 1 (Goal ):
- We search the Knowledge Base for rules that conclude . Rule 1 () is selected.
- To prove , we must prove and .
- We check the database: is present. is missing.
- becomes our new Sub-goal.
- Pass 2 (Sub-goal ):
- We search for rules that conclude . Rule 2 () is selected.
- To prove , we must prove , , and .
- We check the database: and are present. is missing.
- becomes our new Sub-goal.
- Pass 3 (Sub-goal ):
- We search for rules that conclude . Rule 3 () is selected.
- To prove , we must prove .
- We check the database: is present!
- Rule 3 fires. is added to the database. Sub-goal is successfully proven.
- Pass 4 (Sub-goal resolution):
- Now that sub-goal is proven, and are already in the DB, the antecedents for Rule 2 are complete.
- Rule 2 fires. is added to the database. Sub-goal is successfully proven.
- Pass 5 (Goal resolution):
- Now that sub-goal is proven, and is in the DB, the antecedents for Rule 1 are complete.
- Rule 1 fires. is added to the database.
- Goal is successfully proven!
- Best Used When: You have a specific hypothesis in mind and want to verify it without wasting time deriving irrelevant facts (e.g., medical diagnostics, checking eligibility).
Lecture 07.2: Backtracking and Local Search for CSPs
Exploring backtracking algorithms, intelligent heuristics (MRV, Degree, LCV), Forward Checking, and the Min-Conflicts Local Search.
Lecture 08.2: Fuzzy Expert Systems
Handling vagueness and ambiguity using Fuzzy Logic, membership functions, and the four steps of Fuzzy Inference.