135
7.1 What is an expert system?
7 Expert systems
Before starting this chapter you should:
+ be familiar with the terms software, database, ‘hypothesis’ and
‘information.
7.1 What is an expert system?
Expert systems are computer-based systems used to solve problems, such as
providing a diagnosis of something. They make use of the knowledge of a
number of human experts within a specific field. They are unlike other problem-
solving software in that they use reasoning to produce possible solutions. Data,
often referred to as a database of facts is stored within the computer and this is
the knowledge part of a knowledge base. The system uses a set of rules, which
represents the reasoning.
Expert systems can only be used in those areas where human experts already
operate. Clearly defined rules and subject facts must already be in existence.
Expert systems cannot be applied to problems in which there are missing facts,
or in which rules can be interpreted in a variety of ways.
One way of approaching this topic is to think of the internet. The world wide web
contains a huge amount of information or knowledge. This knowledge is used to
solve a problem by you asking questions (making searches). You use the answers to
these questions (searches), which we could argue are possible solutions. You then
consider the possibilities before making a decision on the most appropriate solution.
Let us look at a use of an expert system in the field of medicine. It is used to
help a doctor to make a diagnosis. The doctor types in the symptoms and the
expert system produces a list of possible solutions, each usually with a percentage
probability. The doctor then uses their experience to make a decision, choosing
which of the possibilities produced by the system is likely to be correct.
Expert systems are not like most problem-solving programs. Problem-solving
programs are produced to solve a specific problem. They can only solve that
particular problem and it is difficult to adapt the program to alternative
scenarios. The facts needed to solve the problem are an integral part of the
programming. If the facts change, then the whole program may need to be
rewritten. Compare that with expert systems, which are used to collect the
knowledge of experts in order to help create a
knowledge base.
In this chapter you will learn:
+ what an expert system is
+ whatthecomponentsofanexpertsystem
are
+ howexpertsystemsareusedtoproduce
possible solutions for different scenarios
+ whattheconceptsofforwardandbackward
chaining involve
136
7 EXPERT SYSTEMS
7
There are alternative ways of looking at the make-up of an expert system, but for
the purposes of our text we shall consider the system to be made up of a
shell of
the major components and a knowledge base which comprises the
database of
facts and the rules base (see Figure 7.1).
Explanation system
Inference engine
Knowledge
base editor
User
interface
Shell Knowledge base
Database
of facts
Rules base
V Figure 7.1 A graphic representation of our expert system
As you can see, many of the components are housed within a shell. The shell
often incorporates the knowledge base editor, which is basically software
that allows the knowledge engineer to edit the rules and facts within the
knowledge base to bring them up to date. It also contains the explanation
system
. This is the part of the system which explains the logical reasoning that
the expert system has used to come to its conclusions.
The explanation system causes the expert system to explain to a user how a
particular conclusion was reached and an alternative conclusion was not. It also must
be able to explain why a specific fact was needed, or not, as the case may be. An
expert system must be able to explain its reasoning and justify its recommendations.
The shell of the expert system is very important. A good expert system has a
shell which can be used for solving different problems just by changing the
knowledge base to one that matches the type of problem. The shell of an expert
system, technically speaking, is an expert system with an empty knowledge base.
It can be used for the development of other expert systems by adding a new
knowledge base. It is possible that a diagnostic expert system could be used to
diagnose car faults or medical illnesses just by changing the knowledge base.
Another important feature of an expert system is the user interface. This is the
component that allows the user to interact with the computer which stores
the expert system. It usually consists of a keyboard and mouse together with a
monitor. The questions which need answering are displayed on the monitor. The
user can then manoeuvre round the screen of the monitor using the mouse and
can use the keyboard to type in their responses to the questions. Supplementary
questions are often asked by the system and appear on the screen, which the user
then answers using the keyboard. Validation checks are carried out to ensure the
minimum number of invalid responses are entered by the user.
The
inference engine is another important component of an expert system.
It performs the reasoning of an expert system. It uses a series of IFTHEN
statements within the rules base and interrogates the database of facts in the
knowledge base. It uses inputs from the user to try and match them with the
contents of the database of facts. It processes the rules to try and reach possible
solutions. It can also generate questions via the user interface based on the
inputs it has received so that it can use the answers to narrow down the number
of possible solutions. In short, it produces a set of possible solutions comparing
the inputs with the facts, using the rules contained in the knowledge base.
137
7.2 Different scenarios where expert systems are used
7
When an expert system is created, a knowledge engineer needs to be employed.
Human experts or specialists have deep knowledge of their subject area and
the engineer makes use of this by collecting information from them. This will
consist of the experts’ knowledge and any reasoning strategies that are used by
these experts. The knowledge engineer must also find out from the experts the
type of system they want. In addition, the engineer gathers data from databases
that may exist for the subject area the expert system is being created for. The
knowledge engineer must then design the knowledge base and the rules base.
During the whole process the knowledge engineer and subject expert work
together in order to define the problem the expert system will solve. It is the job
of the engineer to integrate the knowledge into the knowledge base. Then the
inference engine has to be created to provide the reasoning aspect.
Activity 7a
Describe the components of an expert system.
7.2 Different scenarios where expert
systems are used
There are many different uses to which expert systems can be put. In the
following scenarios reference is made to many of the components of these
systems. You must also try to see how the components which are not mentioned
would apply. The knowledge base editor software, for example, is used in much
the same way regardless of the scenario. The same applies to explanation systems
and knowledge engineers.
7.2.1 Mineral prospecting
Expert systems are used to help in making decisions on where to drill for a
specific mineral. They help geologists evaluate whether particular sites are
likely to contain the mineral or ore being searched for. The system produces
probabilities of minerals being found in particular locations. As well as
producing a conclusion about the existence of a particular ore deposit, these
types of system often provide explanations regarding their conclusions. The
expert systems knowledge base will store models of successful drilling sites and
their associated minerals together with a rules base. First of all, the geologist
enters data about the types of rocks and geological structure as well as the
minerals to be found at the site under consideration. The inference engine
then compares this data with the models in the knowledge base using the
IFTHEN rules in the rules base. The system may well ask the geologist
further questions through the user interface and the resulting percentage
probabilities of finding the mineral at this site are produced.
7.2.2 Investment analysis
Expert systems have been developed which act as assistants to financial
advisors at many banks. The financial advisor still makes the final decision,
but the expert system proves to be a very useful tool in helping the advisor
make recommendations to would-be investors. When making a decision, it is
important for the financial advisor to know four things about the investor:
» The amount the client wishes to invest
» What level of risk the investor is willing to take
138
7 EXPERT SYSTEMS
7
» The desired rate of return
» How long the investor is willing to make the investment for.
The user interface asks questions in the everyday language of the investor based
on the above factors. Depending on the answers to the questions, the system
may ask further questions through the user interface. The database of facts will
consist of all the information the bank has gathered over the years about the
performance and stability of different companies. The rules in the rules base
will have been originally created by an expert investor. The expert system will,
however, allow the financial advisor to add rules to the rules base as they see fit,
based on their experience of personally dealing with the investor. The inference
engine will search the database of facts using the rules from the rules base.
The expert system will then produce recommendations for purchasing stocks
or shares in a company, together with the reasons for recommending these
particular stocks and shares.
7.2.3 Financial planning
Today, expert systems in personal financial planning are needed more than ever.
Personal financial planning has become so complex that it is extremely difficult
for one human expert to deal with it. The result is a need for computerised
expert systems to assist in the process. An expert system is different to a
normal computer program in that the problems it addresses tend not to have
a unique solution. There are so many variables to deal with that only a few
can be considered by one person in the time usually available. Expert systems
can be used to create financial plans for individuals. Such plans include
recommendations as to how individuals can manage their debts, reduce the
amount of income tax they pay, and organise investments. These plans can also
recommend the amount of insurance individuals should have and how they
can plan for their retirement. They can also suggest short-term personal saving
targets. Systems often involve the client completing a detailed questionnaire
regarding their personal and economic situation, including income, taxes paid
or due, investments, employee benefits, marital status, number of dependants,
as well as any future obligations such as retirement plans or funding their
childrens university education. The results of the questionnaire are entered
using the user interface. The inference engine analyses this information using
the database of facts and a very large number of rules in the system. The
database uses the results of books and articles which have been published
relating to personal financial planning as well as information gathered from
interviews with experts, such as professional financial advisors. A report would
then be produced by the financial advisor as to the client’s recommended
financial plans. The report would be based on a combination of a human
experts insights and the use of the results of the expert system. The report
would serve as a financial action checklist for the client in order to achieve their
financial plans.
7.2.4 Insurance planning
Insurance involves the use of underwriters. Underwriters are usually banks,
insurance companies or investment companies. They guarantee to pay a certain
amount of money to the person who has taken out the insurance if a particular
event happens. Individuals or organisations can take out insurance for any
number of circumstances. Life insurance is taken out against an individual’s
life. Should the person die then his or her relatives receive a fixed amount of
money. Car insurance is when a person insures their car against damage or theft.
139
7.2 Different scenarios where expert systems are used
7
Property insurance involves safeguarding against damage or destruction to
property.
Insurance can involve the payment of one large sum of money or regular,
usually monthly, payments. Some insurance policies are for a fixed amount of
time. A car is usually insured for a year at a time. At the end of the year the
driver has to renew their insurance. Obviously, if there has been no damage
to the vehicle in that time the underwriter has made some money. The same
applies to life insurance. A life insurance policy usually lasts for a fixed period
of time, such as 10 or 20 years. If the insured person dies within that time the
underwriter has to pay out to their relatives. If the person is still alive then the
underwriter will be able to keep all the monthly payments as profit. There are
many other types of insurance, for example health insurance. With any type of
insurance, the underwriters have to assess the risk involved. How likely is it that
they will have to pay out?
Expert systems are frequently used to assess the risk. In order to set up an expert
system, insurance experts would be interviewed by the knowledge engineer and
all the policies that the underwriter currently offers would be examined. The
results would then be used to create the knowledge base, including the rules
based on those used by the experts when arriving at their decision.
The process of calculating life or health insurance premiums (monthly
payments) involves the consideration of a number of factors, such as the
individuals age, gender, whether or not they smoke, and their general health.
In general terms, the older a person is, the greater amount they have to pay
for their insurance. Men tend to pay more than women as their life expectancy
tends to be lower. Smokers pay a lot more than non-smokers, as again their
life expectancy is shorter. If you are not in good health, then you are a bad
risk to the underwriter and so will pay a lot more than a healthy person. An
insurance expert systems user interface will ask questions of the user and based
on their responses will, through the use of the inference engine, compare
these inputs with the facts in the knowledge base. Using the rules which have
been created, it will produce a recommendation for the cost of the individual’s
premium. It may, of course, recommend that the application be rejected. Many
underwriters use human insurance consultants who will use the expert system’s
recommendations to make a final decision.
7.2.5Carenginefaultdiagnosis
Like any type of mechanical equipment, motor vehicle engines can develop
faults. When this happens, the driver has to seek the help of a mechanic (expert)
who knows a lot about vehicle engines. Modern-day mechanics use expert
systems to help them diagnose the fault. In order to create such an expert
system, many expert mechanics have to be interviewed to gather together their
knowledge and rules (systems) for diagnosing.
Expert systems are now an everyday aid to a car mechanics ability to diagnose
engine faults. The inclusion of complex electronic technologies into a typical
car engine has led to the need for highly complex expert systems. A systematic
approach to the diagnosis of faults is required, as the amount of knowledge
required is so vast and there are many steps which need to be followed in order
to identify the fault.
The use of expert systems is often based on the expert systems user interface
asking questions regarding the problems with the car and the mechanic typing
in the symptoms. The expert system would then supply a list of possible causes
140
7 EXPERT SYSTEMS
7
of the problem and the mechanic would decide which of the suggestions are
most likely.
A second type of expert fault diagnosis system is a device which is plugged into
the car engine’s computer and questions it. We often think these are true expert
systems, in that mechanics can read the results of testing from the expert system
and identify the exact problem that has occurred.
What often happens, in reality, is that true expert systems inform the mechanic
of a range of readings from sensors but do not detail the cause of the problems.
The mechanic has to use their experience and expertise to actually diagnose
the fault. However, new true expert systems have been developed in which the
readings from the sensors are used by an inference engine, after comparison
with those in the knowledge base, to produce a list of possible faults. Although,
again, with this system, the mechanic makes the final decision.
7.2.6 Medical diagnosis
Since early computers were developed, it became apparent that they would
be able to assist medical practitioners in their day-to-day work. Applications
such as drug development and controlling the administration of drugs are
commonplace. Computers are also used as aids when diagnosing illnesses.
Because enormous amounts of data are required, it was originally thought that
expert systems could only be used with large, expensive computers. However,
with the development of more powerful, cheaper PCs and laptops, expert
systems are now readily available to many medical practitioners.
The creation of a medical diagnosis expert system starts with the production
of the shell followed by the knowledge base. The knowledge base is created by
a knowledge engineer, who interviews a number of expert doctors and then
shapes the knowledge into a form that can be easily accessed by the system. The
components of an expert system are used to produce a list of possible diagnoses.
The user interface allows the patient, or doctor, to enter symptoms and, at
the end of the process, displays the output. The knowledge base provides the
database of existing illnesses as well as the rules from the rules base, often IF
THEN rules. The IF part is the symptoms part and the THEN part is the
illness or disease that is suggested. The inference engine searches the knowledge
base for similar symptoms to those entered by comparing those typed in with
those in the knowledge base. This is the reasoning part of the system. The
knowledge base editor allows for the knowledge base to be increased by adding
further rules and data. The explanation system clarifies how the expert system
has produced its possible diagnoses.
Other types of medical diagnosis expert systems have been developed which
allow the patient to interact with the system directly. However, these are only
really suitable for minor complaints and such systems, after considering the
symptoms, will often recommend the patient should visit a human doctor.
7.2.7Routeschedulingfordeliveryvehicles
For most manufacturing companies, the cost of transport is a major part of their
outgoings. Therefore, it is essential that companies use their transport vehicles
as efficiently as possible. It is important that they develop delivery schedules
which prevent vehicles from travelling further than necessary. One of the most
efficient ways of ensuring this is to use an expert system. Human experts have
developed skills which enable them to solve such problems. It is important,
therefore, to incorporate these schedulers’ skills in an expert system. A major
141
7.2 Different scenarios where expert systems are used
7
problem, however, is that there tends to be little agreement about the facts or
rules required in such a knowledge base.
For example, a company which manufactures washing machines might have to
deliver these washing machines to distribution points at the cheapest cost. If
the company is situated in a country which occupies a large area, this makes
the problem rather difficult. It could be that it has several distribution points in
different parts of the country, each with several delivery vehicles, each of which
may be a different size and may be available at different times. The problem
then becomes, how do you ensure that the available vehicles provide coverage
of all the distribution points but travel the least number of miles? The problem
might also need to be broken down into the number of vehicles, size of vehicles,
and loading of the vehicles. Vehicles have to be loaded so that each distribution
point has quick access to its order. The vehicle has to be loaded so that when
it arrives at a distribution point, machines do not have to be climbed over, or
temporarily unloaded, to get to the order for that distribution point. In order to
achieve this, the route for each vehicle has to be planned in advance.
An expert system can have the locations of each distribution point in its
database of facts, together with the type and speed of the vehicle being used,
the total available time and perhaps other constraints such as the topology or
terrain of each road, whether it is mountainous or flat for example. This aspect
of the problem is often referred to as the ‘travelling salesman’ problem. This
refers to the times when a person was employed to travel to different places, to
try to persuade people to buy their company’s goods. The company would pay
them commission, that is, they would receive a small percentage of each sale
they made. It was, therefore, in their own interest to visit as many customers
over a large area in as short a time as possible.
Although there are several linear programming algorithms available to solve
such problems, they tend to take more time and more computer processing
power to get to a solution. The expert system would examine the orders for
the day, total the weights for the order for each location and the inference
engine would match those against the available types of vehicle. The expert
system would suggest an allocation of orders to each vehicle and suggest a list
of machines in reverse order so that each vehicle had the first order loaded on to
the vehicle last. The company’s vehicle scheduler would take these suggestions
from the expert system and decide on the number of vehicles needed and would
know the total time to be taken.
7.2.8Plantandanimalidentification
There are many hundreds of thousands of different species of plants and the
number of different species of animals runs into millions. Identification of
either plants or animals can prove difficult, particularly with rare species, but
it has become extremely important with climate change affecting the existence
of certain species. Experts are required to master a number of techniques and
gather a great deal of knowledge in order to be able to identify plants and/
or animals. They need additional tools to help them identify all the different
species.
When considering plant or animal identification then, an expert system would
be helpful. The inference engine would use a series of IFTHEN rules. Plants
can be possibly divided into whether they are woody or herbaceous. IF they
are woody the system, through the user interface, could ask another question,
such as whether they have a single trunk, which would lead in turn to other
questions based on the shape/type of leaf and so on. Eventually, the possibilities
142
7 EXPERT SYSTEMS
7
would be output through the user interface. The database of facts, which would
be interrogated by the inference engine, would include the data regarding all
knowledge about as many species as possible. This type of system would ask
questions rather than inviting the expert to type in details about the plant.
Animal classification or identification follows a similar pattern.
Activity 7b
1 State the inputs to an investment analysis expert system.
2 State the outputs from an insurance planning expert system.
3 Describe the difficulties involved in producing an expert system for
scheduling routes for delivery vehicles.
7.3 Chaining
When an inference engine interrogates the knowledge base, it imitates the way a
human would use reasoning. It uses what is known as chaining. The reasoning
that the inference engine uses consists of
backward chaining or forward
chaining. Often it uses a combination of both. Here we are going to see how
both forms of reasoning work.
7.3.1Backwardchaining
Backward chaining is often referred to as goal-driven. This is because it starts
with a goal or set of goals that basically establish which rules are to be followed.
It works backwards from the goals. As we said earlier, the rules in an expert
system are based on the IFTHEN construct. When an inference engine uses
backward chaining, it explores the rules the system has been given until it finds
one which has a THEN part that matches a required goal. If the IF part of that
rule is known to be true, then it is added to the list of goals.
Let us look at an example of the use of backward chaining.
Example 7.1 Backward chaining
Suppose a zoo has just received a new animal from Africa. We shall call her
Edwina and she has been delivered in an enclosed trailer. We cannot see
inside the trailer, but we are given two facts about Edwina:
Fact 1: Edwina has hooves.
Fact 2: Edwina can run fast.
We want to know whether Edwina has a striped coat. In terms of using an
expert system, the goal is to decide whether Edwina has a striped coat. We
will use a rules base containing the following four rules:
Rule 1: IF X has hooves and can run fast, THEN X is a zebra.
Rule 2: IF X cannot fly and X is a bird, THEN X is an ostrich.
Rule 3: IF X is a zebra, THEN X has a striped coat.
Rule 4: IF X is a giraffe, THEN X has irregular shaped spots.
We call the part that begins with IF the premise (what we are supposing
could be true). We will call the part that is based on the result of whether the
premise is true, the THEN part, the conclusion.
143
7.3 Chaining
7
Because the selection and use of rules is based on the list of goals, this method
is often called goal-driven.
7.3.2 Forward chaining
We are now going to compare the above method of reasoning with forward
chaining. Forward chaining is often referred to as data-driven, because the data
entered into the system determines which rules are selected and used. When an
inference engine uses forward chaining, it explores the rules the system has been
given until it finds one which has an IF part that is true. It takes the THEN
part to add new facts. This process is repeated until a goal is achieved.
Let us take a different approach to our problem regarding Edwina the zebra.
Using backward chaining, an inference engine can decide whether Edwina has
stripes in four steps. The goal that has to be proved is ‘Edwina has a striped coat’.
Step 1: ‘Edwina’ replaces X in Rule 3 to see if its conclusion matches the
goal, so Rule 3 becomes:
IF Edwina is a zebra, THEN Edwina has a striped coat.
Since the conclusion matches our goal ‘Edwina has a striped coat’, we now
need to see if the premise – Edwina is a zebra – can be proved. So, the
premise now becomes our new goal: ‘Edwina is a zebra.
Step 2: Again, replacing X with ‘Edwina’, in Rule 1, the rule becomes:
IF Edwina has hooves and can run fast, THEN Edwina is a zebra.
Since the conclusion matches the current goal ‘Edwina is a zebra’, the
inference engine now needs to see if the premise – Edwina has hooves and
can run fast – can be proved. The premise therefore becomes the new goal:
‘Edwina has hooves AND can run fast’.
Step 3: Since this goal is a combination of two statements, the inference
engine breaks it down into two sub-goals, both of which must be proved:
‘Edwina has hooves’ and ‘Edwina can run fast’.
Step 4: To prove both of these sub-goals, the inference engine sees that both
of these sub-goals were given as Fact 1 and Fact 2 at the start of this problem.
Therefore, the statement is true: ‘Edwina has hooves AND can run fast’.
The premise of Rule 1 is true and the conclusion must be true: Edwina is a zebra.
It follows that the premise of Rule 3 is true and the conclusion must be true:
Edwina has a striped coat.
Notice that Rules 2 and 4 were not used.
Example 7.2 Forward chaining
Suppose that the goal is to decide the pattern of the coat of Edwina. Again,
we can assume that Edwina has hooves and can run fast and that the rules
base contains the following four rules:
Rule 1: IF X has hooves and can run fast, THEN X is a zebra.
Rule 2: IF X cannot fly and X is a bird, THEN X is an ostrich.
Rule 3: IF X is a zebra, THEN X has a striped coat.
Rule 4: IF X is a giraffe, THEN X has irregular shaped spots.
Again, we have two known facts:
144
7 EXPERT SYSTEMS
7
The difference in approaches is that backward chaining starts with us having a
goal to achieve or an assertion we are trying to prove. We think Edwina has a
striped coat, but we need to prove it. With forward chaining we do not know
what type of coat Edwina has but we want to find out.
Activity 7c
Explain, by referring to the IFTHEN construct, the use of the words ‘forward
and ‘backward’ when applied to methods of chaining.
7.3.3Applicationsofforwardandbackwardchaining
Generally, the choice of chaining strategy depends on the type of problem.
Forward chaining, we know, is data-driven. The inference engine starts with
the facts of the case and progresses to a goal or conclusion. This approach is
thus determined by the facts available and by the premises that can be met. The
inference engine attempts to match the condition (IF) part of each rule in the
rules base with the facts which have been input. Forward-chaining systems are
commonly used to solve more open-ended problems of a design or planning
nature, such as establishing the configuration of a computer system. Backward
chaining on the other hand is goal-driven. If there are very few possible goals or
conclusions, this is a better approach to take. Backward chaining is best suited
to problems where the possible conclusions are few and well defined.
Diagnoses
Expert systems have been associated with diagnosis applications for many years.
Classification systems or diagnosis applications are best suited to backward
chaining as there are few possible conclusions which need to be checked against
the data. Backward chaining is the best choice if the goal can be sensibly
guessed at the beginning of a consultation. Forward chaining is the best choice
if all the facts are provided at the outset or there is not any sensible way to
guess what the goal is at the beginning of a consultation. A backward-chaining
system is more likely to cause questions to be asked which seem focused and in
an order that appears logical to the user. In an expert system used for diagnosis,
it is important that the system should seem to behave like a human expert. In
this case, backward chaining would usually be the most appropriate method.
Diagnosis applications tend to have a fixed number of possible solutions which
makes backward chaining more suitable.
Fact 1: Edwina has hooves.
Fact 2: Edwina can run fast.
With forward chaining, the inference engine can deduce that Edwina has a
striped coat by using the following steps:
Step 1: Since the facts we are given show that Edwina has hooves and
Edwina can run fast, the premise of Rule 1 is matched by replacing X with
‘Edwina’ (IF Edwina has hooves and can run fast). The inference engine
comes to the conclusion: Edwina is a zebra.
Step 2: We can now use Rule 3 by replacing X with ‘Edwina’ (IF Edwina is a
zebra). The inference engine comes to the conclusion: Edwina has a striped
coat.
145
7.3 Chaining
7
To sum up, the choice of chaining method depends on the problem. If you
have clear hypotheses, backward chaining is likely to be a better solution. It
can be used for classification systems such as animals and plants. Forward
chaining would be preferred if you have no clear hypothesis and want to see
what can be concluded from the current state of affairs. Despite this, however,
most expert system applications tend to use a mixture of forward and backward
chaining. A number of diagnosis expert systems actually begin by using forward
chaining and this is why this approach was described in such detail in the
medical diagnosis section on page 140. It is often the case that in a face to face
consultation the doctor would be aware of all the facts of the case.
Gaming
How does an expert system work within computer gaming? Let us consider
the most popular type of game, which involves the use of non-player characters
(NPCs). The goal of the expert system in this case is to select which weapon
is to be used during the course of the game by an NPC. Every game is a form
of animation which consists of individual pictures called frames, in a sequence
of moving images. The choice of weapon in a game will depend on a number
of different variables that are changing in every frame of the game. The expert
system is required to make a decision. The input variables may be the distance to
the target, the type of target and the range of the weapon. The system will need
to output the type of weapon, why it was chosen, as well as the characteristics
of the weapon. When setting up the system the knowledge engineer would
have gathered from the game expert known facts such as individual weapon
characteristics and their range, as well as which weapon is best for achieving
the goal of eliminating the target. As the contents of the frame are constantly
changing, the NPC will constantly have to re-evaluate the situation, much like a
human player. Creation of an expert system will improve game play and provide
a challenge, with the NPC making its own decisions on weapon selection.
The inference engine in such a system tends to use forward chaining. As we have
seen, this method uses the data or facts which are input to the system and uses
rules to determine a goal. Using the forward-chaining method, a series of IF
statements are executed that sort through the data to THEN find a goal. The
goal in this case is to select an appropriate weapon. These IF questions could,
for example, be based on whether the target is a missile of some sort or another
player. The THEN part will be the recommended type of weapon.
A good example of backward chaining in computer games is found in the
game of chess. In chess, there are a fixed number of moves to reach a winning
position. To compute all the possible ways of reaching a winning position,
the system chains backwards and builds up a list of possible ways to get to the
winning position. Backward chaining involves using all the possible premises
which lead to getting a ‘checkmate’ conclusion. Backward chaining is used in
gaming with games that have fewer rules.
Artificial intelligence
Artificial intelligence (AI) can be thought of as a piece of software that
simulates or mimics the behaviour and judgement of a human being. It involves
the system being able to learn, reason and assess its own actions. In AI, forward
chaining can be used to solve logic problems using rules and previous learning
to find solutions to problems. An AI might use forward chaining to look at the
available information, answer a question or solve a problem. Forward chaining
works through the logic of a problem from beginning to end.
146
7 EXPERT SYSTEMS
7
There are countless applications of AI: in the healthcare industry for dosing
drugs (calculating the dose of drugs to be given to a patient) and suggesting
different treatment for patients; in surgical procedures in operating theatres in
hospitals; in computers that play chess and in self-driving cars. Each of these
machines must be able to consider each action it takes, as each action will
have an impact on the end result. In chess, its goal is to get its opponent in
checkmate; in self-driving cars, its goal is to get from A to B without crashing.
AI can also be used in the financial sector, where it can alert fraud departments
to unusual spending patterns on a bank card or large amounts of money being
deposited in bank accounts.
Another example of AI is in the field of robotics where basic expert systems
are incorporated. These tend to use forward chaining where there is a clearly
defined goal, such as moving from one spot to another, although the variables
and obstacles may be numerous. Natural language processing (NLP) is another
application of AI. The goal is for people to be able to converse with computers
and computers being able to understand. Such systems tend to use a mixture of
forward and backward chaining.
Examination-style questions
1 Doctors often use expert systems to help them diagnose illnesses.
Explain how an expert system would work in this situation.
[6]
2
An expert system consists of many components. Describe the role of a
knowledge base in such a system.
[4]
3
Expert systems often use forward chaining or backward chaining when
producing suggestions. Explain what is meant by:
a forward chaining [3]
b
backward chaining. [3]