Download Research Paper

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Incomplete Nature wikipedia , lookup

Machine learning wikipedia , lookup

Multi-armed bandit wikipedia , lookup

Personal knowledge base wikipedia , lookup

Collaborative information seeking wikipedia , lookup

Human–computer interaction wikipedia , lookup

Expert system wikipedia , lookup

Pattern recognition wikipedia , lookup

Artificial intelligence in video games wikipedia , lookup

Genetic algorithm wikipedia , lookup

Intelligence explosion wikipedia , lookup

Ecological interface design wikipedia , lookup

Ethics of artificial intelligence wikipedia , lookup

Computer Go wikipedia , lookup

Existential risk from artificial general intelligence wikipedia , lookup

Embodied cognitive science wikipedia , lookup

AI winter wikipedia , lookup

Philosophy of artificial intelligence wikipedia , lookup

Knowledge representation and reasoning wikipedia , lookup

History of artificial intelligence wikipedia , lookup

Transcript
Research Paper
James Griffin
97447986
1. PROJECT OVERVIEW .......................................................................................................................... 3
2. WHAT IS ARTIFICIAL INTELLIGENCE (AI)? ................................................................................ 4
2.1 THE TURING TEST ............................................................................................................................... 4
2.2 THE ANT ANALOGY ............................................................................................................................. 5
3. REPRESENTATION & SEARCHING WITHIN AI ............................................................................ 6
3.1 KNOWLEDGE REPRESENTATION ......................................................................................................... 7
3.2 PROBLEM SOLVING .............................................................................................................................. 9
3.3 PREDICATE CALCULUS ........................................................................................................................ 9
3.3.1 Propositional Calculus ................................................................................................................ 9
3.3.2 Predicate Calculus ......................................................................................................................10
3.4 HEURISTIC SEARCHING ......................................................................................................................11
3.4.1 Algorithms for Heuristic searching ...........................................................................................11
3.4.2 Using Heuristic algorithms in games ........................................................................................12
4. KNOWLEDGE-BASED PROBLEM SOLVING .................................................................................13
4.1 REASONING WITH UNCERTAIN OR INCOMPLETE INFORMATION ......................................................13
4.1.1 The Statistical Approach ............................................................................................................13
4.1.2 Nonmonotonic Systems ..............................................................................................................14
4.2 KNOWLEDGE REPRESENTATION ........................................................................................................15
4.2.1 Languages for representing knowledge ....................................................................................15
4.2.2 Knowledge Representation Issues .............................................................................................15
5. AI ALGORITHMS / TECHNIQUES ....................................................................................................16
5.1 PERCEPTRON LEARNING ....................................................................................................................16
5.2 BACKPROPAGATION LEARNING .........................................................................................................16
5.3 COMPETITIVE LEARNING ...................................................................................................................17
5.4 THE GENETIC ALGORITHM (GA) .......................................................................................................17
5.5 NEURAL NETWORKS (NN) ..................................................................................................................17
6. GAMES & AI...........................................................................................................................................19
6.1 REACTIONARY AI ...............................................................................................................................19
6.2 SPONTANEOUS AI................................................................................................................................19
7. DEVELOPMENT TOOLS .....................................................................................................................21
7.1 PROGRAMMING LANGUAGES .............................................................................................................21
7.1.1 C / C++.........................................................................................................................................21
7.1.2 LISP .............................................................................................................................................21
7.1.3 Prolog ...........................................................................................................................................21
7.2 TECHNIQUES .......................................................................................................................................21
7.2.1 Direct X .......................................................................................................................................21
7.2.2 MFC Graphics ............................................................................................................................22
7.2.3 OpenGlide (OpenGL) .................................................................................................................22
8. REFERENCES ........................................................................................................................................23
Research Paper
2001-DOC-002-003-02-AP
1. Project Overview
This project aims to create an artificial intelligence (AI) that will use a computer game to demonstrate its
capabilities. The game shall take the form of a 2D or 3D-Isometric environment that shall use a grid to
implement the question of measurement for movement, weapons range, line of sight, etc. The grid shall be
tile-based instead of hex-based, which will make determining the aforementioned factors all the more easy.
The game is also turn-based, so the length of time the computer takes to decide upon, and execute, its
actions are not so much of an issue as they would be if the game were created using real time strategy.
The game itself is based upon a tabletop war-game from a company called “Games Workshop”, and
involves spaceship combat between a number of ships, ranging from small skirmishes to larger fleet
actions. For the purpose of this project, the game will be limited to small skirmishes. Since the game is
being limited in the number of ships being fielded, a limit is also being placed on the type of ships that can
be fielded. In the original game there are six / seven separate races, with dozens of different types of ships
each. There are also three different classes of ships; escort, cruiser, and battleship. For this project, we shall
be limiting the classes available to include only cruisers, and within this sub-group limitations are being
enforced also.
James Griffin
Page 3 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
2. What is Artificial Intelligence (AI)?
Ref.[1]
AI may initially be defined as “the branch of computer science that is concerned with the automation of
intelligent behaviour”. Since AI is part of the field of computer science, it must be based on the foundation
of sound theoretical & applied principles. These principles include the data structures used in knowledge
representation, the algorithms needed to apply that knowledge, and the languages & programming
techniques used in their representation.
But intelligence itself is very difficult to define and is neither very well defined nor understood. If we return
to the initial definition of what AI may be with the notion in mind that intelligence is such a complex topic,
we can see that the definition is not very good and falls short of answering the question of what AI is in an
unambiguous manner. All it does is fuel further questions and create more uncertainty than what we started
with!!! What exactly could be considered intelligent behaviour? What kind of intelligence are we talking
about? etc.
2.1 The Turing Test
Ref.[1]
One of the earliest papers addressing the topic of machine intelligence in relation to digital computing was
fielded in 1950 by a British mathematician called Alan Turing. His paper
“Computing machinery & intelligence”(Turing, 1950)
has proven to be timely in not only its assessment of the arguments against the possibility of creating an
intelligent computing machine, but also its answers to those arguments.
The Turing Test concerns itself with measuring the performance of an allegedly intelligent machine against
a human being. Both are placed separate, isolated rooms, and a second human being is introduced into the
equation. This second human is known as the “Interrogator”, and has the responsibility of deciding which
of the two subjects is the computer. The Interrogator may communicate only by some sort of terminal
application and interacts by asking questions of both subjects. The restriction of only being able to use a
text-based communication prevents bias from listening to a computer-generated voice, or by being able to
see the two subjects. That said, the Interrogator can use as devious or unusual a question as they see fit in
order to determine the machine from the human. If the Interrogator cannot distinguish which subject is the
machine, then it can be deemed intelligent
There are two main important features for this test. The first is that it gives an objective notion of
intelligence, i.e. the behaviour of a known intelligent being in response to a particular set of questions. This
provides a standard for determining intelligence that avoids the inevitable debates over the “true” nature of
intelligence. The second feature of the test is that it eliminates any bias in favour of living organisms by
forcing the Interrogator to focus solely on the content of the answers to any questions given.
But the test is vulnerable to a number of justifiable criticisms. One of the most important of these is aimed
at the bias towards symbolic problem solving tasks. The test does not provide any ability to test perceptual
skills or manual dexterity, both of which require some intelligence to carry out effectively.
It is also debated that the Turing Test constrains machine intelligence to conform to a human standard, and
that perhaps machine intelligence is simply different from human intelligence, and that trying to evaluate it
in human terms is a fundamental mistake. Some AI experts (e.g. Ford & Hayes, 1995) see responding to the
full challenge of the test as a mistake. They consider it a distraction to the more important issue of
developing general theories to explain the mechanisms of intelligence in humans & machines, and applying
those theories to the development of tools to solve specific, practical problems. But even with these
arguments against the test, it has proven itself to be an important and relevant work.
James Griffin
Page 4 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
2.2 The Ant Analogy
Ref.[1]
In 1981, Noble Laureate Herbert Simon argued that much of the originality and variability of behaviour
shown by living creatures is due to the make-up of their environment rather than on any complexity of their
own internal programs. In his paper
“The Sciences of the Artificial” (Simon, 1981)
Simon describes an ant progressing circuitously along an uneven and cluttered stretch of ground. He makes
the point that even although the path required might seem quite complex, the ant’s objective is very simple;
to return to the colony as quickly as possible. Any turns or diversions needed are simply caused by the
obstacles in its way to achieving that goal. He concludes that
“An ant, viewed as a behaving system, is quite simple. The apparent complexity of its behaviour
over time is largely a reflection of the complexity of the environment in which it finds itself.”
The idea provides a strong argument for organisms of intelligence that such systems are in fact relatively
simple and comprehensible. If this argument is applied to humans it forms a strong argument for the
importance of culture in forming intelligence. Rather than growing in the dark like a mushroom, it seems to
depend on interacting with a varied surrounding
James Griffin
Page 5 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
3. Representation & Searching within AI
Ref.[3]
In a 1976 lecture that received an award, Newell & Simon stated that intelligent activity in either humans or
machines is achieved through the use of symbol patterns which represent aspects of a problem domain,
operations on these patterns to create potential solutions, and finally to search to choose an appropriate
choice from the possible solutions created.
These assumptions form the basis for what is known as the “physical symbol system hypothesis”. It
justifies the efforts being used to create intelligent machines, and distinguishes between the patterns formed
by an arrangement of symbols and the medium used to implement them. If intelligence is gained solely
from the structure of a symbol system, then any medium that successfully implements the correct patterns
will achieve intelligence whether constructed of circuits or organic matter.
The hypothesis outlines a major focus in the field of AI in defining the symbol structures and operations
needed to solve problems in an intelligent manner, and developing strategies for searching for possible
solutions to problems in an efficient and correct manner using these structures and operations. These are the
issues of knowledge representation & searching, which together, form an important aspect of research into
AI.
Before I move onto knowledge representation I would like to provide a copy of what the physical symbol
system hypothesis actually states:
The necessary and sufficient condition for a physical system to exhibit general intelligent
action is that it be a physical symbol system.
“Sufficient” means that intelligence can be achieved by any appropriately
organized physical symbol system.
“Necessary” means that any agent that exhibits general intelligence must be an
instance of a physical symbol system. The necessity of the physical symbol system
hypothesis requires that any intelligent agent, whether human, space alien, or computer,
achieve intelligence through the physical implementation of operations on symbol structures.
“General intelligent action” means the same scope of action seen in human action. Within
physical limits, the system exhibits behaviour appropriate to its ends and adaptive to the
demands of its environment.
The hypothesis provides four significant methodological areas to follow. Firstly, it implies the use of
symbols and systems of symbols to describe the world. Secondly, it highlights the design of search
mechanisms, especially heuristics, to explore the breadth of possible inferences that the symbol systems
provide. Thirdly, it deals with the disembodiment of cognitive architecture. What this means is that a
symbol system can provide a full causal account of its intelligence, regardless of how it is implemented.
Finally, the hypothesis deals with the empirical view of computer programs i.e. AI takes a constructive
approach and we attempt to understand intelligence by creating a working model of it.
The physical symbol system hypothesis is not without flaw, or its critics though. It is disputed that
intelligence is inherently biological and cannot be captured in a symbolic manner. This has created a
challenge to what was /is the dominant direction of AI research and has created a new field of research into
neural networks and genetic algorithms as a means of creating a more biological AI
James Griffin
Page 6 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
3.1 Knowledge Representation
Ref.[1]
The role of knowledge representation is to capture the essential information regarding a specific problem
domain and making that information readily available to a problem-solving operation. Needless to say, a
problem domain could be incredibly complex, and this could impair efficiency or accuracy in any possible
solutions created. Therefore, we can use Abstraction to represent only the information relevant for a
specific problem. This is a very useful means of handling any complexity within a problem domain. The
languages used to create knowledge representations are also tools for allowing us solve problems.
Representations should provide a natural framework for expressing problem-solving knowledge, and
should not only make that knowledge available to the computer, but also assist the programmer in its
organization.
There are three foundations that should be applied to a representation scheme, and these are:
1. It should be adequate to express all the necessary information
2. It should have an efficient execution.
3. It should provide a natural scheme for expressing the required knowledge.
Some AI researchers have argued that the key to writing a successful knowledge-based program is in the
choice of programming language that is used to create the program, and it has been said that the reason that
many low-level programmers (using BASIC, FORTRAN, C, etc) fail is because these languages do not
have the representational power required for knowledge-based systems. Also to be considered is the fact
that AI doe not lend itself very well to the representations provided by such traditional techniques such as
arrays since it (AI) is concerned with qualitative problem-solving rather than quantitative problem-solving.
It is also concerned with reasoning over calculation and organizing a large and assorted amount of
knowledge than implementing a single, well-defined algorithm.
Thus an AI representation language should allow the handling of qualitative knowledge, allow new
knowledge to be inferred from existing information, capture complex semantic meaning, and allow for
meta-level knowledge.
To handle qualitative knowledge, AI requires a way of capturing and reasoning about the qualitative
properties of a problem,
E.g. a world of Blocks:
C
A
B
Here we have a domain consisting of some blocks. One way to represent this would to use a system of coordinates providing the X & Y co-ordinates of each vertex of a block. This approach will describe the
blocks world, and would be a correct representation for some tasks. But what if we want to capture the
properties and relations of the blocks? We cannot do this using the stated approach since the information
that we would need include determining which blocks are stacked on top of others, and which can be
picked up without hindrance. We could use Predicate calculus to capture this descriptive information, and
since it is a form of logic, we could user logical assertion to describe each block.
James Griffin
Page 7 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
Clear (C),
Clear (A),
Ontable (A),
Ontable (B),
On (C, B),
Cube (A),
Cube (B),
Pyramid (C)
The first word of each expression is known as a predicate and denotes some property or relationship among
its arguments, which appear inside the parentheses. Each argument is a symbol for denoting some object
within the problem domain. This is not, however, the only way to approach representation. Neural
Networks, for example, would represent this information in the patterns of interaction between artificial
neurons.
To allow new knowledge to be inferred from existing information, the ability to reason from abstract
descriptions of classes of objects & situations is needed. If we stick to the example of the block world (see
above paragraph), a test to determine if a block has any blocks stacked on top of it might be desired. We
would not need to add this to the description for all blocks, but instead could make a general rule allowing
the system to infer this information from the given facts. If we were to use predicate calculus, it could be
written like so:
 X   Y on (Y, X)  clear (X)
“for all X, X is clear if there does not exist a Y such that Y is on X”
This predicate calculus equation could be adapted by substituting the X and Y for other values, thus
allowing greater flexibility and generality in AI leading to more intelligent decisions.
To capture complex semantic meaning it is not sufficient to describe an object by listing its component
parts. An accurate description must also describe the ways in which those component parts are combined
and their interactions with each other. Since many AI problem domains require large amounts of highly
structured inter-related knowledge, this view of structure becomes essential. An example of where this
structure might be needed can be demonstrated in the classification of plants or animals by genus and
species, or in the description of a car’s engine. Semantics are also important in describing the causal
relationships between events occurring over time (e.g. a robot’s plan of action as a sequence of actions),
and although many situations can be represented in a predicate fashion, some higher-level notion of
structure is considered desirable to help the program and programmer deal with complex concepts in a
coherent way. It should also be noted that knowledge may be organized in a manner that allows inheritance
among members of a class, thus creating the ability to have a very high level of abstraction. This allows for
an efficient and natural expressiveness making semantic nets an important alternative to predicate calculus.
Neural Nets are noted as excelling in their ability to represent complex semantics, since the neural nets
represent knowledge via the interaction of many small elements.
Allowing for meta-level reasoning of knowledge gives an intelligent system the ability to not only solve
problems, but explain why it arrived at that conclusion, and how it made certain decisions. In other words,
it should be able to describe what it knows. This meta-level reasoning has been recognized as being
essential to the developing of truly intelligent systems, and was first debated by Bertrand Russell in 1950.
The ability to learn from examples, experience, or high-level instructions depends on how the metaknowledge is applied
James Griffin
Page 8 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
3.2 Problem Solving
Ref.[1]
The second main area of Newell & Simon’s symbol system hypothesis, in which problems are solved by
searching among a list of possible choices, is based on a common-sense view of how human beings arrive
at decisions based on problem solving. For example, a chess player would consider a number of alternative
moves, and select what they deem to be the best based on information such as their opponents possible
responses, some short-term gain or whether or not sacrificing a playing piece will give an advantage.
Suppose we use a simple example of the game “Noughts & Crosses”, we can see that there are only a finite
number of moves that can be made by either player. The first player places a cross in any one of the
available nine grids. Each of these moves creates a new board layout in which the second player has one of
eight possible moves to make, and so on, so forth. Each board configuration can be represented as a node in
a graph, with the links throughout the graph representing the moves that each player can make from one
node to another. Such a diagram is known as a “state-space graph”.
Neural Networks and other adaptive systems can also perform search, particularly during learning and
adaptation. In such a network, the space to be searched would be the space of all sets of possible weights on
network connections. Search would modify these weights based on experience to find a set of connecting
weightings best matching the learning / adaptation data.
Despite this universal nature, state-space search does not provide sufficient means for intelligent problemsolving behaviour in AI, since complex problems would require an exhaustive search of their space.
Although this can be implemented, the massive size of many problem domains makes implementing it
exceptionally inefficient.
Instead, we can use a “Heuristic” search, which does not require exhaustive searching to arrive at a
decision. Heuristics provide a strategy for selectively searching a problem domain, and guide a search
along paths that have a high probability of success whilst avoiding wasted efforts. Human beings, for
example, use heuristics on a daily basis. Even as I write this paper, I have chosen to study specific areas of
computer science to find information on AI instead of doing a blanket search of all computer science.
However much more logical a choice a heuristic approach may appear to be over other search methods, it is
not foolproof. Although it does not guarantee to pick the best solution 100 percent of the time, it can, and
should, come close to choosing the right solution most of the time. A more important point to note is that it
utilizes knowledge about the nature of a problem to arrive at what should be an efficient solution.
3.3 Predicate Calculus
Ref.[1]
Predicate Calculus is a subset of formal logic and as such has well defined formal semantics, and complete,
sound inference rules.
3.3.1 Propositional Calculus
Ref.[1]
There are two main parts to prepositional calculus, which are the symbols and the semantics involved in
knowledge based languages. The first step in describing such a language is to create the different pieces
that make it up. In other words, create a set of symbols.
Propositional calculus uses three types of symbols, and these are the prepositional symbols (such as P, Q,
R, S, etc), truth symbols (true, false), and connectives (, , , , ). Propositional symbols stand for
“propositions” or statements about the domain that may or may not be true or false,
James Griffin
Page 9 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
E.g. P  Q = PQ
PRS
P  Q, R = S
Legal sentences are known as “well-formed formulas” (wff’s). In expressions of the form P Q, P and Q
are called “conjuncts” since the formula reads as “P and Q”. In expressions of the form P  Q, P and Q are
called “disjuncts” since the formula reads as “P or Q”. In an implication, e.g. P  Q, P is called the
“premise” or “antecedent”, and Q is called the “conclusion” or “consequent”.
Propositional calculus also used parentheses to control the order of evaluation within an equation, and
using parentheses on the same equation, but in different ways can yield different results. This can be
demonstrated through the use of truth tables. A truth table lists all possible truth value assignments of the
atomic propositions of an expression
E.g. Prove the equivalence of P  Q and  P  Q
P
T
T
F
F
Q
T
F
T
F
P
F
F
T
T
PQ
PQ
T
T
F
F
T
T
T
T
T denotes “True”
(P  Q) = (P  Q)
T
T
T
T
F denotes “False”
3.3.2 Predicate Calculus
Ref.[1]
Propositional calculus does not allow us to access components of an individual assertion. However,
predicate calculus does. Instead of using a single propositional symbol to represent an entire sentence
e.g. “I got drunk on Saturday”
we can create a predicate called “drink” that describes a relationship between a day of the week and
drinking
E.g. Drink (Saturday, drunk)
We can manipulate predicate expressions through the use of inference rules, and therefore infer new
sentences. Predicate calculus also allows the use of variables in expressions, which allow the introduction
of general assertions. For example, to write the expression stating that for all values of X, where X is a day
in the week, that I get drunk is true, we could say Drink (X, drunk).
The first thing that must be done with predicate calculus is to define the grammar and alphabet for creating
symbols for the language. These symbols cannot be broken down any further during operations of the
language. Predicate calculus symbols can represent variables, constants, functions, or predicates. Constants
name specific objects in a domain and must being with a lower-case letter, e.g. jimmy, tree, computer are
constants. Variable symbols denote general classes of objects or properties in a domain, and begin with
upper-case letters, e.g. X, Bill.
If we want to evaluate a family’s history, we must set out the domain, and the expression for evaluating the
domain criteria.
E.g. mother (eve, john)
mother (eve, susan)
father (adam, john)
father (adam, susan)
James Griffin
Page 10 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
Here we have our domain set up. To evaluate it, we use predicate expressions:
To find out who a parent of Y is we would use the expression:
 X  Y father (X, Y)  mother (X, Y)  parent (X, Y)
This reads as “for all X and for all Y, X is a father to Y or mother to Y
 X is a parent of Y
Conversely
If we want to find out who the siblings are we would use the expression
 X  Y  Z parent (X, Y)  parent (X, Z)  sibling (Y, Z).
This reads as “for all X, for all Y, for all Z, X is a parent of Y and a parent of Z
 Y and Z are siblings
3.4 Heuristic Searching
Ref.[1]
Heuristic when traced back to its Greek definition means “I discover”, and in state-space searches provide
formalized rules for searching the paths most likely to provide successful, or acceptable solutions.
Heuristics works on the premise that either a problem may not have an exact solution due to ambiguities in
its statement or in the data that is available to solve the problem, or that a problem does have an exact
solution but the computational cost of finding it is too much.
An example of the first premise is in the field of medical science. Doctors’ will chose the most likely
diagnosis using heuristics. If someone has a pain in their arm, it is most likely that the problem is in their
arm and not in their foot, so examining the foot will be most likely pointless.
An example of the second premise is in a state-space search of a game of chess. The number of possible
stats is exponential, and an exhaustive “brute-force” search technique might not find a possible solution
within a reasonable or acceptable timeframe
However good heuristics might appear to be, they are still not foolproof. Heuristic methods are still only an
educated guess against a problem given the information available. They are not guaranteed to find an
acceptable solution, or indeed any solution, and this is an inherent weakness in using this method for
searching. But despite this, they are still often the only practical answer for some problem domains.
Heuristic algorithms can be thought of in two separate parts; a heuristic measure, and an algorithm that uses
the measure to search a domain’s space.
3.4.1 Algorithms for Heuristic searching
Ref.[1]
The easiest manner in which to carry out a heuristic search is through a method known as “hill climbing”.
What this entails is that within a search, the current state is expanded to evaluate its children. The best of
these children is then selected, and expanded in turn. The search then discards all other children, and the
parent. The search stops when it reaches a state that is better than any of its children.
This method can be likened to a blind mountain-climber who is all too eager to get to the top. The tactic is
to find the steepest slope possible and just keep going until you cannot go any further. But because the
search keeps no history, it cannot recover from a failure or a mistake. Another major problem with this
method is the tendency to become stuck at a certain point, or “local maximum”. In other words, it might
perform well in a limited capacity, but will never find THE optimal solution. In spite of these limitations,
hill climbing can be used effectively if the evaluation has enough information to avoid local maxima and
infinite paths.
James Griffin
Page 11 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
In general however, heuristic searches require more informed algorithms, and this is provided in the “bestfirst” search. It uses lists to maintain states and keeps track of its history. An “open” list is used to keep
track of the current path on the search, and a “closed” list is used to keep a record of all paths already
visited. It also orders the paths in the “open” list in an estimate of how close they are to achieving a
solution. The goal of the “best-first” search is to find an optimal solution in as short a time as possible
whilst looking at as few states as possible. The more informed the algorithm, the fewer states needed to
achieve this aim.
The “best-first” search always picks what it deems to be the most likely path on the “open” list for
expanding further to find a goal. Even although it is using a heuristic that may prove to be wrong, it can
still backtrack and return to a path that is considered “next-best” and resume its operations along another
path. This is because it does not abandon all paths on the “open” list.
E.g. Heuristic search of a hypothetical state space
A-5
B-4
E-5
K
L
S
T
F-5
M
C-4
G-4
N
D-6
H-3
O-2
I
J
P-3
Q
R
In the above diagram, we can see the paths that a heuristic “best-first” search has chosen. Starting from A5, it evaluates B-4 and C-4 as being promising, although C-4 is the better of the two. Both are placed on an
“open” list, with C-4 at the top of the list. D-6 is ignored as not being a likely path to succeed the problem
statement. The search expands the path C-4 and only H-3 is deemed suitable. This is placed on the “open”
list at the top, and then expanded. Although P might be the goal, the path O has a lower heuristic value (2)
therefore the heuristic is fallible. Because O has a lower value it is examined first. However, the search can
recover from this error, and backtrack to H-3 where the “next-best” path open is P-3, which is the goal.
3.4.2 Using Heuristic algorithms in games
Ref.[1]
Games have always been an important area for heuristic algorithms research, since by their very nature,
they deal with incomplete, or as yet unknown information, e.g. what will your opponent do next?
Obviously, multi-player games where there is more than one opponent are much more difficult and
complicated than puzzle games because of the introduction of potentially unpredictable opponents.
Within the context of games, there are essentially two different types as regards heuristic search algorithms.
These are divided into games that have small enough domains that can be exhaustively searched
systematically to find all possible moves and counter-moves available, and games that where it is either
impractical or impossible to exhaustively search the domain.
Two Heuristic algorithms that have been gaining substantial favour and indeed, dominance, in the
development of games AI belong to the side-branch of AI research favouring more biological AI. These
two algorithms are the Neural Network, and Genetic Algorithm techniques, which will be dealt with later in
this paper.
James Griffin
Page 12 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
4. Knowledge-Based Problem Solving
Ref.[1]
Human experts are able to perform effectively simply because of their knowledge of a specific problem
domain is quite large and detailed. This point is the underlying foundation on which Knowledge Based
Systems (KBS) are built around. These systems are also known as “Expert Systems” and use domain
information of a very specialised and focused nature in their performance. This information consists of both
the theoretical, and the practical, just like their human counterparts. However, unlike humans that can learn
from their own experience to find such things as shortcuts and tricks, expert systems cannot.
Expert systems generally allow scrutiny of their reasoning processes and allow easy modification of their
knowledge bases, whether adding, or deleting information. They also generally reason in a heuristic fashion
using knowledge that is often “imperfect” or inaccurate to make their solutions.
4.1 Reasoning with Uncertain or Incomplete Information
Ref.[1]
As far as humans are concerned, reasoning by use of incomplete or inaccurate information is a common,
everyday occurrence, e.g. a doctor will make a diagnosis and course of action based upon possibly
ambiguous symptoms, or we can interpret ambiguous statements made in text or by another person without
so much as blinking an eye.
To consider the problem of reasoning under these circumstances, I will use an example of a car problem
being examined by an expert system.
If
The engine does not turn over, and
The lights do not come on
Then
The problem is the battery or cables.
This problem, at first glance, looks like a normal predicate relation to be used in inferencing. But, it is
heuristic in nature simply because it could be possible that the car’s battery or cables are fine, and that it
has a faulty starter motor, or the headlight bulbs have gone. If the two events occur, it does not
automatically mean that the problem is 100% guaranteed to be the battery and cables.
4.1.1 The Statistical Approach
Ref.[1]
This approach uses probability theory to find out the chances of an event occurring. Because of this, it can
also take into account how sequences of events will affect each other. There are a number of cases where
probabilistic analysis is entirely appropriate, including where the domain is random (i.e. playing cards), or
when describing the “normal” domain. Although this later case may have events that are not really
random, it is quite often impossible to know all causes and what influence they have in a manner that can
help predict further events.
Statistical correlations are a useful substitute for this causal analysis, and indeed a further use of probability
is in the prediction of exceptions to the norm. The statistical method groups all exceptions to a relationship
together and then uses this measure to state how often an exception might occur.
James Griffin
Page 13 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
In knowledge based problem solving, we more often than not have to reason using incomplete information,
and limited knowledge. Some research groups have used forms of probabilistic reasoning to guide whatever
work they were doing, and these include “Bayesian Reasoning”, “Belief Networks”, and the “Stanford
Certainty Factor Algebra” used in the MYCIN expert system.
Bayesian Reasoning is based around formal probability theory and is used extensively in certain areas of
research including pattern recognition, and classification. It operates by assuming a random sampling of
events, and then calculating more complex probabilities based on these results using Bayesian Theory.
Because of the complexity found in applying Bayesian probability to realistic problems domains, another
way was developed by simply focusing more on a very particular area of a domain, hence the conception of
“Belief Networks”, or to give them their full name; “Bayesian Belief Networks”.
These networks relax many constraints on the Bayesian model and on how the data stored within a domain
may be partitioned to focus reasoning. The links between the nodes that constitute the network represent
the conditional probabilities for causal influence, which has an implicit role in the assumption that an event
will cause other events to occur at some point. For this reason, belief networks will have a natural
representation of reasoning.
During the early years of expert systems development, several projects adapted Bayesian techniques,
however the MYCIN expert system developed at Stanford university took an alternate approach, where
unlike the Bayesian attempts to measure the probability with which evidence supported a conclusion,
certainty theory was used. This theory attempts to measure the confidence given to a particular heuristic.
The thinking behind this was the case that humans will give estimates of the accuracy of decision, e.g. “I
think that solution X is highly probable to succeed, but solution Y does have the possibility of succeeding”.
These estimates are not clearly based in probability analysis, but instead are heuristics derived from
experience in reasoning with a particular domain. Simply put, the “Stanford Certainty Theory” was an
attempt to formalize the heuristic approach to reasoning with uncertainty.
4.1.2 Nonmonotonic Systems
Ref.[1]
While the statistical approaches tended to use quantitative approximation of uncertainty, some applications
need a more qualitative approximation of uncertainty. If a human expert is asked why their conclusions are
uncertain, answers will usually come in terms of qualitative relationships between domain information.
Because of the quantitative methods of the Statistical approach, qualitative information usually becomes
hidden behind numbers and figures, and this approach also does not take into account the ability of
information to change frequently.
The “Nonmonotonic” approach attempts to extend logic and allow it to represent a domain of changing
information. To this end, mathematics in its traditional form is monotonic in nature. In other words, it starts
with a set of axioms that are considered true, and then their consequences are inferred. This approach will
result in problems when dealing with reasoning based around beliefs and assumptions. Nonmonotonic
systems resolve this problem of changing beliefs by handling uncertainty by making reasonable
assumptions taking whilst factoring in uncertain information. If at a later date, a belief is proved to be the
opposite of what was evaluated, then a re-evaluation of conclusions made is undertaken.
James Griffin
Page 14 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
4.2 Knowledge Representation
Ref.[1]
A programmer must select the most significant objects and relationships within a domain, and then convert
these to a formalized language, which must then be able to efficiently inference this information.
4.2.1 Languages for representing knowledge
There are general principles of organising information that are common sense and are already found in
many languages, such as the whole ideology of the class system. Other principles that must be considered
are the definition of exceptions and definitions, how should assumptions be dealt with and also again to
deal with these assumptions if at a later date they prove false, uncertainty, and causality but to name a few.
At this point a line must be drawn between what can be called a representational ‘scheme’, and the
‘medium’ that will be used to implement it. When applied to programming languages, we can see that data
structures lend themselves very well to this separation of tasks,
e.g. in the C programming language,
struct person {
name, address, age, etc
};
would be considered the scheme to be implemented.
Generally speaking, knowledge representation languages are more constrained than the likes of Predicate
Calculus or LISP and PROLOG. These constraints may take the form of explicit structures used to
represent certain knowledge. The medium of implementation might be languages such as the
aforementioned LISP or PROLOG, or languages like C, C++, and JAVA.
4.2.2 Knowledge Representation Issues
Ref.[1]
Because a representation language will be used to make all inferences for a system which results in
determining what can be known or expressed by that system, questions must be asked about that language.
One concern is about the granularity of the representations provided by a language. If we use Predicate
calculus and Semantic networks, the representing of objects as simple symbols can incorporate granularity.
Other representations, like frames and objects, allow the definition of complex structures by encapsulating
multiple features and attributes to represent a single object.
Another issue is in the representation of meta-knowledge, which is very important if a system has to reason
about its knowledge and in explaining how it arrived at its conclusions.
The list of issues is greater than the examples I have given above however, although several of them have
already been dealt with in languages such as C, C++, and JAVA which I shall deal with shortly.
James Griffin
Page 15 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
5. AI algorithms / Techniques
Ref.[1]
This section will attempt to deal with the means by which computers ‘think’. There are many different AI
algorithms in existence, some being completely original and others being hybrids, marrying the best of
several different algorithms.
5.1 Perceptron Learning
Ref.[1]
This algorithm was developed in the 1950’s and as created as a learning algorithm using a single layer
network known as a “perceptron”. The input values and activation levels were either –1 or 1, and weights
were real valued. The activation level was given using the sum of the weighed input values, or xiwi .
Perceptrons work by using a simple, hard limiting threshold function, where activation above a certain
threshold results in a value of 1 being returned, and if that threshold isn’t reached, the outputted value is –1.
The algorithm used a simple form of supervised learning whereby after an attempt to solve a problem was
made; a teacher would then provide the correct result. The perceptron would then change its weights to try
and reduce any error. The following rule was used for this:
wi = c(d – sign(xiwi))xi
In this rule, c is a constant whose size determines the learning rate, and d is the desired output value. The
adjustment for the weight is wi. The notation sign(xiwi) is the output value given. This whole method
results in creating a set of weights, which minimise the average error over the entire training set, and if a
correct set of weights exists, the algorithm will find it.
However, this method cannot solve a certain difficult class of problems, such as problem where the data
points could not be separated in a linear fashion. After variations upon this algorithm were used, such as
multi-layered networks, in attempt to solve this difficulty, it was concluded that no means existed to solve
the problem of linear separation.
5.2 BackPropagation Learning
Ref.[1]
BackPropagation expanded on the Perceptron algorithm by allowing the allocation of blame to errors. Since
it operates on multi-layer networks, an approach was needed to control and monitor errors deep within the
network. For example, units in layer ‘k’ can only communicate with neurons in layers ‘k+1’. Therefore any
errors that occur deep within the network could spread and mutate in complex and unforeseeable ways.
Thus the analysis of sources of any errors at an output layer was quite complex. BackPropogation adjusted
its weights accordingly and apportioned blame also.
The algorithm starts at the output layer and then propagates an error backwards through all of the layers
hidden from view. The activation function for backpropagation is:
f(net) = 1/(1+e -*net), where net = xiwi
where xi is the input on line I, wi is the weight on line I, and  is a “squashed parameter” used to fine-tune
the sigmoid curve. It is used for three reasons. Firstly, it has a sigmoid shape (its graph gives an “S”
shaped curve). Secondly since it is a continuous function, it will have a derivative everywhere. And thirdly,
because the value of the derivative is greatest where the sigmoidal function is changing most rapidly,
causing assignment of the most error responsibility to those nodes whose activation was least certain.
James Griffin
Page 16 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
Backpropagation uses the generalised “Delta” rule (akin to “hill-climbing” in that it attempts to minimise
local error measure by using the derivative to find the slope of the error space in the region local to a
particular point) and uses the same gradient descent approach for Perceptron learning, except that nodes
located in hidden layers are examined for their contribution to the error at the output layer.
Summed up, BackPropagation (and Perceptron learning) can be likened to a ‘child and parent’ learning
model. The algorithm is the child, and upon learning some fact, will cross-reference with the parent to see
if this newly acquired fact is indeed accurate. This has several drawbacks; not least of which is the fact that
the child is limited to what the parent can say is either true or false. It cannot discover new information by
itself.
5.3 Competitive Learning
Ref.[1]
This algorithm is also known as the “winner takes all” algorithm, and works with a single node in a layer
of nodes that most strongly responds to an input pattern. Learning for this algorithm is unsupervised in that
the winner is determined on a “maximum activation” test, where the weight vector of the winner is then
rewarded by adjusting its components to closer match those of the input vector.
This method is considered because it is considered a classification method, and may be combined with
other network architectures to create more powerful hybrid learning models
5.4 The Genetic algorithm (GA)
Ref.[3][7]
Genetic Algorithms belong to the field of AI known as evolutionary computing, and were created to
combat the problems presented to symbolic AI systems. Because the symbolic systems were static, if the
problem domain changed at all, their means of reasoning within the domain would become flawed or
inefficient, or both. Genetic Algorithms were designed to adapt, and thus combat such diversity.
A GA works by creating many possible solutions to a given problem, and then using a Darwinian “survival
of the fittest” examination of each of these solutions. Each is awarded a ‘fitness level’ in keeping with the
“survival of the fittest” mentality. The fitness level corresponds to which solutions are most likely to
“breed” again, and with each successive breeding and re-evaluation, the list of possible solutions is
reduced until a conclusion can be reached.
Benefits from this system, other than the obvious adaptation issue, include the fact that a GA can be
incredibly efficient when designed correctly, and also the ability to be applied to almost any large domain
space.
5.5 Neural Networks (NN)
Ref.[1][3][6]
Neural Networks should be properly be termed “Artificial Neural Networks” (ANN) since biological
networks are far more complicated than their mathematical equivalents. There is no universally accepted
definition of an NN. But most experts would agree that an NN is a network of many simple processors
("units"), each possibly having a small amount of local memory. The units are connected by
communication channels ("connections"), which usually carry numeric (as opposed to symbolic) data,
encoded by a number of various means. The units operate only on their local data and on the inputs they
receive via the connections. The restriction to local operations is often relaxed during training. Although
some NNs are not modeled on biological terms, historically the NN was developed in an attempt to create
an approximation of the human brain.
James Griffin
Page 17 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
With many NN systems, the weighting of connections between units is very much dependent on the data
available. During “training” these weightings will adjust themselves around this data. In short, they will
learn from examples, and thus move to making some generalisations beyond their original data. In theory, a
NN can compute any computable function. In practice they are very useful for classification and function
approximation/mapping of problems which are tolerant of some imprecision, which have lots of training
data available, but to which hard and fast rules (such as those that might be used in an expert system)
cannot easily be applied
James Griffin
Page 18 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
6. Games & AI
Ref.[3]
AI within games is not necessarily AI in what would be considered the standard meaning of the word. AI
for units within a computer game is really an attempt to give the illusion of appearing ‘alive’ and to give a
computer opponent some life-like attributes to provide a challenge.
Taking a first-person perspective ‘shooter’ game as a model, we can see the difference between games that
use AI in a reasonable manner, and those that don’t. If we take “Doom” as an example of unrealistic AI,
we can see that enemy opponents will stand around in one place waiting for some attention in a very
unrealistic manner. While the game was groundbreaking in its day, people expect and are demanding more
these days. If we take “Half-Life” as the other extreme of the argument, we see that enemy units will
support each other, respond to sounds, lay down covering fire as their allies move in on you, or fall-back
when getting badly beaten. The later appears to give the enemy units the appearance of intelligence,
making it all the more enjoyable to play against them again & again.
So simply by creating a routine to make the enemy look around in different directions from time to time, or
change their posture, they begin to look that little bit more realistic. Sticking with the example of “HalfLife” we can see that by creating a situation where another enemy who walks in a pre-made path
occasionally stops in front of the standing enemy and appears to speak to them, the appearance of reality
can be increased greatly. Indeed, in the game in question, several enemy units DO communicate with each
other verbally.
There are two categories of actions in unit AI and these are “Reactionary” and “Spontaneous”.
6.1 Reactionary AI
Ref.[3]
Reactionary AI entails units responding to a change in their environment. For example, if an enemy spots
you and starts to run towards you and shoot, then they have acted as a reaction to seeing you. For
reactionary AI, all reactions are based around the inputs for the enemy opponents. Such factors as distance
of sight, range, speed, and in some of the more advanced games like “Half-Life” or “Deus Ex”, smell and
hearing. In terms of my project, only range, speed, and line-of-sight are required for each unit.
Different AI units can have different levels of ‘alertness’ as it were, to react differently to any events, thus
furthering the impression of AI. Fuzzy Logic can be used to describe how each unit reacts to its
surroundings and events.
6.2 Spontaneous AI
Ref.[3]
This type of AI involves the AI units carrying out actions that are not linked to any events in their
environment. This furthers the semblance of intelligence by creating the impression individuality. For
example, a unit that moves from its original position to ‘carry on a conversation’ with another unit several
meters away is considered to be acting in a spontaneous manner.
One method of providing spontaneity in AI units is to give each a set of non-alert goals. These could
include walking pre-set paths, walking to pre-set areas randomly, stopping next to other units occasionally
when passing them and walking with other units to pre-set destinations. The term “pre-set” is central to all
of these situations because unless the developers come up with a very good algorithm for setting
destinations or paths, the AI units are going to look like they are wandering aimlessly.
James Griffin
Page 19 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
Again, for my game spontaneity does not really factor, due to the very nature of the game being that a
strategy oriented war-game. The AI is constantly reacting and counter-reacting to the human players
circumstances.
James Griffin
Page 20 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
7. Development Tools
Ref.[1]
This section takes a look at some of the various programming languages and techniques that can be used to
not only create the AI for the project, but also for creating the environment in which the AI will operate,
namely that of a computer generated graphical ‘world’
7.1 Programming Languages
7.1.1 C / C++
C & C++ have an advantage in being established languages that are very powerful and versatile. Whilst C
caters for only structured programming, C++ caters not only for structured programming, but also for
Object Oriented programming. Another major point in favour of these languages is that most games are
written using them, and therefore exists a lot of documentation to this end. The largest and most successful
graphical SDKs, such as DirectX & openGL (both of which are dealt with later) utilise these two
languages.
7.1.2 LISP
Ref.[1]
LISP was originally intended as an alternative model of computation based on the theory of recursive
functions. It uses symbolic rather than numeric computation, and utilises a powerful set of list-handling
functions implemented internally as linked pointer structures. Hence the name LISP is an acronym of LISt
Processing.
The language gives programmers the full power and generality of linked data structures while freeing them
from the responsibility for explicitly managing pointers and pointer operations.
7.1.3 Prolog
Ref.[1]
The name for this language stems from its use of first-order predicate calculus; PROgramming in LOGic.
This is probably the best-known example of a logic programming language. Such a program uses a set of
specifications in formal logic, and an interpreter executes the program by systematically making inferences
from these logic specifications. The use of first-order predicate calculus to express specifications for
problem solving creates a clean and refined syntax along with well-defined semantics.
7.2 Techniques
There are several different techniques available for rendering graphics and this section will deal with the
most prominent of these techniques.
7.2.1 Direct X
Ref.[2][3][4][5]
DirectX is an SDK package designed to enable advanced graphical and sound manipulation. The dominant
driving factor for DirectX was to create real-time, high-performance applications running in the windows
environment that rivaled or exceeded those of applications running under MS-DOS or games consoles. The
package provides a number of different sub-packages, as it were, to take advantage of certain PC
multimedia capabilities in a hassle-free manner, and to remove the question of hardware support from the
equation when developing these applications.
James Griffin
Page 21 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
It provides a consistent interface between hardware and applications, and reducing the complexity of
installation and configuration, and using any hardware to the best advantage. For example, looking at a
game that runs under windows, we can see that if it uses DirectX it will take advantage of any graphics
accelerator cards, plug & play hardware, and any communications services
The SDK itself contains several components that deals with the issue of creating windows-based games and
high-performance applications.
 DirectDraw – provides acceleration for hardware and software animation techniques by providing
direct access to bitmaps in off-screen display memory along with an extremely fast access rate to
the hardware’s ‘blitting’ and ‘buffer-flipping’ techniques.

DirectSound – provides the capability to mix sounds and playback at a software and hardware
level.

Direct3D – allows applications to render complete 3D graphical systems, and take control of
rendering pipelines

DirectPlay – provides a simple way of connecting applications via modem or a LAN / WAN

DirectInput – provides input for a range of devices such as mouse, keyboard, joystick, joypad,
etc.
These are the most important features of DirectX, although there are several others. However favourable it
may look to use this to develop the graphical aspect of the project, one point to make against DirectX is that
certain operating systems (namely Windows NT) do not like handing control of hardware directly to
programs, and insist instead that all manipulation go through them. To this end, WinNT does not support
DirectX above version 3. Currently DirectX is running in version 7, and about to jump to version 8. This
has the very obvious side-effect of having to set up a dual-boot on a college machine between WinNT and a
windows operating system that supports DirectX, such as Win9* / 2* / Me
7.2.2 MFC Graphics
MFC Graphics unfortunately were not designed with advanced graphical rendering in mind, and instead
deal more with such issues as mouse pointers on screen. Since I will need something more substantial for
the project, I feel that I must overlook this avenue.
7.2.3 OpenGlide (OpenGL)
Ref.[3][8]
OpenGL is a cross-platform standard for creating true 3d objects and worlds for computers using an API. It
is generally programmed using C & C++, and is very complex, although it goes a long way to solving
hardware compatibility issues because of its cross-platform nature. Although there are several environment
generators available to create openGL rendered environments, restrictions come in the form of driver
support for graphics cards. From my own experience this restriction can be an absolute nightmare to deal
with, and I am not certain as to whether or not the machines in I.T. Tallaght have been set up with openGL
support in mind.
The environments themselves require a myriad of information to be added to them, such as advanced
collision detection and space co-ordinates required for drawing vectors and rendering angles. Despite these
draw-backs, OpenGL is still the leading 3D rendering / 3D hardware acceleration tool used today.
James Griffin
Page 22 of 23
97447986
Research Paper
2001-DOC-002-003-02-AP
8. References
Books:
“Artificial Intelligence
Structures & Strategies for Complex Problem Solving
3rd Edition”
By George F. Luger & William A. Stubblefield
Published by Addison Wesley
ISBN No. 0-805-31196-3
Ref. [1]
“Inside DirectX”
By Bradley Bargen & Terence P. Donnelly
Published by Microsoft Press
ISBN No. 1-572-31696-9
Ref.[2]
IT-Tallaght Diploma KBS Course Summary Notes
URLs:
AI:
http://www.gameai.com/
http://www.student.nada.kth.se/~f93-maj/pathfinder/contents.html
http://www.geocities.com/ResearchTriangle/Lab/8751/current.html
http://www.cs.vu.nl/~mcvos/hotlist.html
http://www.cs.washington.edu/research/jair/home.html
http://www.toptenwebsites.com/htmlpages/computers/compsci/comai_3.html
ftp://ftp.sas.com/pub/neural/FAQ.html
- Ref.[6]
http://www.cs.stir.ac.uk/~lss/NNIntro/InvSlides.html
http://library.thinkquest.org/18242/ga.shtml
- Ref.[7]
DirectX Programming:
http://www.scuttle.co.uk
- Ref.[5]
http://www.geocities.com/SiliconValley/Ridge/6444/directx.html
http://www.geocities.com/SiliconValley/Bay/8557/WinWhatX.htm – Ref.[4]
OpenGL programming:
http://nate.scuzzy.net/gltut/
http://www.opengl.org/
- Ref.[8]
Other:
http://www.gamedev.net/ - AI / DirectX & OpenGL – Ref.[3]
http://www.altavista.com/
James Griffin
Page 23 of 23
97447986