ICS 2404 Artificial Intelligence
ICS 2404 Artificial Intelligence
ICS 2404 Artificial Intelligence
Artificial Intelligence (AI) is a branch of Science which deals with helping machines finding
solutions to complex problems in a more human-like fashion. This generally involves
borrowing characteristics from human intelligence, and applying them as algorithms in a
computer friendly way. A more or less flexible or efficient approach can be taken depending
on the requirements established, which influences how artificial the intelligent behaviour
appears.
AI is generally associated with Computer Science, but it has many important links with other
fields such as Maths, Psychology, Cognition, Biology and Philosophy, among many others.
Our ability to combine knowledge from all these fields will ultimately benefit our progress in
the quest of creating an intelligent artificial being.
Historically, all four approaches have been followed. The following are some of the
approaches.
Turing's test deliberately avoided direct physical interaction between the interrogator and the
computer, because physical simulation of a person is unnecessary for intelligence. However,
the so-called total Turing Test includes a video signal so that the interrogator can test the
subject's perceptual abilities, as well as the opportunity for the interrogator to pass physical
objects ``through the hatch.'' To pass the total Turing Test, the computer will need
computer vision to perceive objects, and
Robotics to move them about.
Within AI, there has not been a big effort to try to pass the Turing test. The issue of acting
like a human comes up primarily when AI programs have to interact with people, as when an
expert system explains how it came to its diagnosis, or a natural language processing system
has a dialogue with a user. These programs must behave according to certain normal
conventions of human interaction in order to make themselves understood. The underlying
representation and reasoning in such a system may or may not be based on a human model.
Thinking humanly: The cognitive modelling approach
If we are going to say that a given program thinks like a human, we must have some way of
determining how humans think. We need to get inside the actual workings of human minds.
There are two ways to do this:
Through introspection (trying to catch our own thoughts as they go by).
Through psychological experiments. Once we have a sufficiently precise theory of the mind,
it becomes possible to express the theory as a computer program. If the program's
input/output and timing behaviour matches human behaviour, that is evidence that some of
the program's mechanisms may also be operating in humans.
Thinking rationally: The laws of thought approach
The Greek philosopher Aristotle was one of the first to attempt to codify ``right thinking,''
that is, irrefutable reasoning processes. His famous syllogisms provided patterns for
argument structures that always gave correct conclusions given correct premises. For
example, ``Socrates is a man; all men are mortal; therefore Socrates is mortal.'' These laws of
thought were supposed to govern the operation of the mind, and initiated the field of logic.
By 1965, programs existed that could, given enough time and memory, take a description of a
problem in logical notation and find the solution to the problem, if one exists. (If there is no
solution, the program might never stop looking for it.) The so-called logicist tradition within
artificial intelligence hopes to build on such programs to create intelligent systems.
Acting rationally: The rational agent approach
Acting rationally means acting so as to achieve one's goals, given one's beliefs. An agent is
just something that perceives and acts. In this approach, AI is viewed as the study and
construction of rational agents.
Areas of Artificial Intelligence
Perception
Machine Vision: It is easy to interface a TV camera to a computer and get an image into
memory; the problem is understanding what the image represents. Vision takes lots of
computation; in humans, roughly 10% of all calories consumed are burned in vision
computation. Speech Understanding: Speech understanding is available now. Some systems
must be trained for the individual user and require pauses between words. Understanding
continuous speech with a larger vocabulary is harder.
Touch(tactile or haptic) Sensation: Important for robot assembly tasks.
Robotics
Although industrial robots have been expensive, robot hardware can be cheap: Radio Shack
has sold a working robot arm and hand for $15. The limiting factor in application of robotics
is not the cost of the robot hardware itself. What is needed is perception and intelligence to
tell the robot what to do; ``blind'' robots are limited to very well-structured tasks (like spray
painting car bodies).
Planning
The task of coming up with a sequence of actions that will achieve a goal is called planning
Planning attempts to order actions to achieve goals. Planning applications include logistics,
manufacturing scheduling, planning manufacturing steps to construct a desired product.
There are huge amounts of money to be saved through better planning.
Intelligent training.
Theorem Proving
Proving mathematical theorems might seem to be mainly of academic interest.
However, many practical problems can be cast in terms of theorems. A general
theorem prover can therefore be widely applicable. Examples:
Automatic construction of compiler code generators from a description of a CPU's
instruction set.
J Moore and colleagues proved correctness of the floating-point division algorithm on
AMD CPU chip.
Symbolic Mathematics
Game Playing
Games are good vehicles for research because they are well formalized, small, and self-
contained. They are therefore easily programmed. Games can be good models of competitive
situations, so principles discovered in game-playing programs may be applicable to practical
problems.
Although knowledge representation is one of the central and in some ways most familiar
concepts in AI, the most fundamental question about it--What is it?--has rarely been
answered directly. Numerous papers have lobbied for one or another variety of
representation, other papers have argued for various properties a representation should have,
while still others have focused on properties that are important to the notion of representation
in general.
What is a knowledge representation? We argue that the notion can best be understood in
terms of five distinct roles it plays, each crucial to the task at hand:
Expert Systems
What is an Expert System?
Jackson (1999) provides us with the following definition:
An expert system is a computer program that represents and reasons with knowledge of some
specialist subject with a view to solving problems or giving advice.
To solve expert-level problems, expert systems will need efficient access to a substantial
domain knowledge base, and a reasoning mechanism to apply the knowledge to the
problems they are given. Usually they will also need to be able to explain, to the users who
rely on them, how they have reached their decisions.
They will generally build upon the ideas of knowledge representation, production rules,
search, and so on.
Often we use an expert system shell which is an existing knowledge independent framework
into which domain knowledge can be inserted to produce a working expert system. We can
thus avoid having to program each new system from scratch.
There are no fundamental limits on what problem domains an expert system can be built to
deal with. Some typical existing expert system tasks include:
The process of building expert systems is often called knowledge engineering. The
knowledge engineer is involved with all components of an expert system:
Building expert systems is generally an iterative process. The components and their
interaction will be refined over the course of numerous meetings of the knowledge engineer
with the experts and users. We shall look in turn at the various components.
Knowledge Acquisition
The knowledge acquisition component allows the expert to enter their knowledge or expertise
into the expert system, and to refine it later as and when required.
Historically, the knowledge engineer played a major role in this process, but automated
systems that allow the expert to interact directly with the system are becoming increasingly
common.
The knowledge acquisition process is usually comprised of three principal stages:
1. Knowledge elicitation is the interaction between the expert and the knowledge
engineer/program to elicit the expert knowledge in some systematic way.
2. The knowledge thus obtained is usually stored in some form of human friendly way.
Intermediate representation.
3. The intermediate representation of the knowledge is then compiled into an executable
form (e.g. production rules) that the inference engine can process.
Knowledge Elicitation
The knowledge elicitation process itself usually consists of several stages:
1. Find as much as possible about the problem and domain from books, manuals, etc. In
particular, become familiar with any specialist terminology and jargon.
2. Try to characterise the types of reasoning and problem solving tasks that the system will be
required to perform.
3. Find an expert (or set of experts) that is willing to collaborate on the project.
Sometimes experts are frightened of being replaced by a computer system.
4. Interview the expert (usually many times during the course of building the system). Find
out how they solve the problems your system will be expected to solve. Have them check and
refine your intermediate knowledge representation.
This is a time intensive process, and automated knowledge elicitation and machine learning
techniques are increasingly common modern alternatives.
One problem that knowledge engineers often encounter is that the human experts use
tacit/implicit knowledge (e.g. procedural knowledge) that is difficult to capture.
There are several useful techniques for acquiring this knowledge:
1. Protocol analysis: Tape-record the expert thinking aloud while performing their role and
later analyse this. Break down the their protocol/account into the smallest atomic units of
thought, and let these become operators.
2. Participant observation: The knowledge engineer acquires tacit knowledge through
practical domain experience with the expert.
3. Machine induction: This is useful when the experts are able to supply examples of the
results of their decision making, even if they are unable to articulate the underlying
knowledge or reasoning process.
Which is/are best to use will generally depend on the problem domain and the expert.
1. Match the premise patterns of the rules against elements in the working memory.
Generally the rules will be domain knowledge built into the system, and the working memory
will contain the case based facts entered into the system, plus any new facts that have been
derived from them.
2. If there is more than one rule that can be applied, use a conflict resolution strategy to
choose one to apply. Stop if no further rules are applicable.
3. Activate the chosen rule, which generally means adding/deleting an item to/from working
memory. Stop if a terminating condition is reached, or return to step 1.
Early production systems spent over 90% of their time doing pattern matching, but there is
now a solution to this efficiency problem:
The Expert System user interface usually comprises of two basic components:
1. The Interviewer Component
This controls the dialog with the user and/or allows any measured data to be read into the
system. For example, it might ask the user a series of questions, or it might read a file
containing a series of test results.
2. The Explanation Component
This gives the system’s solution, and also makes the system’s operation transparent to that
conclusion. It might instead explain why it could not reach a conclusion.
So that is how we go about building expert systems.
AI Technique.
Intelligence requires knowledge but knowledge possesses less desirable properties such as
It is voluminous
it is difficult to characterise accurately
it is constantly changing
it differs from data by being organised in a way that corresponds to its application
The knowledge captures generalisations; situations that share properties, are grouped
together, rather than being allowed separate representation.
It can be understood by people who must provide it; although for many programs the
bulk of the data may come automatically, such as from readings. In many AI domains
people must supply the knowledge to programs in a form the people understand and in
a form that is acceptable to the program.
It can be easily modified to correct errors and reflect changes in real conditions.
It can be widely used even if it is incomplete or inaccurate.
It can be used to help overcome its own sheer bulk by helping to narrow the range of
possibilities that must be usually considered.
Disadvantages:
1. May find a sub-optimal solution (one that is deeper or more costly than the best solution).
2. Incomplete: without a depth bound, may not find a solution even if one exists.
Bounded Depth-First Search
Depth-first search can spend much time (perhaps infinite time) exploring a very deep path
that does not contain a solution, when a shallow solution exists. An easy way to solve this
problem is to put a maximum depth bound on the search. Beyond the depth bound , a failure
is generated automatically without exploring any deeper.
Problems:
1. It's hard to guess how deep the solution lies.
2. If the estimated depth is too deep (even by 1) the computer time used is dramatically
increased.
3. If the estimated depth is too shallow, the search fails to find a solution; all that computer
time is wasted.
Iterative Deepening Iterative deepening begins a search with a depth bound of 1, then
increases the bound by 1 until a solution is found. Advantages:
1. Finds an optimal solution (shortest number of steps).
2. Has the low (linear in depth) storage requirement of depth-first search.
Disadvantage:
1. Some computer time is wasted re-exploring the higher parts of the search tree. However,
this actually is not a very high cost.
2. Cost of Iterative Deepening
3. In general, (b - 1) / b of the nodes of a search tree are on the bottom row. If the branching
factor is b = 2, half the nodes are on the bottom; with a higher branching factor, the
proportion on the bottom row is higher.
Heuristics Search
A heuristic is a method that might not always find the best solution but is guaranteed to find a
good solution in reasonable time. By sacrificing completeness it increases efficiency. It is
particularly useful in solving tough problems which could not be solved any other way and if
a complete solution was to be required infinite time would be needed i.e. far longer than a
lifetime.
To use heuristics to find a solution in acceptable time rather than a complete solution in
infinite time. The next example illustrates the requirement for heuristic search as it needs a
very large time to find the exact solution.
Example:
The travelling salesman problem
A salesperson has a list of cities to visit and she must visit each city only once. There are
distinct routes between the cities. The problem is to find the shortest route between the cities
so that the salesperson visits all the cities once. Suppose there are N cities then a solution that
would work would be to take all N! possible combinations and to find the shortest distance
that being the required route. This is not efficient as with N=10 there are 3 628 800 possible
routes. This is an example of combinatorial explosion.
There are better methods for solution, one is called branch and bound.
Generate all the complete paths and find the distance of the first complete path. If the next
path is shorter save it and proceed in this way abandoning any path when its length so far
exceeds the shortest path length. Although this is better than the previous method it is still
exponential.
Heuristic Search applied to the travelling salesman problem
Applying this concept to the travelling salesperson problem.
1 select a city at random as a start point;
2 repeat 3 to select the next city have a list of all the cities to be visited and choose the
nearest one to the current city , then go to it; 4 until all cities visited This produces a
significant improvement and reduces the time from order N! to N. It is also possible to
produce a bound on the error in the answer it generates but in general it is not possible to
produce such an error bound. In real problems the value of a particular solution is trickier to
establish, this problem is easier as it is measured in miles, other problems have vaguer
measures.. Although heuristics can be created for unstructured knowledge producing cogent
analysis is another issue and this means that the solution lacks reliability. Rarely is an optimal
solution required good approximations usually suffice. Although heuristic solutions are bad
in the worst case the worst case occurs very infrequently and in the most common cases
solutions now exist. Understanding why heuristics appear to work increases our
understanding of the problem. This method of searching is a general method which can be
applied to problems of the following type.
Problem Characteristics.
Is the problem decomposable into a set of nearly independent smaller or easier sub-
problems? Can the solution steps be ignored or at least undone if they prove unwise?
Is the problem's universe predictable?
Is a good solution to the problem obvious without comparison to all other possible
solutions?
Is the desired solution a state of the world or a path to a state?
Is a large amount of knowledge absolutely required to solve this problem or is
knowledge important only to constrain the search? Can a computer that is simply
given the problem return the solution or will the solution of the problem require
interaction between the computer and a person?
The design of search programs.
Each search process can be considered to be a tree traversal exercise. The object of the search
is to find a path from an initial state to a goal state using a tree. The number of nodes
generated might be immense and in practice many of the nodes would not be needed. The
secret of a good search routine is to generate only those nodes that are likely to be useful.
Rather than having an explicit tree the rules are used to represent the tree implicitly and only
to create nodes explicitly if they are actually to be of use. The following issues arise when
searching:
the tree can be searched forwards from the initial node to the goal state or backwards from
the goal state to the initial state.
• How to select applicable rules, it is critical to have an efficient procedure for matching rules
against states.
• How to represent each node of the search process this is the knowledge representation
problem or the frame problem. In games an array suffices in other problems more complex
data structures are needed.
The breadth first does take note of all nodes generated but depth first can be modified.
Check duplicate nodes
• 1 examine all nodes already generated to see if new node is present.
• 2 if it does exist add it to the graph.
• 3 if it does already exist then
• A set the node that is being expanded to point to the already existing node corresponding to
its successor rather than to the new one.
• The new one can be thrown away.
• B if the best or shortest path is being determined check to see if this path is better or worse
than the old one.
• If worse do nothing.
• If better save the new path and work the change in length through the chain of successor
nodes if necessary.
Knowledge representation
Much intelligent behaviour is based on the use of knowledge; humans spend a third of their
useful lives becoming educated. There is not yet a clear understanding of how the brain
represents knowledge
Knowledge representation (KR) is an area in artificial intelligence that is concerned with
how to formally "think", that is, how to use a symbol system to represent "a domain of
discourse" that which can be talked about, along with functions that may or may not be
within the domain of discourse that allow inference (formalized reasoning) about the objects
within the domain of discourse to occur. Knowledge representation is the study of how
knowledge about the world can be represented and what kinds of reasoning can be done with
that knowledge. In order to use knowledge and reason with it, you need what we call a
representation and reasoning system (RRS).
A representation and reasoning system is composed of a language to communicate with a
computer, a way to assign meaning to the language, and procedures to compute answers
given input in the language. Intuitively, an RRS lets you tell the computer something in a
language where you have some meaning associated with the sentences in the language, you
can ask the computer questions, and the computer will produce answers that you can interpret
according to the meaning associated with the language
There are several important issues in knowledge representation:
• How knowledge is stored;
• How knowledge that is applicable to the current problem can be retrieved;
• How reasoning can be performed to derive information that is implied by existing
knowledge but not stored directly.
The storage and reasoning mechanisms are usually closely coupled. It is necessary to
represent the computer's knowledge of the world by some kind of data structures in the
machine's memory. Traditional computer programs deal with large amounts of data that are
structured in simple and uniform ways. A.I. programs need to deal with complex
relationships, reflecting the complexity of the real world.
Typical problem solving (and hence many AI) tasks can be commonly reduced to:
• Representation of input and output data as symbols in a physical symbol
• reasoning by processing symbol structures, resulting in other symbol structures.
Some problems highlight search whilst others knowledge representation. Several kinds of
knowledge might need to be represented in AI systems:
Objects Facts about objects in our world domain. e.g. Guitars have strings, trumpets
are brass instruments.
Events Actions that occur in our world. e.g. Steve Vai played the guitar in Frank
Zappa's Band. - Performance A behaviour like playing the guitar involves
knowledge about how to do things. - Meta-knowledge knowledge about what we
know. e.g. Bobrow's Robot who plan's a trip. It knows that it can read street signs
along the way to find out where it is. Thus in solving problems in AI we must
represent knowledge and there are two entities to deal with:
Facts truths about the real world and what we represent. This can be regarded as the
knowledge level
Representation of the facts which we manipulate. This can be regarded as the
symbol level since we usually define the representation in terms of symbols that can
be manipulated by programs.
We can structure these entities at two levels: The knowledge level: at which facts are
described The symbol level: at which representations of objects are defined in terms of
symbols that can be manipulated in programs.
Using Knowledge
We have briefly mentioned where knowledge is used in AI systems. Let us consider a little
further to what applications and how knowledge may be used.
Learning It refers to acquiring knowledge. This is more than simply adding new facts
to a knowledge base. New data may have to be classified prior to storage for easy
retrieval, etc.. Interaction and inference with existing facts to avoid redundancy and
replication in the knowledge and also so that facts can be updated.
Retrieval The representation scheme used can have a critical effect on the efficiency
of the method. Humans are very good at it.
Reasoning Infer facts from existing data.
Properties for Knowledge Representation Systems
The following properties should be possessed by a knowledge representation system. -
Representational Adequacy the ability to represent the required knowledge; -
Inferential Adequacy the ability to manipulate the knowledge represented to produce
new knowledge corresponding to that inferred from the original;
Inferential Efficiency the ability to direct the inferential mechanisms into the most
productive directions by storing appropriate guides;
Acquisitioned Efficiency the ability to acquire new knowledge using automatic
methods wherever possible rather than reliance on human intervention. To date no
single system optimizes all of the above
Elements inherit values from being members of a class. data must be organized into a
hierarchy of classes as shown in the figure below
Boxed nodes represent objects and values of attributes of objects. Values can be objects with
attributes and so on. Arrows point from object to its value. This structure is known as a slot
and filler structure, semantic network or a collection of frames. The algorithm to retrieve a
value for an attribute of an instance object:
1. Find the object in the knowledge base
2. If there is a value for the attribute report it
3. Otherwise look for a value of instance if none fail
4. Otherwise go to that node and find a value for the attribute and then report it
5. Otherwise search through using isa until a value is found for the attribute.
Inferential Knowledge
Represent knowledge as formal logic: All dogs have tails : dog(x) hasatail(x) Advantages:
A set of strict rules. o Can be used to derive more facts.
Truths of new statements can be verified.
Guaranteed correctness.
Advantages:
• Heuristic or domain specific knowledge can be represented.
• Extended logical inferences, such as default reasoning facilitated.
• Side effects of actions may be modelled. Some rules may become false in time.
Keeping track of this in large systems may be tricky.
Disadvantages:
Completeness -- not all cases may be represented.
Consistency -- not all deductions may be correct.
e.g If we know that Fred is a bird we might deduce that Fred can fly. Later we might
discover that Fred is an emu.
Modularity is sacrificed. Changes in knowledge base might have far-reaching effects.
Cumbersome control information.
Semantic Nets
The major idea is that:
The meaning of a concept comes from its relationship to other concepts, and that,
The information is stored by interconnecting nodes with labelled arcs.
a class (set), or
an instance (an element of a class).