AI Module 4IT (2)
AI Module 4IT (2)
Compiled
By
Dr. Abebaw Alem & Dr. Habtu Hailu
DTU
P.O.BOX: 272
April 2024
Introduction to Artificial Intelligence (COSc4142) Module
Table of Contents
Course Description and Domains of Education ............................................................... ii
Chapter One: Introduction to Artificial Intelligence .................................................... 1
1.1 Definitions of AI: WHAT IS AI? ................................................................................ 1
1.2 OBJECTIVES OF AI .................................................................................................. 3
1.3 Approaches to AI and Hypothesis of AI .................................................................... 4
1.4 The Foundations of AI: Bits of History and the State of the Art ............................. 6
1.5 Application Areas of AI ............................................................................................. 12
Chapter 2: Intelligent Agents ......................................................................................... 14
2.1 Agents and Environments ......................................................................................... 14
2.2 Acting of Intelligent Agents (Rationality) ....................................................................... 17
2.3 Structure of Intelligent Agents.................................................................................. 18
2.4 Agent Types ................................................................................................................ 18
2.4.1 Simple reflex agent ................................................................................................................20
2.4.2 Model-based reflex agent ......................................................................................................21
2.4.3 Utility-based agent .................................................................................................................23
2.4.4 Learning agent .......................................................................................................................24
Chapter 3: Solving Problems ......................................................................................... 27
3.1 Solving Problems by Searching ................................................................................ 27
3.1.1 Problem Solving Agents ........................................................................................................27
3.1.2 Problem Formulation .............................................................................................................27
3.1.3 Search Strategies and their Criteria .......................................................................................28
3.1.3.1 Uninformed (Blind) Search Strategies .........................................................................28
3.1.3.2 Informed (Heuristics) Search .......................................................................................33
3.1.3.3 Constraint Satisfaction Search .....................................................................................40
3.1.3.4 Games as Search Problems ..........................................................................................41
Chapter 4: Knowledge and Reasoning.......................................................................... 45
4.1 Logical Agents ............................................................................................................ 45
4.1.1 Propositional Logic ................................................................................................................45
4.1.2 Predicate (First-Order) Logic ................................................................................................46
4.2 Knowledge Representation........................................................................................ 46
4.3 Knowledge-based Systems ......................................................................................... 47
4.4 Uncertain Knowledge and Reasoning ...................................................................... 48
Chapter 5: Machine Learning ....................................................................................... 50
5.1 Learning and Learning from Examples/Observation............................................. 50
5.3 Learning Probabilistic Models .................................................................................. 52
5.4 Learning in Neural Networks ................................................................................... 52
Chapter 6: Communicating, Perceiving, and Acting ................................................... 54
6.1 Natural Language Processing ................................................................................... 54
6.2 Natural Language for Communication .................................................................... 54
6.3 Perception ................................................................................................................... 55
6.4 Robotics ....................................................................................................................... 56
Summary of Teaching-Learning and Assessments Methods: ........................................ 58
Worksheet ......................................................................................................................... 58
Assignments...................................................................................................................... 59
i
Artificial Intelligence ITec4121
Note: - The objectives, contents, methods, and assessment of the course are aligned with the hierarchy of learning and domains of
education as follows.
Domain of education
Knowledge (k)
Attitude (A)
Skill (S)
Hierarchy of learning – simple to complex
1. Cognitive Domain (Knowledge-K):
Level 1 (knowledge): define, describe, label, list ….
Level 2 (comprehension): convert, defend distinguish, estimate, explain …
Level 3 (application): change, compute, demonstrate …
Level 4 (analysis): break down, relate, infer ….
Level 5 (synthesis): compose, create …
Level 6 (evaluate): appraise, conclude …
2. Affective Domain (Attitude-A):
Level 1 (receiving): Asks, describes …
Level 2 (responding): Answer, assist, complies …
Level 3 (valuing): completes, describes, differentiates …
Level 4 (organization): Adheres, alters, arranges, identifies …
Level 5 (characterization): Acts, discriminates, displays ….
3. Psychomotor Domain (Skill-S):
Level 1 (perception): choose, describes, detects
Level 2 (set): begins, displays, explains
Level 3 (guided Response): Assembles, builds, calibrated
Level 4 (mechanism): (same with Guides response)
Level 5 (complex overt response): (same with Guides response)
Level 6 (Adaption): Adapts, alters, changes, rearranges
Level 7 (origination): Arranges, combines, composes
ii
Introduction to Artificial Intelligence (COSc4142) Module
1
Artificial Intelligence ITec4121
D. Reasoning: It is the set of processes that enables us to provide basis for judgment,
making decisions, and prediction. There are broadly two types:
Inductive Reasoning: It conducts specific observations to makes broad general
statements.
Deductive Reasoning: It starts with a general statement and examines the possibilities to
reach a specific, logical conclusion.
Besides the definitions of AI, working issues in AI can be categorized within three research
and development types: Symbolic, Connectionist, and Evolutionary. Each has its own
characteristic strengths and weaknesses.
Symbolic AI (Symbol based approach to learning)
Symbolic AI is based on logic (Logic (Greek logos, “word,” “speech,” “reason”), the
science dealing with the principles of valid reasoning and argument. The study of logic is
the effort to determine the conditions under which one is justified in passing from given
2
Artificial Intelligence ITec4121
statements, called premises, to a conclusion that is claimed to follow from them. It uses
sequences of rules to tell the computer what to do next. Expert systems consist of many so-
called IF-THEN rules: IF this is the case, THEN do those. Since both sides of the rule can
be defined in complex ways, rule-based programs can be very powerful.
Connectionist AI (Neurally or biologically inspired approaches to learning)
Connectionist systems also referred to as neural system or Parallel Distributed Processing.
Connectionism is inspired by the human brain. It is closely related to computational
neuroscience, which models actual brain cells and neural circuits. Connectionist AI
uses artificial neural networks made of many units working in parallel. These simple units
are much less complex than real neurons. Each can do only one thing, such as report a tiny
vertical line at a particular place in an image. What matters is not what any individual unit
is doing, but the overall activity pattern of the whole network.
Neural Network, in computer science, is highly interconnected network of
information-processing elements that mimics the connectivity and functioning of the
human brain. One of the most significant strengths of neural networks is their ability to
learn from a limited set of examples. Neural networks have been applied to many problems
since they were first introduced, including pattern recognition, handwritten character
recognition, speech recognition, financial and economic modeling, and next-generation
computing models.
Consequently, connectionist systems are more flexible than symbolic AI programs. Even
if the input data is faulty, the network may give the right answer. They are therefore good
at pattern recognition, where the input patterns within a certain class need not be identical.
But connectionism is weak at doing logic, following action sequences, or representing
hierarchies of goals. What symbolic AI does well, connectionism does badly, and vice
versa. Hybrid systems combine the two, switching between them as appropriate.
Evolutionary AI (Inspired by genetic and evolutionary analogs)
Also termed as emergent learning.
Evolutionary AI draws on biology.
Its programs make random changes in their own rules, and select the best daughter
programs to breed the next generation.
A practical application of evolutionary AI would be a computer model of the long-
term growth of a business in which the evolution of the business is set within a
simulated marketplace.
Often used in modelling artificial life.
1.2 OBJECTIVES OF AI
To supplement natural intelligence for e.g we are building intelligence in an object so that
it can do what we want it to do, as for example-- robots, thus reducing human labor and
reducing human mistakes. In general, the specific goals of AI are:
To Create Expert Systems: The systems which exhibit intelligent behavior, learn,
demonstrate, explain, and advice its users.
To Implement Human Intelligence in Machines (to make machines smarter and
to understand intelligence): Creating systems that understand, think, learn, and
behave like humans.
To Make Intelligence Machines more useful in a real world practically
(entrepreneurial purpose)
3
Artificial Intelligence ITec4121
The Greek philosopher Aristotle was one of the first to attempt to codify "right thinking,"
that is, irrefutable reasoning processes. His syllogisms provided patterns for argument
structures that always yielded correct conclusions when 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; their study initiated the field
called logic.
Logicians in the 19th century developed a precise notation for statements about all kinds
of things in the world and about the relations among them. The so-called logicist tradition
within artificial intelligence hopes to build on such programs to create intelligent systems.
There are two main obstacles to this approach.
Not easy to take informal knowledge and state it in the formal terms required by
logical notation, particularly when the knowledge is less than 100% certain.
4
Artificial Intelligence ITec4121
There is a big difference between being able to solve a problem "in principle" and
doing so in practice.
The Turing Test, proposed by Alan Turing (1950), was designed to provide a satisfactory
operational definition of intelligence. Rather than proposing a long and perhaps
controversial list of qualifications required for intelligence, he suggested a test based on
indistinguishability from undeniably intelligent entities-human beings. The computer
passes the test if a human interrogator, after posing some written questions, cannot tell
whether the written responses come from a person or not. Programming a computer to
pass the test provides plenty to work on. The computer would need to possess the following
capabilities:
Natural language processing to enable it to communicate successfully in English.
knowledge representation to store what it knows or liears;
automated reasoning to use the stored information to answer questions and to
draw new conclusions;
Machine learning to adapt to new circumstances and to detect and extrapolate
patterns.
computer vision to perceive objects, and
Robotics to manipulate objects and move about.
The Turing test was designed by Turing as a way to judge the success or
otherwise of an attempt to produce a thinking computer. The interrogator is
given access to two individuals, one of whom is a human (B) and the other of
whom is a computer (A). The interrogator (C) can ask the two individuals
questions, but cannot directly interact with them. Probably the questions are
entered into a computer via a keyboard, and the responses appear on the
computer screen. The human is intended to attempt to help the interrogator,
but if the computer is really intelligent enough, it should be able to fool the
interrogator into being uncertain about which the computer is and which the
human is. The human can give answers such as “I’m the human—the other
one is the computer,” but of course, so can the computer. The real way in
which the human proves his or her humanity is by giving complex answers
that a computer could not be expected to comprehend. Of course, the inventors
of the truly intelligent computer program would have given their program the
ability to anticipate all such complexities.
5
Artificial Intelligence ITec4121
An agent (the Latin word to mean ager to do) is just something that acts something. But
computer agents are expected to have other attributes that distinguish them from mere
"programs" such as operating under autonomous control, perceiving their environment,
persisting over a prolonged time period, adapting to change, and being capable of taking
on another's goals.
A rational agent is one that acts so as to achieve the best outcome or, when there is
uncertainty, the best expected outcome.
In the "laws of thought" approach to AI, the emphasis was on correct inferences. Making
correct inferences is sometimes part of being a rational agent, because one way to act
rationally is to reason logically to the conclusion that a given action will achieve one's goals
and then to act on that conclusion.
All the skills needed for the Turing Test are there to allow rational actions. Thus, we need
the ability to represent knowledge and reason with it because this enables us to reach good
decisions in a wide variety of situations in the real world.
For these reasons, the study of AI as rational-agent design has advantages such as:
it is more general than the "laws of thought" approach, because correct inference is just
one of several possible mechanisms for achieving rationality.
it is more amenable to scientific development than are approaches based on human
behaviour or human thought because the standard of rationality is clearly defined and
completely general.
The hypothesis of AI could be vied by different scholars in to two views: the Strong AI
and Weak AI based on the intelligent behavior of humans.
o The followers of Strong AI believe that by giving a computer program sufficient
processing power, and by providing it with enough intelligence, one can create a
computer that can literally think and is conscious in the same way that a human is
conscious. Strong AI is also referred to as "artificial general intelligence" or as the
ability to perform "general intelligent action". Many philosophers and Artificial
Intelligence researchers consider this view to be false, and even ludicrous. The
possibility of creating a robot with emotions and real consciousness is one that is often
explored in the realms of science fiction but is rarely considered to be a goal of
Artificial Intelligence.
o Weak AI (Applied AI or Narrow AI), in contrast, is simply the view that intelligent
behavior can be modeled and used by computers to solve complex problems. That is
the use of software to study or accomplish specific problem solving or reasoning tasks
that do not encompass (or in some cases are completely outside of) the full range of
human cognitive abilities. This point of view argues that just because a computer
behaves intelligently does not prove that it is actually intelligent in the way that a
human is.
1.4 The Foundations of AI: Bits of History and the State of the Art
In this section, we provide a brief history of the disciplines that contributed ideas,
viewpoints, and techniques to AI. Like any history, this one is forced to concentrate on a
small number of people, events, and ideas and to ignore others that also were important.
6
Artificial Intelligence ITec4121
Different Philosophers have great roles under this foundation such as:
Aristotle (384-322 B.C.) was the first to formulate a precise set of laws governing the
rational part of the mind. He developed an informal system of syllogisms for proper
reasoning, to generate conclusions mechanically, given initial premises.
Much later, Ramon Lull (d. 13 15) had the idea that useful reasoning could actually
be carried out by a mechanical artifact.
Thomas Hobbes (1588-1679) proposed that reasoning was like numerical
computation, that "we add and subtract in our silent thoughts."
Leonardo da Vinci (1452-1519) designed but did not build a mechanical calculator;
recent reconstructions have shown the design to be functional. The first known
calculating machine was constructed around 1623 by the German scientist Wilhelm
Schickard (1592-1635), although the Pascaline, built in 1642 by Blaise Pascal (1623-
1662), is more famous.
Gottfried Wilhelm Leibniz (1646-1716) built a mechanical device intended to carry
out operations on concepts rather than numbers, but its scope was rather limited.
RenC Descartes (1596-1650) gave the first clear discussion of the distinction between
mind (as a physical system) and matter and of the problems that arise.
Philosophers staked out most of the important ideas of AI, but the leap to a formal science
required a level of mathematical formalization in three fundamental areas: logic,
computation, and probability.
The mathematical development really began with the work of George Boole (1 8 15-1
864), who worked out the details of propositional, or Boolean, logic (Boole, 1847).
In 1879, Gottlob Frege (1848-1925) extended Boole's logic to include objects and
relations, creating the first-order logic that is used today as the most basic knowledge
representation system.
Alfred Tarski (1902-1983) introduced a theory of reference that shows how to relate
the objects in a logic to objects in the real world.
In 1930, Kurt Godel (1906-1978) showed that there exists an effective procedure to
prove any true statement in the first-order logic of Frege and Russell, but that first-
order logic could not capture the principle of mathematical induction needed to
characterize the natural numbers. This motivated Alan Turing (1912-1954) to try to
characterize exactly which functions are capable of being computed.
The distinction between polynomial and exponential growth in complexity was first
emphasized in the mid-1960s (Cobham, 1964; Edmonds, 1965). It is important because
exponential growth means that even moderately large instances cannot be solved in any
reasonable time.
Besides logic and computation, the third great contribution of mathematics to AI is the
theory of probability. The Italian Gerolamo Cardano (1501-1576) first framed the idea
of probability, describing it in terms of the possible outcomes of gambling events.
Probability quickly became an invaluable part of all the quantitative sciences, helping
to deal with uncertain measurements and incomplete theories.
Pierre Fermat (1 60 1-1 665), Blaise Pascal (1623-1662), James Bernoulli (1654-1705),
F'ierre Laplace (1749-1827), and others advanced the theory and introduced new
statistical methods.
7
Artificial Intelligence ITec4121
Thomas Bayes (1702-1 761) proposed a rule for updating probabilities in the light of
new evidence. Bayes' rule and the resulting field called Bayesian analysis form the
basis of most modern approaches to uncertain reasoning in AI systems.
Economics (1776-present)
How should we make decisions so as to maximize payoff?
How should we do this when others may not go along?
How should we do this when the payoff may be f,x in the future?
The science of economics got its start in 1776, when Scottish philosopher Adam Smith
(1723-1790) published An Inquiry into the Nature and Causes of the Wealth of Nations.
In 1956 American social scientist and Nobel laureate Herbert Simon (1 91 6-2001), the
pioneering A1 researcher, won the Nobel prize in economics in 1978 for his early work
showing that models based on satisfying-making decisions that are "good enough".
In 1956 American social scientist and Nobel laureate Herbert Simon(Herbert A. Simon
(1916-2001), American political scientist, also known for his work in economics,
psychology, and computer science and American physicist and computer scientist Allan
Newell at Carnegie Mellon University in Pennsylvania devised a program called Logic
Theorist that simulated human thinking on computers.
Neuroscience (1861-present)
How do brains process information?
Neuroscience is the study of the nervous system, particularly the brain. The exact way in
which the brain enables thought is one of the great mysteries of science. It has been
appreciated for thousands of years that the brain is somehow involved in thought, because
of the evidence that strong blows to the head can lead to mental incapacitation. Aristotle
wrote, "Of all the animals, man has the largest brain in proportion to his size."
The measurement of intact brain activity began in 1929 with the invention by Hans Berger
of the electroencephalograph (EEG). From the following table, it is stated a crude
comparison of the raw computational resources available to computers (circa 2003) and
brains. The computer's numbers have all increased by at least a factor of 10 since 1995,
and are expected to do so again this decade. The brain’s numbers have not changed in the
last 10,000 years.
Brains and digital computers perform quite different tasks and have different properties.
Table 1 shows that there are 1000 times more neurons in the typical human brain than there
are gates in the CPU of a typical high-end computer. Even though a computer is a million
times faster in raw switching speed, the brain ends up being 100,000 times faster at what it
does.
8
Artificial Intelligence ITec4121
Psychology (1879-present)
How do humans and animals think and act?
The first AI conference occurred at Dartmouth College in New Hampshire in 1956. This
conference inspired researchers to undertake projects that emulated human behavior in the
areas of reasoning, language comprehension, and communications.
In the United States, the development of computer modelling led to the creation of the field
of cognitive science. The field can be said to have started at a workshop in September 1956
at MIT at which A1 itself was "born." At the workshop, George Miller presented The
Magic Number Seven, Noam Chomsky presented Three Models of Language, and Allen
Newell and Herbert Simon presented The Logic Theory Machine. These three influential
papers showed how coniputer models could be used to address the psychology of memory,
language, and logical thin lung, respectively. It is now a common view among
psychologists that "a cognitive theory should be like a computer program" (Anderson,
1980), that is, it should describe a detailed information-processing mechanism whereby
some cognitive function might be implemented.
For artificial intelligence to succeed, we need two things: intelligence and an artifact. The
computer has been the artifact of choice. This shows the development of computer
innovations. AI owes a debt to the software side of computer science, which has supplied
the operating systems, programming languages, and tools needed to write modern
programs (and papers about them). But this is one area where the debt has been repaid:
work in AI has pioneered many ideas that have made their way back to mainstream
computer science, including time sharing, interactive interpreters, personal computers with
windows and mice, rapid development environments, the linked list data type, automatic
storage management, and key concepts of symbolic, functional, dynamic, and object-
oriented programming.
The central figure in the creation of what is now called control theory was Norbert Wiener
(1894-1964). Wiener was a brilliant mathematician, who worked with Bertrand Russell,
among others, before developing an interest in biological and mechanical control systems
and their connection to cognition.
Modern control theory, especially the branch known as stochastic optimal control, has as
its goal the design of systems that maximize an objective function over time.
Linguistics (1957-present)
How does language relate to thought?
Modem linguistics and AI, then, were "born" at about the same time, and grew up together,
intersecting in a hybrid field called computational linguistics or natural language
processing. Understanding language requires an understanding of the subject matter and
context, not just an understanding of the structure of sentences. Much of the early work in
9
Artificial Intelligence ITec4121
knowledge representation (the study of how to put knowledge into a form that a computer
can reason with) was tied to language and informed by research in Linguistics, which was
connected in turn to decades of work on the philosophical analysis of language.
In 1956, the term Artificial Intelligence was first used by John McCarthy at a conference
in Dartmouth College, in Hansover, New Hampshire.
AI from the start embraced the idea of duplicating human faculties like creativity, self-
improvement, and language use. None of the other fields were addressing these issues. AI
is also the only one of fields that is clearly a branch of computer science (although
operations research does share an emphasis on computer simulations), and AI is the only
field to attempt to build machines that will function autonomously in complex, changing
environments.
Now AI has got early enthusiasm, great expectations (1952-1969) and a dose of reality
(1966-1973) by different scholars.
10
Artificial Intelligence ITec4121
are relevant. First, they are based on a rigorous mathematical theory. This has allowed
speech researchers to build on several decades of mathematical results developed in other
fields. Second, they are generated by a process of training on a large corpus of real speech
data. This ensures that the performance is robust, and in rigorous blind tests the HMMs
have been improving their scores steadily.
Neural networks also fit this trend. Much of the work on neural nets in the 1980s was done
in an attempt to scope out what could be done and to learn how neural nets differ from
"traditional" techniques. Using improved methodology and theoretical frameworks, the
field arrived at an understanding in which neural nets can now be compared with
corresponding techniques from statistics, pattern recognition, and machine learning, and
the most promising technique can be applied to each application. As a result of these
developments, so-called data mining technology has spawned a vigorous new industry.
Judea Pearl's (1988) Probabilistic Reasoning in Intelligent Systems led to a new acceptance
of probability and decision theory in AI, following a resurgence of interest epitomized by
Peter Cheeseman's (1985) article "In Defense of Probability." The Bayesian network
formalism was invented to allow efficient representation of, and rigorous reasoning with,
uncertain knowledge. This approach largely overcomes many problems of the probabilistic
reasoning systems of the 1960s and 1970s; it now dominates A1 research on uncertain
reasoning and expert systems. The approach allows for learning from experience, and it
combines the best of classical AI and neural nets.
Similar gentle revolutions have occurred in robotics, computer vision, and knowledge
representation.
What can A1 do today? A concise answer is difficult, because there are so many activities
in so many subfields. Here are a few applications:
Autonomous planning and scheduling: A hundred million miles from Earth, NASA's
Remote Agent program became the first on-board autonomous planning program into
control the scheduling of operations for a spacecraft (Jonsson et al., 2000).
Game playing: IBM's Deep Blue became the first computer program to defeat the world
champion in a chess match when it bested Garry Kasparov by a score of 3.5 to 2.5 in an
exhibition match (Goodman and Keene, 1997).
Autonomous control: The ALVINN computer vision system was trained to steer a car to
keep it following a lane.
Diagnosis: Medical diagnosis programs based on probabilistic analysis have been able to
perform at the level of an expert physician in several areas of medicine.
Logistics Planning: During the Persian Gulf crisis of 1991, U.S. forces deployed a
Dynamic Analysis and Replanning Tool, DART (Cross and Walker, 1994), to do
automated logistics planning and scheduling for transportation. This involved up to 50,000
vehicles, cargo, and people at a time, and had to account for starting points, destinations,
routes, and conflict resolution among all parameters.
Robotics: Many surgeons now use robot assistants in microsurgery.
Language understanding and problem solving: PROVERB (Littman et al., 1999) is a
computer program that solves crossword puzzles better than most humans, using
constraints on possible word fillers, a large database of past puzzles, and a variety of
information sources including dictionaries and online databases such as a list of movies
and the actors that appear in them.
In 1958, McCarthy invented the LISP programming language, which is still widely used
today in Artificial Intelligence research.
11
Artificial Intelligence ITec4121
12
Course module
Review Questions
1. What is Intelligence?
2. What is Artificial Intelligence?
3. Is Artificial Intelligence a branch of computer science or an alternative to computer
science?
4. Explain the difference between strong and weak methods in Artificial Intelligence.
Explain how this dichotomy differs from the difference between strong and weak
AI.
5. Why are PROLOG, LISP and PYTHON so well suited to Artificial Intelligence
research? Do you think languages such as C++ and Java could also be used for such
research?
6. When did Artificial Intelligence first begin to be studied? Your answer should be
more detailed than a simple date.
7. Explain the difference between strong AI and weak AI.
8. If a computer passed the Turing Test, what would that prove? What conditions
would you want to be sure had been observed in setting up the test?
13
Course module
An agent is anything that can be viewed as perceiving its environment through sensors
and acting upon that environment through effectors/actuators to maximize progress
towards its goals.
A rational agent is one that does the right thing. Obviously, this is better than doing the
wrong thing, but what does it mean? As a first approximation, we will say that the right
action is the one that will cause the agent to be most successful. That leads to intelligent
agent with the problem of deciding how and when to evaluate the agent’s success.
A performance measure embodies the criterion for success of an agent's behaviour. We
use the term performance measure for the how—the criteria that determine how
successful an agent are. Obviously, there is not one fixed measure suitable for all agents.
The when of evaluating performance is also important to evaluate the fast/speed of an
agent.
The agent takes sensory input from its environment, and produces as output actions that
affect it.
14
Course module
Omniscient agent: knows the actual outcome of its actions and can act
accordingly; but omniscience is impossible in reality.
What are sensors and actuators for each of these?
In the rationality of the simple vacuum-cleaner agent, the performance measure, the
environment, the agent's actuators and sensors (PEAS) are grouped under task
environment. In designing an agent, the first step must always be to specify the task
environment as fully as possible.
For instance, the PEAS description for different agents’ task environment is stated in figure
2.2.
Figure 2.2 Examples of agent types and their PEAS descriptions the task
environments.
15
Course module
16
Course module
An agent should strive to "do the right thing"; based on what it can perceive and the actions
it can perform. So the agent does the right thing successfully is known as Rational Agent.
Rationality is nothing but status of being reasonable, sensible, and having good sense of
judgment. It is concerned with expected actions and results depending upon what the agent
has perceived. Performing actions with the aim of obtaining useful information is an
important part of rationality.
A rational agent is the one, which is capable of doing expected actions to maximize its
performance measure, on the basis of:
• Its percept sequence
• Its built-in knowledge base
Rationality of an agent at any given time depends on the following:
1. The performance measures, which determine the degree of success.
2. Agent’s Percept Sequence till now.
3. The agent’s prior knowledge about the environment.
4. The actions that the agent can carry out/perform.
A rational agent always performs right action, where the right action means the action that
causes the agent to be most successful in the given percept sequence. The problem the
agent solves is characterized by Performance Measure, Environment, Actuators, and
Sensors (PEAS).
We use the performance measure as an objective criterion for success of an agent's
behavior. Obviously, there is not one fixed measure suitable for all agents. We could ask
the agent for a subjective opinion of how happy it is with its own performance, but some
agents would be unable to answer, and others would delude themselves. (Human agents in
particular are notorious for "sour grapes"—saying they did not really want something after
they are unsuccessful at getting it.) Therefore, we will insist on an objective performance
measure imposed by some authority. In other words, we as outside observers establish a
standard of what it means to be successful in an environment and use it to measure the
performance of agents.
17
Course module
E.g., performance measure of a vacuum-cleaner agent could be amount of dirt cleaned up,
amount of time taken, amount of electricity consumed, amount of noise generated, etc.
As a general rule, it is better to design performance measures according to what one
actually wants in the environment. Rather than according to how one thinks the agent
should behave (amount of dirt cleaned vs a clean floor). A more suitable measure would
reward the agent for having a clean floor.
So far we have talked about agents by describing their behavior. Now, we will have to bite
the bullet and talk about how the insides work. The job of AI is to design the agent
program: a function that implements the agent mapping from percepts to actions. We
assume this program will run on some sort of computing device, which we will call the
architecture. Obviously, the program we choose has to be one that the architecture will
accept and run.
The architecture might be a plain computer, or it might include special-purpose hardware
for certain tasks, such as processing camera images or filtering audio input. It might also
include software that provides a degree of insulation between the raw computer and the
agent program, so that we can program at a higher level. In general, the architecture makes
the percepts from the sensors available to the program, runs the program, and feeds the
program's action choices to the effectors as they are generated. The relationship among
agents, architectures, and programs can be summed up as follows:
18
Course module
The most famous artificial environment is the Turing Test environment, in which the whole
point is that real and artificial agents are on equal footing, but the environment is
challenging enough that it is very difficult for a software agent to do as well as a human.
Russell & Norvig (2003) group agents into five classes based on their degree of perceived
intelligence and capability in order of increasing generality:
1. Simple reflex agents
2. Model-based reflex agents
3. Goal-based agents
4. Utility-based agents
5. Learning agents
19
Course module
Simple reflex agents act only on the basis of the current percept, ignoring the rest of the
percept history. The agent function is based on the condition-action rule: if condition then
action.
This agent function only succeeds when the environment is fully observable. Some reflex
agents can also contain information on their current state which allows them to disregard
conditions whose actuators are already triggered.
Infinite loops are often unavoidable for simple reflex agents operating in partially
observable environments. Note: If the agent can randomize its actions, it may be possible
to escape from infinite loops.
function SIMPLE-REFLEX-AGENT(percept)
returns action
persistent /static: rules, a set of condition-action
rules
state INTERPRET-INPUT (percept)
rule RULE-MATCH (state,rules)
action RULE-ACTION [rule]
return action
Figure 2.6 A simple reflex agent. It acts according to a rule whose condition matches the
current state, as defined by the percept.
20
Course module
A model-based agent can handle a partially observable environment. Its current state is
stored inside the agent maintaining some kind of structure which describes the part of the
world which cannot be seen. This knowledge about "how the world works" is called a
model of the world, hence the name "model-based agent".
A model-based reflex agent should maintain some sort of internal model that depends on
the percept history and thereby reflects at least some of the unobserved aspects of the
current state. It then chooses an action in the same way as the simple reflex agent.
Action may depend on history or unperceived aspects of the world.
Need to maintain internal world model.
Example:
Agent: robot vacuum cleaner
Environment: dirty room, furniture.
Model: map of room, which areas already cleaned.
Sensor/model tradeoff.
21
Course module
function REFLEX-AGENT-WITH-STATE
(percept) returns action
static: state, a description of the current world
state
rules, a set of condition-action rules
state UPDATE-STATE (state, percept)
rule RULE-MATCH (state, rules)
action RULE-ACTION [rule]
state UPDATE-STATE (state, action)
return action
Figure 2.8 A model-based reflex agent. It keeps track of the current state of the world using
an internal model. It then chooses an action in the same way as the reflex agent.
2.1.1 Goal-based agent
Goal-based agents further expand on the capabilities of the model-based agents, by using
"goal" information. Goal information describes situations that are desirable. This allows
the agent a way to choose among multiple possibilities, selecting the one which reaches a
goal state. Search and planning are the subfields of artificial intelligence devoted to finding
action sequences that achieve the agent's goals.
In some instances the goal-based agent appears to be less efficient; it is more flexible
because the knowledge that supports its decisions is represented explicitly and can be
modified.
Agents so far have fixed implicit goals. We want agents with variable goals.
Example:
Agent: robot maid
Environment: house & people.
Goals: clean clothes, tidy room, table laid, etc
22
Course module
23
Course module
Learning has an advantage that it allows the agents to initially operate in unknown
environments and to become more competent than its initial knowledge alone might allow.
The most important distinction is between the "learning element", which is responsible for
making improvements, and the "performance element", which is responsible for selecting
external actions.
24
Course module
The learning element uses feedback from the "critic" on how the agent is doing and
determines how the performance element should be modified to do better in the future. The
performance element is what we have previously considered to be the entire agent: it takes
in percepts and decides on actions.
The last component of the learning agent is the "problem generator". It is responsible for
suggesting actions that will lead to new and informative experiences.
How do agents improve their performance in the light of experience?
–Generate problems which will test performance.
–Perform activities according to rules, goals, model, utilities, etc.
–Monitor performance and identify non-optimal activity.
–Identify and implement improvements.
25
Course module
Review Questions
1. Define an agent.
2. What is a rational agent? And what is intelligent agent?
3. What is bounded rationality?
4. What is an autonomous agent?
5. Describe the salient features of an agent.
6. Find out the following about the football player agent.
1. What are the percepts for this agent?
2. Characterize the operating environment.
3. What are the actions the agent can take?
4. How can one evaluate the performance of the agent?
5. What sort of agent architecture do you think is most suitable for this agent?
7. Answer the same questions as above for an Internet shopping agent.
26
Course module
The problem that AI tackles has a combinatorial explosion of solutions. (For e.g in case of
chess the number of possible positions has been estimated about 35*35*…(100 times). To
cope up with combinatorial explosion of solutions, AI programs use heuristics to prune to
search tree. AI programs should deal with real life problems to a large extent as if a human
expert has the capacity to handle uncertain, incomplete and irrelevant information.
27
Course module
reach the goal. For example, we might prefer paths with fewer or less costly actions.
A path cost function is a function that assigns a cost to a path. In all cases we will
consider, the cost of a path is the sum of the costs of the individual actions along
the path. The path cost function is often denoted by g.
Together, the initial state, operator set, goal test, and path cost function define a problem.
The majority of work in the area of search has gone into finding the right search strategy
for a problem. Search strategies could be categorized as uninformed (blind) search,
informed (heuristics) search, Constraint Satisfaction Search (CSS), and Game playing
search
These strategies could be evaluated in terms of four criteria:
Completeness: is the strategy guaranteed to find a solution when there is one?
Time complexity: how long does it take to find a solution?
Space complexity: how much memory does it need to perform the search?
Optimality: does the strategy find the highest-quality solution when there are
several different solutions?
Uninformed search means that they have no information about the number of steps or the
path cost from the current state to the goal—all they can do is distinguish a goal state from
a non-goal state. Uninformed search is also sometimes called blind search.
5. Breadth-first search(BFS)
The breadth-first search algorithm starts by examining all nodes one level down from the
root node. As its name suggests, this approach involves traversing a tree by breadth (level-
by-level) rather than by depth. If a goal state is reached here, success is reported else, search
continues by expanding paths from all the nodes in the current level down to the next level.
Reports success when a goal node is found, and reports failure if all nodes have been
examined and no goal node has been found.
28
Course module
Breadth-first search is a far better method to use in situations where the tree may
have very deep paths, and particularly where the goal node is in a shallower part of
the tree.
Time Complexity of a BFS depends on the branching factor of the tree, and depth
of the goal node in the tree. BFS search needs to store information about all paths
that reach the current depth and so not efficient in space.
6. Depth-first search
DFS is a commonly used algorithm for
search. Depth-first search is so called because it
follows each path to its greatest depth before moving
on to the next path.
Assuming that we start from the left side and
work toward the right, depth-first search involves
working all the way down the left-most path in the
tree until a leaf node is reached. If this is a goal state,
the search is complete, and success is reported. If the
leaf node does not represent a goal state, search
backtracks up to the next highest node that has an
unexplored path. Once this node has been examined,
search backtracks to the next unexpanded node. This
process continues until either all the nodes have been examined, in which case the search
has failed, or until a goal state has been reached, in which case the search has succeeded.
Depth-first search uses a method called chronological backtracking to move back
up the search tree once a dead end has been found. Chronological backtracking is
so called because it undoes choices in reverse order of the time the decisions were
originally made. It is also somewhat easier for humans to understand because it
much more closely relates to the natural way in which humans search for things.
Depth-first search is often used by computers for search problems such as locating
files on a disk, or by search engines for spidering the internet.
29
Course module
30
Course module
another depth-first search with a depth of bound 2. This continues, increasing the depth
bound by one at each iteration. At each iteration the algorithm performs a complete depth-
first search of the current depth bound. No information about the state space is retained
between iterations.
Because the algorithm searches the space in a level-by-level fashion, it is
guaranteed to find a shortest path to a goal.
This is an algorithm that appears to be somewhat wasteful in terms of the number
of steps that are required to find a solution.
However, it has the advantage of combining the efficiency of memory use of depth-
first search. It also shares the advantage of breadth-first search that it will always
find the path that involves the fewest steps through the tree (although, not
necessarily the best path).
Like breadth-first search, DFID is optimal and complete. It is an extremely good
search method to use where the search space may be very large and where the depth
of the goal node is not known.
Procedure
Successive depth-first searches are conducted – each with depth bounds increasing
by 1
Depth First Iterative Deepening combines the advantage of BFS (i.e., completeness) with
the advantages of DFS (i.e., limited space and finds longer paths more quickly)
This algorithm is generally preferred for large state spaces where the solution depth is
unknown.
There is a related technique called iterative broadening is useful when there are many goal
nodes. This algorithm works by first constructing a search tree by expanding only one child
per node. In the 2nd iteration, two children are expanded, and in the Ith iteration I children
are expanded.
8. Bidirectional search
Suppose that the search problem is such that the arcs are bidirectional. That is, if there is
an operator that maps from state A to state B, there is another operator that maps from state
B to state A. Many search problems have reversible arcs. 8-puzzle, 15-puzzle, path
planning etc are examples of search problems. However there are other state space search
formulations which do not have this property. The water jug problem is a problem that does
not have this property. But if the arcs are reversible, you can see that instead of starting
from the start state and searching for the goal, one may start from a goal state and try
31
Course module
reaching the start state. If there is a single state that satisfies the goal property, the search
problems are identical.
How do we search backwards from goal? One should be able to generate predecessor states.
Predecessors of node n are all the nodes that have n as successor. This is the motivation to
consider bidirectional search.
Algorithm: Bidirectional search involves alternate searching from the start state toward
the goal and from the goal state toward the start. The algorithm stops when the frontiers
intersect.
Bidirectional search can sometimes lead to finding a solution more quickly. The reason can
be seen from inspecting the following figure.
32
Course module
Depth-first and breadth-first search were described as brute-force search methods. This is
because they do not employ any special knowledge of the search trees they are examining
but simply examine every node in order until they reach the goal. In some cases, this is the
best that can be done because there is no additional information available that can be used
to direct the search any better.
Often, however, such information does exist and can be used. Take the example of looking
for a suitable Christmas gift. Very few people would simply walk into each shop as they
came across it, looking in each department in turn until they choose a present. Most people
would go straight to the shop that they considered to be most likely to have a suitable gift.
If no gift was found in that shop, they would then proceed to the shop they considered to
be the next most likely to have a suitable gift; which means they are having some
information about the availability of suitable gifts. This kind of information is called a
heuristic, and humans use them all the time to solve all kinds of problems.
Computers can also use heuristics, and in many problems heuristics can reduce an
otherwise impossible problem to a relatively simple one.
AI problem solvers employ heuristics in two basic situations:
1. A problem may not have an exact solution because of inherent ambiguities in the
problem statement or available data. Medical diagnosis is an example of this. A
given set of symptoms may have several possible causes; doctors use heuristics to
choose the most likely diagnosis and formulate a plan of treatment.
2. A problem may have an exact solution, but
the computational cost of finding it may be Heuristics are formalized as
prohibitive. In problems like chess, state
space growth is combinatorially explosive, rules for choosing those
with the number of possible states branches in a state space that
increasing exponentially or factorially with
the depth of the search. are more likely to lead to an
DFS or BFS may fail to find a solution acceptable problem solution.
within any practical length of time. By
eliminating unpromising states and their
descendants from consideration, a heuristic algorithm can defeat this combinatorial
explosion and find an acceptable form.
A heuristic is only an informed guess of the next step to be taken in a problem
solving. It’s often based on experience or intuition. Because heuristics use limited
information, they are seldom able to predict the exact behavior of the state space
farther along in the search.
A heuristic can lead a search algorithm to a suboptimal solution or fail to find any
solution at all. This is an inherent limitation of heuristics.
Heuristics and design of algorithms to implement heuristic search have long been
a core concern in AI. It’s impossible to examine every inference that can be made
in mathematics domain or every possible move on a chess board. Heuristic search
is often the only practical answer.
33
Course module
Solution found not necessarily globally optimal- the strategy can get stuck in a locally
optimal solution. This is because hill climbing uses only local knowledge for
controlling search.
Similar to best first, but successors added differently.
o Best First: Pick node with minimum heuristic estimate to expand next.
o Hill Climbing: Pick node from the successors of last expanded node with
minimum h (i.e., once decided to expand a node, only consider its
successors and never try an alternative path).
Problems:
o Foothill problem - may stop at a local maxima
A major problem of hill climbing strategies is If you try to climb a mountain in fog with an
their tendency to become stuck at local
altimeter but no map, you might use the hill
maxima. If they reach a state that has a better climbing Generate and Test approach: Check
state than any of its children, the algorithm
the height 1 foot away from your current
halts. If this is not a goal, but just a local location in each direction: north, south, east,
maximum, the algorithm fails to find a and west.
solution. As soon as you find a position where the height
Search methods without backtracking or is higher than your current position, move to
some other recovery mechanism are unable to that location and restart the algorithm. If all
distinguish between local and global maxima. directions lead lower than your current
There are methods for getting around the position, then you stop and assume you have
problem, such as randomly perturbing the reached the summit. This might not necessarily
evaluation function. But in general there is no always be true.
way of guaranteeing optimal performance
with hill climbing techniques. In spite of its limitations hill climbing can be used effectively
if the evaluation function is sufficiently informative to avoid local maxima and infinite
paths.
Hill climbing is an example of an informed search method because it uses information
about the search space to search in a reasonably efficient manner.
In general, heuristic search requires a more flexible algorithm. This is provided by best-
first search, where with a priority queue, recovery from local maxima is possible.
Best-first search
Best-first search algorithms use a heuristic evaluation function to estimate which
node is ``best'' to expand. (The lower the heuristic value, the better the node.)
This heuristic function f(node) may depend on the description of node, the
description of the goal, the information gathered by the search up to that point, and
most important, on any extra knowledge about the problem domain.
The ``best'' node to expand is the one that is estimated to be best at the time, but
may turn out to be a poor choice.
Efficient selection of the current best candidate for extension is typically
implemented using a priority queue. The unexpanded nodes are placed on a priority
queue ordered by the evaluation function. With best-first search the entire queue is
sorted after new paths have been added to it, rather than adding a set of sorted paths.
Continue working from the best node on the active list as long as its successors are
still improving.
35
Course module
Will find a solution since all successors of a node are added (no pruning). However,
does not guarantee an optimal answer unless the heuristic function is set up just
right.
Best first search is a little like hill climbing, in that it uses an evaluation function
and always chooses the next node to be that with the best score. However, it is
exhaustive, in that it should eventually try all possible paths. It uses a list as in
breadth/depth first search, but instead of taking the first node off the list (and
generating its successors) it will take the best node off, ie the node with the best
score. The successors of the best node will be evaluated (ie have a score assigned
to them) and added to the list.
Best-first algorithms are often used for path finding in combinatorial search.
Examples of best-first search algorithms include the A* search algorithm.
A good evaluation function may drastically cut down the amount of search to be
done to find a solution.
We may not find the best solution or at least, the first solution found may not be the
best, but if a solution exists we will eventually find it, and there is a good chance
of finding it quickly.
If the evaluation function is not good then, it’s just as using simpler search
techniques such as depth first or breadth first. And if evaluation function is very
expensive (ie, it takes a long time to work out a score) the benefits of cutting down
on the amount of search may be outweighed by the costs of assigning a score.
Beam search
Beam search is a form of breadth-first search that employs a heuristic, as seen with
hill climbing and best-first search. An optimization of best-first search that
reduces its memory requirement.
Beam search is like breadth first search because beam search progresses level by
level. Unlike breadth-first search, however, beam search only moves downward
from the best nodes at each level. The other nodes are ignored forever.
At each level of the tree, it generates all successors of the states at the current level,
sorts them in order of increasing heuristic values. However, it only stores a
predetermined number of states at each level (called the beam width). But may
miss solution if heuristic is poorly chosen.
The smaller the beam width, the more states are pruned. Therefore, with an
infinite beam width, no states are pruned and beam search is identical to breadth-
first search.
36
Course module
The beam width bounds the memory required to perform the search, at the expense
of risking completeness (possibility that it will not terminate) and optimality
(possibility that it will not find the best solution). The reason for this risk is that the
goal state could potentially be pruned.
A beam search is most often used to maintain tractability in large systems with
insufficient amount of memory to store the entire search tree. For example, machine
translation systems. The first use of a beam search was in the Harpy Speech
Recognition System, CMU 1976.
Consequently the number of nodes explored remains manageable, even if there is a
great deal of branching and the search is deep. If beam search of width ‘w’ is used
in a tree with branching factor ‘b’, there will be only ‘wb’ nodes under
consideration at any depth, not the explosive number there would be if breadth-
first search were used.
Only the best few paths are followed downward at each level. This method is very
efficient in memory usage and would be particularly useful for exploring a search
space that had a very high branching factor (such as in game trees for games, such
as Go or Chess).
It has the disadvantage of not exhaustively searching the entire tree and so may
fail to ever find a goal node.
Choosing a good heuristic
Some heuristics are better than others, and the better (more informed) the heuristic
is, the fewer nodes it needs to examine in the search tree to find a solution. Hence, like
choosing the right representation, choosing the right heuristic can make a significant
difference in our ability to solve a problem.
In choosing heuristics, we usually consider a heuristic that reduces the number of
nodes that need to be examined in the search tree as a good heuristic.
It is also important to consider the efficiency of running the heuristic itself. In other
words, if it takes an hour to compute a heuristic value for a given state, the fact that
doing so saves a few minutes of total search time is irrelevant.
Admissibility, monotonicity and informedness
Behaviour of heuristics is evaluated along a number of dimensions. For instance, we may
not only desire a solution but also may require the algorithm to find the shortest path to the
goal. This could be important when an application might have an excessive cost for extra
solution steps, such as planning a path for an autonomous robot through a dangerous
environment.
Heuristics that find the shortest path to a goal whenever it exists are said to be admissible.
In other applications a minimal solution path might not be as important as overall problem-
solving efficiency. In what sense is one heuristic better than another- this is the
informedness of a heuristic. When a state is discovered by using a heuristic search, is there
any guarantee that the same state won’t be found later in the search at a cheaper cost(with
a shorter path from the start state.)? This is the property of monotonicity.
Admissibility measures
A search algorithm is admissible if it is guaranteed to find a minimal path to a
solution whenever such a path exists.
o Breadth-first search is an admissible strategy. Because it looks at every state at
level ‘n’ of the graph before considering any state at level ‘n+1’, any goal nodes
37
Course module
are found along the shortest possible path. Unfortunately breadth-first search is
often too inefficient for practical use.
An admissible heuristic is a heuristic that never overestimates the true distance of
a node from the goal.
Monotonicity
A search method is described as monotone if it always reaches a given node by the
shortest possible path.
A search method that reaches a given node at different depths in the search tree is
not monotone.
A monotone search method must be admissible, provided there is only one goal
state.
A monotonic heuristic is a heuristic that has this property.
Informedness
A heuristic ‘h’ is said to be more informed than another heuristic, ‘j’, if h (node)
>=j (node) for all nodes in the search space. (In fact, in order for ‘h’ to be more
informed than ‘j’, there must be some node where h (node) >j (node). Otherwise
they are as informed as each other.)
The more informed a search method is, the more efficiently it will search.
38
Course module
The A* algorithm operates in the same manner as best-first search but uses the
following function to evaluate nodes: f(node) = g(node) + h(node) where
h(node)<=C(node)
node state encountered in the search.
g (node) cost of the path so far leading up to the node.
h (node) distance of the node from a goal state;
C (node) actual distance of the node from the goal.
f is called a path-based evaluation function.
When operating A*, f(node) is evaluated for successor nodes and paths are
extended using the nodes that have the lowest values of f.
All A* algorithms are admissible.
If h(node) is always an underestimate of the distance of a node to a goal node, then
the A* algorithm is optimal: it is guaranteed to find the shortest path to a goal state. A*
described as being optimally efficient, in finding the path to the goal node, it will
expand the fewest possible paths. Again, this property depends on h(node) always
being an underestimate.
If a non admissible heuristic for h(node) is used, then the algorithm is called
algorithm A. If algorithm A is used with an evaluation function in which h(node)
is less than or equal to the cost of the minimal path from n to the goal, the resulting
search algorithm is called algorithm A*.
Special cases of A*
Algorithm A
Consider the evaluation function f(n)=g(n)+h(n); where n is any state encountered in the
search. g(n) is the cost of n from the start state. h(n) is the heuristic estimate of the cost of
going from n to a goal. If this is used with the best first search algorithm and h(n) is a non
admissible heuristic the result is called algorithm A.
Uniform cost search
Uniform cost search (or Branch and Bound) is a variation on best-first search that uses
the evaluation function g(node), which for a given node evaluates to the cost of the path
leading to that node from the initial state. In other words, this is an A* algorithm but
where h(node) is set to zero.
At each stage, the path that has the lowest cost so far is extended. In this way, the
path that is generated is likely to be the path with the lowest overall cost, but this is
not guaranteed.
To find the best path, the algorithm needs to continue running after a solution is
found, and if a preferable solution is found, it should be accepted in place of the
earlier solution.
39
Course module
We start with the initial state and expand it. This leads to the tree below:
We now have a goal state but the algorithm does not recognize it yet as there is still a node
with a cheaper path cost. In fact, what the algorithm does is order
the queue by the path cost so the node with cost 11 will be behind
node B in the queue. Node B (being the cheapest) is now expanded,
giving
A goal state (G10) will now be at the front of the queue. Therefore
the search will end and the path SBG will be returned.
In summary, uniform cost search will find the cheapest solution provided that the cost
of the path never decreases as we proceed along the path.
40
Course module
One of the most interesting and well publicized areas of Artificial Intelligence research has
been in the playing of games. With the success of Deep Blue in 1997, a landmark was
reached: a computer program that could defeat the best chess player in the world.
Game-playing systems tend to rely heavily on the search techniques in combination with a
number of heuristics and often a detailed database of knowledge about the game. This
chapter explains the relationship between search and games. It explains the concepts of
Minimax and alpha–beta pruning.
Tic-Tac-Toe Problem
• Given an n x n matrix, the object of the game is to make three of your symbol in a
row, column or diagonal
– This is a win state for the game.
– Think a 3 x 3 square board with 9 open places where:
– One player is designated as player X and makes the first play by marking
an X into any of the n x n open squares of the board.
– The second player, "O", then follows suit by marking an O into any of the
other open squares that remain.
– This continues back-and-forth until one player wins the game or players fill
all squares on the board without establishing a winner. This is a draw.
41
Course module
42
Course module
game tree is an instance of a tree in which the root node represents the state before any
moves have been made, the nodes in the tree represent possible states of the game (or
positions), and arcs in the tree represent moves.
It is usual to represent the two players’ moves on alternate levels of the game tree, so
that all edges leading from the root node to the first level represent possible moves
for the first player, and edges from the first level to the second represent moves for
the second player, and so on.
Leaf nodes in the tree represent final states, where the game has been won, lost, or
drawn. In simple games, a goal node might represent a state in which the computer
has won, but for more complex games such as chess, the concept of a goal state is
rarely of use.
One approach to playing a game might be for the computer to use a tree search
algorithm such as depth-first or breadth-first search, looking for a goal state (i.e., a
final state of the game where the computer has won).
Unfortunately, this approach does not work because there is another intelligence
involved in the game. We will consider this to be a rational, informed opponent who plays
to win. Whether this opponent is human or another computer does not matter—or should
not matter.
43
Course module
Review Questions
1. Explain the idea behind Generate and Test. Why is this method described as being
exhaustive ?
2. Explain the differences and similarities between depth-first search and breadth-first
search.
3. Explain what is meant by the following terms in relation to search methods:
a) completeness
b) optimality.
4. What does it mean to say that a search method is monotonic?
5. Explain why Depth-First Search Iterative Deepening is reasonably efficient. Why
might it be preferable to use DFID rather than depth-first search?
6. Provide a definition of the word “heuristic.” In what ways can heuristics be useful
in search?
7. Explain the components of the path evaluation function f(node) used by A*.
44
Course module
Humans, it seems, know things and do reasoning. Knowledge and reasoning are also
important for artificial agents because they enable successful behaviors that would be very
hard to achieve otherwise.
Knowledge and reasoning also play a crucial role in dealing with partially observable
environments.
Logic has the pedagogical advantage of being a simple example of a representation for
knowledge-based agents, but logic has some severe limitations. Clearly, a large portion of
the reasoning carried out by humans and other agents in partially observable environments
depends on handling knowledge that is uncertain. Logic cannot represent this uncertainty
well.
Knowledge-based agents
The central component of a knowledge-based agent is its knowledge base, or KB.
Informally, a knowledge base is a set of sentences. The capabilities of representation,
reasoning, and learning are pillar to the development of the theory and technology of logic.
Logic defines the fundamental concepts of logical representation, reasoning, and
semantics of the language / the "meaning" of sentences. In logic, the definition is more
precise. The semantics of the language defines the truth of each sentence with respect to
each possible world.
45
Course module
NB: please refer Logic in Computer Science course that you have taken.
In order for a computer to solve a problem that relates to the real world, it first needs some
way to represent the real world internally. That is representation of knowledge. Knowledge
is used to achieve intelligent behavior. And the fundamental goal of knowledge
representation is to represent knowledge in a manner to facilitate inference (i.e. drawing
conclusions from knowledge).
Knowledge representation 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" 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 (KR) expresses knowledge explicitly in a computer-tractable
way such that the agent can reason out.
• Some of the methods used for knowledge representation include Logic, Semantic
Nets, Frames and Production rules.
Logic is general and can be used to represent any knowledge. But it lacked
facilities like: Packaging of data and procedures into KB; and also Built-in
inheritance A Logic is a formal language in which knowledge can be
represented such that conclusions can easily be drawn. It is a declarative
language to assert sentences & deduce from sentences.
Semantic Nets, Frames and Production rules are less general, but more
natural & easier to work with. They used to define relations between objects
and support inference by inheritance.
46
Course module
What is Knowledge? Knowledge includes facts about the real world entities and the
relationship between them.
– It is an understanding gained through experience
– familiarity with the way to perform a task
– an accumulation of facts, procedural rules, or heuristics
– It may keep on changing (dynamic).
What is Knowledge base? Knowledge base is used to store facts and rules.
KBS vs. AI
• Knowledge based system is part of Artificial Intelligence
• AI also requires extensive knowledge of the subject at hand.
47
Course module
If the agent cannot find a categorical answer, the agent must therefore act under
uncertainty. Uncertainty can also arise because of incompleteness and incorrectness in the
agent's understanding of the properties of the environment.
Probability provides a way of summarizing the uncertainty. All probability statements
must therefore indicate the evidence with respect to which the probability is being assessed.
As the agent receives new percepts, its probability assessments are updated to reflect the
new evidence. Before the evidence is obtained, we talk about prior or unconditional
probability; after the evidence is obtained, we talk about posterior or conditional
probability.
We will use the notation P(A) for the unconditional or prior probability that the
proposition A is true. The proposition that is the subject of a probability statement can be
represented by a proposition symbol, as in the P(A) example. Propositions can also include
equalities involving so-called random variables. For example, if we are concerned about
the random variable weather, we might have
P( Weather = Sunny) = 0.7
P(Weather = Rain) = 0.2
P(Weather= Cloudy) = 0.08
P(Weather = Snow) = 0.02
Each random variable X has a domain of possible values (x\,...,xn) that it can take on.
Usually, we will use the letters A, B, and so on for Boolean random variables, and the
letters X, Y, and so on for multivalued variables.
We can view proposition symbols as random variables as well, if we assume that they have
a domain [true,false]. Thus, the expression P(A) can be viewed as shorthand for P(A =
true). Similarly, P(¬A) is shorthand for P(A =false).
Once the agent has obtained some evidence concerning the previously unknown
propositions making up the domain, prior probabilities are no longer applicable. Instead,
we use conditional or posterior probabilities, with the notation P(A\B). This is read as
"the probability of A given that all we know is B." It is important to remember that P(A\B)
can only be used when all we know is B. Conditional probabilities can be
defined in terms of unconditional probabilities. The equation
49
Course module
Machine Learning or simply learning is the subfield of AI concerned with programs that
learn from experience.
What is learning? Learning is:
• One of the keys to human intelligence
• Memorizing something; examples: Telephone number, Reading textbook,
Understanding Language (memorizing grammar & practicing), Recognize
face, signature & fraudulent credit card transactions
• Knowing facts through observation and exploration; examples: Develop
scientific theory, Undertaking research
• Improving motor and/or cognitive skills through practice; examples: Riding
a bike, Exercising and practicing the idea
• The idea behind learning is that percepts should not only be used for acting now,
but also for improving the agent’s ability to act in the future.
– Learning is essential for unknown environments, i.e. when the agent lacks
knowledge. It enables to organize new knowledge into general, effective
representations
– Learning modifies the agent's decision making mechanisms to improve
performance
Learning takes place as a result of the interaction between the agent and the world, and
from observation by the agent of its own decision-making processes. Learning means
behaving better as a result of experience. Learning can range from trivial memorization of
experience to the creation of entire scientific theories.
A learning agent can be divided into four conceptual components, as shown in Figure 6.1.
1. The learning element: is responsible for making improvements. It takes some
knowledge about the learning element and some feedback on how the agent is doing,
and determines how the performance element should be modified to (hopefully) do
better in the future. The learning element is also responsible for improving the
efficiency of the performance element.
2. The performance element: is responsible for selecting external actions. It takes in
percepts and decides on actions.
3. The critic: is designed to tell the learning element how well the agent is doing. The
critic employs a fixed standard of performance. This is necessary because the percepts
themselves provide no indication of the agent's success. The critic observes the world
and passes information along to the learning element.
4. The problem generator: is responsible for suggesting actions that will lead to new
and informative experiences.
50
Course module
51
Course module
Prior knowledge is vital for learning. In most cases, the prior knowledge is represented as
general first-order logical theories; thus for the first time we bring together the work on
knowledge representation and learning.
In a logical setting, an example is an object that is described by a logical sentence; the attributes
become unary predicates. To understand the role of prior knowledge, we need to talk about the
logical relationships among hypotheses, example descriptions, and classifications.
Figure 5.2: A cumulative learning process uses, and adds to, its stock of background knowledge
over time.
52
Course module
Neural networks are used to look for patterns in data, learn these patterns, and then classify
new patterns & make forecasts
A network with the input and output layer only is called single-layered neural network.
Whereas, a multilayer neural network is a generalized one with one or more hidden layer.
A network containing two hidden layers is called a three-layer neural network, and so on.
53
Course module
Human Language Technologies are information technologies that are specialized for
dealing with the most complex information medium in our world: human language.
Human language covers a broad range of activities with the eventual goal of enabling
people to communicate with machines using natural communication skills.
Human language also consists of computational linguistics (CL) and speech technology as
its core.
CL is an interdisciplinary field dealing with the statistical and/or rule-based modeling of
natural language from a computational perspective.
– Needs interdisciplinary teams, including linguists, language experts, and computer
scientists.
– Involves linguists, computer scientists, experts in artificial intelligence,
mathematicians, logicians, philosophers, cognitive scientists, cognitive
psychologists, psycholinguists, anthropologists and neuroscientists, etc.
54
Course module
Speech Technology relates to the technologies designed to duplicate and respond to the
human voice.
– Have many uses, including to aid the voice-disabled, the hearing-disabled, the blind,
and to communicate with computers without a keyboard, to market goods or services
by telephone and to enhance game software
– Consists of speech recognition, speech synthesis, speaker recognition, speaker
verification
6.3 Perception
Perception provides agents with information about the world they inhabit. Perception is
initiated by sensors. A sensor is anything that can change the computational state of the
agent in response to a change in the state of the world. It could be as simple as a one-bit
sensor that detects whether a switch is on or off, or as complex as the retina of the human
eye, which contains more than a hundred million photosensitive elements.
There are a variety of sensory modalities that are available to artificial agents. Those they
share with humans include vision, hearing, and touch.
55
Course module
6.4 Robotics
56
Course module
Force sensing: Even though robots can sense and control the positions of their joints much
more accurately than humans, there are still many tasks that cannot be carried out using
only position sensing.
Force can be regulated to some extent by controlling electric motor current, but accurate
control requires a force sensor. These sensors are usually placed between the manipulator
and end effector and can sense forces and torques in six directions. Using force control, a
robot can move along a surface while maintaining contact with a fixed pressure. Such
motions are called compliant motions, and are extremely important in many robotic
applications.
Tactile sensing: Tactile sensing (or touch sensing) is the robotic version of the human
sense of touch. A robot's tactile sensor uses an elastic material and a sensing scheme that
measures the distortion of the material under contact. The sensor may give data at an array
of points on the elastic surface, producing the analogue of a camera image, but of
deformation rather than light intensity. Tactile sensors can also sense vibration, which
helps to detect the impending escape of the coffee cup from the holder's grasp. Human
beings use this scheme with a very fast servo loop to detect slip and control the grasping
force to near the minimum needed to prevent slip.
Sonar: is SOund NAvigation and Ranging. Sonar provides useful information about
objects very close to the robot and is often used for fast emergency collision avoidance. It
is sometimes used to map the robot's environment over a larger area.
Sonar works by measuring the time of flight for a sound pulse generated by the sensor to
reach an object and be reflected back. The pulse or "chirp" is typically about 50 kHz. This
is more than twice the upper limit for humans of 20 kHz. Sound at that frequency has a
wavelength of about 7 mm. The speed of sound is about 330 m/second, so the round-trip
time delay for an object 1 m away is about 6 x 10-3 seconds.
Domain areas of robot:
Manufacturing is seen as the traditional domain of the robot.
Material handling is another traditional domain for robots. Material handling is the
storage, transport, and delivery of material, which can range in size from silicon chips to
diesel trucks.
Buildings (especially hospitals, and as security guards): Mobile robots (mobots) are also
becoming widely useful as couriers in buildings. These robots respond to requests from a
computer terminal and carry documents or supplies to a destination somewhere else in the
building. The robot negotiates hallways and elevators, and avoids collision with other
obstacles such as humans and furniture in a high availability (it can work 24 hours a day),
high reliability (supplies are not lost or misplaced).
Hazardous environments: Mobile robots are an important technology for reducing risk
to human life in hazardous environments. Robots can reduce risk to humans in unstable
buildings after earthquakes, near fire or toxic fumes, and in radioactive environments. They
can also be used for routine tasks in dangerous situations including toxic waste cleanup,
deep sea recovery, exploration, mining, and manipulation of biologically hazardous
materials. A human operator is often available to guide the robot, but it also needs
autonomy to recognize and respond to hazards to its own and others' well-being.
Telepresence(reality) and virtual reality (imaginary): As computers spread from
scientific/business applications to a consumer technology, telepresence and virtual reality
continue to captivate the public imagination. The idea of staying in one's home and being
57
Course module
able to sense exotic environments, either real (telepresence) or imaginary (virtual reality)
is indeed compelling, and is a driving force behind some major moves in the computer and
entertainment industries.
Augmentation of human abilities: A precursor to telepresence involves putting a human
inside a large, strong robot.
Formative Assessments
Quiz ......................................................................................................... 5%
Individual assignment ............................................................................... 5%
Group assignment ..................................................................................... 10%
Test ......................................................................................................... 15%
Lab Test and Project................................................................................ 15%
Subtotal .....................................................................................................50%
Summative Assessment
Worksheet
58
Course module
Assignments
A. Concept and principle understanding Assignments
Individual Assignment (5%): Last Submission date: April 30, 2024
1. Describe the problem solving methods in AI. (2%).
2. Describe the term Constraint Satisfaction Search and give two valid examples. (1%)
3. State the term robot and its type in detail. (2%).
References used
59