This document describes the steps involved in designing an expert system for automobile diagnosis using a forward chaining rule-based approach. It outlines defining the problem of hard starting, input data like start-up rules, and a data-driven structure. An initial set of rules is written to test the cranking, ignition, and fuel systems. The knowledge base and working memory are populated with sample rules and facts. Finally, designing the user interface in parallel is discussed.
3. Introduction
• Consider a small problem in automobile
diagnosis.
• Review the step involved in this task as an
example of typical course taken when
developing forward chaining rule based
systems.
4. Steps
• Define the problem
• Define the input data
• Define the structure (data driven)
• Write initial code
• Test
• Design the interface
• Expand the system
• Evaluate the system
5. Automobile Diagnosis
• Attractive area
– Useful
– Rules readily available
• Typically diagnostic systems are based on
backward chaining.
• Since there can be a number of problems
leading to a large set of facts hence it may
be advisable to use FWD chaining
• Inherently data driven approach to solving
automobile diagnosis problem, therefore
more natural to use forward chaining.
6. Task 1: Define the Problem
• Learn about automobile diagnostics. Possible
sources of information
– A good car mechanic
– A trouble-shooting manual
• Auto-repair manuals
– Series of tests to identify problem.
– Decision trees
– Checklist type tests
– Sections grouped by principal problems
– Narrowing down problems: subsystems
• Problem to diagnose is hard starting
8. Decision tree
Durkin Fig 10.1
Engine does not start
Cranking system good
Ignition system good
Fuel system good
Cranking system bad
Ignition system bad
Fuel system bad
Test Cranking
system
Test Ignition
system
Test Fuel
system
Test Compression
system
9. 1 - Problem Specifications
• Scope
– ‘Engine does not start’ problems
– Address only cranking problems
10. 2 - Define Input Data
• Start-up Rule (auto fire on start up)
Rule 1: Start
IF Task is Start
THEN Ask what is the problem?
11. 3 - Define Structure
• Data driven structure
• Incorporate flow control into the premises
of rules, e.g.
IF Task is test engine --- Type of test
AND Lights are dim --- Result
THEN test battery --- Proceed to
12. 4 - Write initial code
• Subset of rules that capture the general
structure.
• Purpose: To verify that we have effectively
captured the problems knowledge in our
rule structure.
• A good structure is one that not only
provides correct results but also a
template to follow for the development of
other rules
13. Knowledge Base
Rule 1: IF Task is start
THEN Ask problem
Rule 2: IF problem is car does not
start
THEN Task is to test
cranking system
Rule 3: IF problem is car gives
problem at high speeds
THEN Task is test fuel
system
Working Memory
Task is start
What is the problem?
-car does not start
-car gives problem at
at high speeds
14. Knowledge Base
Rule 1: IF Task is start
THEN Ask problem
Rule 2: IF problem is car does not
start
THEN Task is to test
cranking system
Rule 3: IF problem is car gives
problem at high speeds
THEN Task is test fuel
system
Working Memory
Task is start
Problem is car does
not start
15. Knowledge Base
Rule 1: IF Task is start
THEN Ask problem
Rule 2: IF problem is car does not
start
THEN Task is to test
cranking system
Rule 3: IF problem is car gives
problem at high speeds
THEN Task is test fuel
system
Working Memory
Problem is car does
not start
Task is to test
cranking system
16. Knowledge Base
Rule 4: IF Task is to test cranking
system
THEN Ask how engine turns
Rule 5: IF Task is to test cranking
system
AND engine turns slowly/doesn’t
turn
THEN Cranking system is not
working
AND Task is to test battery
connection
Rule 6: IF Task is to test cranking
system
AND Engine turns normally
THEN Cranking system is
working
AND Task is to test ignition
system
Working Memory
Problem is car does
not start
Task is to test
cranking system
How does the engine
turn upon ignition?
-slowly/doesn't turn
-normally
17. Knowledge Base
Rule 4: IF Task is to test cranking
system
THEN Ask how engine turns
Rule 5: IF Task is to test cranking
system
AND engine turns slowly/doesn’t
turn
THEN Cranking system is not
working
AND Task is to test battery
connection
Rule 6: IF Task is to test cranking
system
AND Engine turns normally
THEN Cranking system is
working
AND Task is to test ignition
system
Working Memory
Problem is car does
not start
Task is to test
cranking system
Engine turns
slowly/doesn’t turn
18. Knowledge Base
Rule 7: IF Task is to test battery connection
THEN Ask about Screwdriver test
Rule 8: IF Task is to test battery connection
AND Screwdriver test shows that
lights brighten
OR Screwdriver test shows that lights
do not turn on
THEN Problem is a bad battery
connection
Rule 9: IF Task is to test battery connection
AND Screwdriver test shows that
lights don’t brighten
THEN Battery connection is good
AND Task is test battery
Working Memory
Problem is car does
not start
Engine turns
slowly/doesn’t turn
•Cranking system is not
working
•Task is to test battery
connection
Do screwdriver test.
What happens to the
lights?
-brighten
-not on
-don’t brighten
19. Knowledge Base
Rule 7: IF Task is to test battery connection
THEN Ask about Screwdriver test
Rule 8: IF Task is to test battery connection
AND Screwdriver test shows that
lights brighten
OR Screwdriver test shows that lights
do not turn on
THEN Problem is a bad battery
connection
Rule 9: IF Task is to test battery connection
AND Screwdriver test shows that
lights don’t brighten
THEN Battery connection is good
AND Task is test battery
Working Memory
Problem is car does
not start
Engine turns
slowly/doesn’t turn
•Cranking system is not
working
•Task is to test battery
connection
•Screwdriver test shows
that lights brighten
20. Knowledge Base
Rule 7: IF Task is to test battery connection
THEN Ask about Screwdriver test
Rule 8: IF Task is to test battery connection
AND Screwdriver test shows that
lights brighten
OR Screwdriver test shows that lights
do not turn on
THEN Problem is a bad battery
connection
Rule 9: IF Task is to test battery connection
AND Screwdriver test shows that
lights don’t brighten
THEN Battery connection is good
AND Task is test battery
Working Memory
Problem is car does
not start
Engine turns
slowly/doesn’t turn
•Cranking system is not
working
•Task is to test battery
connection
•Screwdriver test shows
that lights brighten
•Problem is a bad
battery connection
21. Design the Interface
• Begin design of interfaces in parallel with
development of rules
• Interfaces interactive
• Graphical user interface
• Display screens
– Introduction screen
– Intermediate findings screen
– Conclusions
• Question screens
Editor's Notes
1)Obtain a general understanding of the problem
define the project objective
major problem issues
how experts deal with the information to reach a recommendation
2)Remember that unlike backward chaining systems that start with a goal and then works back through the rules to prove the goal, forward chaining systems work with the given information and rules to generate new information.
3)In backward chaining the inference engine directs the control from the goal to sub-goals. You as a programmer just write the rules and expect the inference engine to work out the strategy for using the rules to prove any given goal. This is not true for forward chaining rule based systems, where you have to explicitly lay down the control, since on its own the inference engine will simply match fire rules whose premises match the given information. You cannot allow this to happen in an unconstrained manner. As we will see in the course of this case study, we have to lay down a control strategy.
4)Designing an expert system is an ITERATIVE process. You start with a small set of rules, test them, and then incrementally add new knowledge to the system.
Typically diagnostic problems are based on backward chaining, because intuitively you set the fault as your goal and ask the system to work with it. But when the number of possible faults grows large this is harder to do. E.g in the automobile diagnostic system, there may be hundreds of possible faults, you cannot make that many goal rules. It would be impractical. Instead an expert starts with some important information, then gathers other important clues along the course of the investigation to come up with a diagnosis. This style of problem solving is inherently data driven and best managed with a forward chaining rule based system.
Manuals: For most diagnosis problems, e.g automobile, plumbing, clock repair, manuals exist that can aid in trouble shooting. They are developed by the relevant industry to aid technicians to carry out these tasks in a step-by-step methodical manner. Ease of availability and ease of use are two attributes a manual must have to be useful to us. Auto-repair manuals fortunately are readily available.
Decision tree for ‘engine does not start problems’
Notice that this process is heuristic in nature. The order in which the various systems are tested follows a path that is heuristically most likely to find the fault.
Durkin Fig10.1
Every forward chaining rule based system needs to first obtain some initial data to get started. Therefore, we need to write a rule whose only task is to get some information about the problem. This type of rule is called a start-up rule and fires automatically upon starting the system. When it fires it asks a question. For our system we want it to ask the user about the general nature of the problem. Q) What is the problem; Car wont start, car hesitates at high speeds. After the user answers the initial question the systems directs the problems solving process.
To keep our system simple, we will only ask to cater to the problems ‘car wont start’. Then the system interactively asks the user to answer questions to guide the system through to a logical conclusion
In addition to lights don’t brighten, we add a premise that controls the firing of the rule (only when the engine is being tested, will this rule fire)
Test our small set of rules. Lets dry run our set of rules to test our structure.
Test our small set of rules. Lets dry run our set of rules to test our structure.
Test our small set of rules. Lets dry run our set of rules to test our structure.
Test our small set of rules. Lets dry run our set of rules to test our structure.
Test our small set of rules. Lets dry run our set of rules to test our structure.
Test our small set of rules. Lets dry run our set of rules to test our structure.
Test our small set of rules. Lets dry run our set of rules to test our structure.
Test our small set of rules. Lets dry run our set of rules to test our structure.