1
EXPERT SYSTEMS NOTES
(A). D E F I N I T I O N
Systems that use human knowledge captured in computers to solve problems that ordinarily require human
expertise. Human experts include medical doctors, computer hardware engineers, vehicle mechanics,
economists, weather forecasters, geologists, etc.
(B). C O M P O N E N T S
(i). Knowledge Acquisition System:
System for accumulation, transfer, and transformation of problem solving expertise from experts or
documented sources into a computer program.
Sources of Knowledge: human experts, text books, multimedia documents, databases, research
reports, web, etc.
(ii). Knowledgebase
Contains the knowledge necessary for understanding, formulation, and solving problems.
Elements: Facts (such as problem situation and theory of the problem area), and rules (that direct the
use of the knowledge to solve problems).
(iii). Inference Engine
The ‘brain’ of the expert system. It’s the control structure or rule interpreter. It’s a program that
provides a methodology for reasoning about the information in the knowledgebase.
Components
(I). The interpreter: Te rule interpreter.
(II). A scheduler: Maintains conrol over the agenda.
(III). A consistency enforcer: Attempts to maintain a consistent representation of the emerging
solution.
(iv). User Interface
A language processor. It provides a friendly, problem oriented communication between the user and
the computer.
(v). Blackboard (Workplace)
An area in the working memory set aside for the description of the current problem.
(vi). Explanation (Justifier)
Explain why conclusions have been reached, why a question has been asked, why some alternatives
were rejected, etc.
(vii). Knowledge Refining System
It analyzes the existing knowledge, learns from it, and improves it for future consultation.
(C). P E R S O N S C O N C E R N E D I N E X P E R T S Y S T E M S
(i). Expert
The human being with extensive knowledge, judgment, experience and methods along with the ability
to apply these talents to give advice and solve problems.
(ii). Knowledge Engineer
Helps the expert structure the problem oriented area by interpreting and intergrating human answers
to question, drawing analogies, posing counter examples, and bringing to light conceptual difficulties.
Also the system builder.
(iii). The User
2
The non-expert seeking advice, a student who wants to learn (The ES is the instructor), An ES
builder who wants to increase the knowledgebase.
(iv). Other Participants
System builder (to integrate the ES with other systems), tool builder (Builds specific tools),
Vendors (Provides tools and advice), support staff (Provides clerical and technical help).
(D). P R O B L E M A R E A S
(i). Interpretation Systems: Explains observed data.
E.g. Surveillance, speech understanding, image analysis, signal interpretation.
(ii). Prediction Systems: Infer likely consequences of given situations.
E.g. Weather forecasting, demographics predictions, economic forecasting, traffic predictions, crop
estimates, military, marketing, financial forecasting.
(iii). Diagnostic Systems: Infer system malfunctions from observations.
E.g. Medical, electronic, mechanical, software diagnostic systems.
(iv). Design systems: Configure objects under constraints.
(v). Planning Systems: E.g. project planning, management, routing, communications, product
development, military application, financial planning.
(vi). Monitoring Systems: E.g. Air control, fiscal management.
Etc.
(E). C O M P A R I S O N W I T H C O N V E N T I O N A L P R O G R A M S
Conventional Programs Expert Systems
Information, processing usually combined in one Knowledgebase clearly separate from the
sequential program. processing (inference)
Program does not make mistakes Program may make mistakes
Do not (usually) explain why input data is needed Explanation is part of most expert systems
or why conclusions reached
Require all input data. May not function properly Do not require all initial facts. Typically can arrive
with missing data at reasonable conclusion with missing facts
Changes in program are tedious Changes in rules are easy to make
Program operates only when complete Program can operate with only a few rules
Execution done step by step Execution done by using rules (heuristics) and logic
Effective manipulation of large databases Effective manipulation of large knowledge bases
Representation and use of data Representation and use of knowledge
Efficiency is the major goal (e.g. program should Effectiveness is the major goal (e.g. how good an
be as small as possible) advice/conclusion is)
Easily deal with quantitative data Easily deal with qualitative data
Use numerical data representations Use symbolic knowledge representations
(F). E X E R C I S E S
(i). Explain the meaning of the term expert system. Describe its components.
(ii). Describe four types of problems that are solved by expert systems.
(iii). Explain the human elements in expert systems.
(iv). Explain five differences between expert systems and conventional programs.
3
CAT 1 (1)
The following is the code of a sales knowledgebase. It lists categories of items (category name,
reorder level, reorder quantity, discount level, discount quantity), items’ details (item name, category,
price and quantity in stock) and sales details (customer, sale date, item sold, quantity sold).
category(stationery, 30, 200, 10, 2).
category(books, 10, 30, 3, 2).
category(consumables, 50, 300, 15, 3).
item(pen, stationery, 10, 150).
item(colgate_small, consumables, 20, 65).
item(colgate_medium, consumables, 45, 70).
item(colgate_big, consumables, 70, 34).
item(juice_small, consumables, 45, 23).
item(juice_medium, consumables, 60, 23).
item(juice_big, consumables, 80, 12).
item(book, stationery, 5, 65).
item(pencil, stationery, 7, 56).
item(newspaper, books, 50, 400, 100, 1).
sale(tom, 1/1/22, pen, 3).
sale(peter, 1/1/22, book, 85).
sale(peter, 1/1/22, juice_small).
sale(alice, 7/1/22, pen, 10).
sale(alice, 7/1/22, book, 5).
sale(patrick, 12/1/22, pen, 7).
Required
(I). Write the possible values of the variable Item when the following query is executed.
sale(_, _, Item, Q), item(Item. _, _, S), Q>S.
(II). (a). Explain the work of the following rule (sub program).
when_sold(Item):-item(Item,_, _, _), sale(_, Date, Item, Qua),
nl, write(Date), write(' '), write(Qua), nl, fail.
NB: The operator fail forces backtracking i.e. repeating the function for more possibilities
i.e. we repeat for each item in the knowledgebase.
(b). Write down the output of the queries below using the above rule (in II(a)).
when_sold(pen).
when_sold(Item).
(c). Explain the work of the keyword fail. What will be the output in (II (b)) above if the
keyword fail is omitted in the above rule?
(III). Design the following rules;
(a). out_of_stock(Item) that determines any item (Item) that is out of stock (it’s stock is less
than the reorder level of its category).
Answer
out_of_stock (X): - item (X, Cat, Pri, Sto), category (Cat, Reo, _, _, _), Sto<Reo.
(b). dates_sold(Category) that lists the date a particular category (Category) was sold.
(c). amount_for(Customer) that lists the amount for a customer’s sale.
(d). unsold(Category) that determines any category (Category) that has never been sold.
Hint: Use not operator.
4
NB: fail
Program to output all parent relationships in family knowledgebase
show:- parent(A, B), write (A), write (‘is parent to ‘), write(B), nl, fail.