Skip to main content
ARTIFICIAL
INTELLIGENCE
By: Dessalew G.
BOOK : Artificial Intelligence A Modern Approach
Stuart J. Russell and Peter Norvig
CHAPTER ONE
Introduction to AI
01/16/2025 3
LIST OF CONTENTS
1. Objectives/Goals of AI
2. What is AI?
3. Approaches to AI – making computer:
 Think like a human ( Thinking humanly)
 Act like a human (Acting humanly)
 Think rationally (Thinking rationally)
 Act rationally (Acting rationally)
4. The Foundations of AI
5. History and the State of the Art
01/16/2025 4
1. OBJECTIVES/GOALS OF AI
 Humankind has given itself the scientific name homo sapiens: man the wise
 It is because, our mental capacities are so important to our everyday lives and our
sense of self.
 The field of artificial intelligence, or AI, attempts to understand intelligent entities.
 Thus, one reason to study it is to learn more about ourselves.
 But unlike philosophy and psychology, which are also concerned with intelligence,
AI strives to build intelligent entities as well as understand them
01/16/2025 5
CONT…
 One of the goals of AI is to be a problem-solving machine.
 There are already many computers that can solve problems, but only in a limited
scope.
 This said, a computer can only solve problems it is programed to solve or has the
necessary information to solve; AIs do not yet have analytical capabilities.
 Although AI does not have analytical abilities, some AI’s are much more efficient at
solving problems than people are.
01/16/2025 6
CONT…
 AI addresses one of the ultimate puzzles.
 How is it possible for a slow, tiny brain, whether biological or electronic, to perceive,
understand, predict, and manipulate a world far larger and more complicated than
itself?
 Alongside problem solving, another purpose of AI is learning.
 Certain intelligent robots are able to achieve a desired result or overcome an
obstacle in an unfamiliar situation by attempting different routes and memorizing the
route that worked best, so they can be successful in the future when they are in a
similar situation.
01/16/2025 7
CONT…
 There is a limit to learning.
 Some robots observe when humans interact socially and pick up visual and audio
cues, allowing them to learn how to respond appropriately.
 Other robots learn by mimicking human action.
 However, AIs have no where near the learning capabilities of humans.
 In a Stanford University article about AI, it is written that robots are not able to
learn like children do.
 we might see it in the near future
01/16/2025 8
CONT…
 Some of the goals of AI like creating problem solving and learning machines are shared by
many experts in the field, but there is still a plethora of varying objectives when it comes to AI.
 The reason why there are no clear definitions or clear goals set for AI is because AI is still in its
developmental stages.
 Everyday researchers are bringing in new ideas to the field, meaning that AI is a malleable
concept that has many open-ended avenues.
 One of the trickiest and most complicated classifications of AI is that AI aims at human level
intelligence.
 Only time will tell us what AI is and what will come from it.
01/16/2025 9
2.WHAT IS AI
 We have now explained why AI is exciting, but we have not said what it is.
 We could just say, "Well, it has to do with smart programs, so let's get on and write
some.
 Artificial intelligence (AI): is intelligence demonstrated by machines, as
opposed to natural intelligence displayed by animals including humans.
 Leading AI textbooks define the field as the study of "intelligent agents": any
system that perceives its environment and takes actions that maximize its chance
of achieving its goals.
01/16/2025 10
CONT…
 Some popular accounts use the term "artificial intelligence" to describe machines that
mimic "cognitive" functions that humans associate with the human mind, such as "learning"
and "problem solving", however, this definition is rejected by major AI researchers.
 AI applications include:
 advanced web search engines (i.e. Google),
 recommendation systems (used by YouTube, Amazon and Netflix)
 understanding human speech (such as Siri and Alexa),
01/16/2025 11
CONT…
 self-driving cars (e.g.Tesla)
 automated decision-making and competing at the highest level in strategic game
systems (such as chess and Go).
 As machines become increasingly capable, tasks considered to require "intelligence"
are often removed from the definition of AI, a phenomenon known as the AI effect.
 For instance, optical character recognition is frequently excluded from things
considered to be AI, having become a routine technology.
01/16/2025 12
3. APPROACHES TO AI – MAKING COMPUTER:
 Definitions of artificial intelligence according to eight recent textbooks:
01/16/2025 13
3.1 THINKING HUMANLY: THE COGNITIVE MODELLING
APPROACH
 Once we have a sufficiently precise theory of the mind, it becomes possible to express the
theory as a computer program.
 If the program's input/output and timing behavior matches human behavior, that is evidence
that some of the program's mechanisms may also be operating in humans.
 The interdisciplinary field of cognitive science brings together computer models from AI
and experimental techniques from psychology to try to construct precise and testable
theories of the workings of the human mind.
01/16/2025 14
CONT…
 Real cognitive science, however, is necessarily based on experimental
investigation of actual humans or animals, and authors assume that the reader only
has access to a computer for experimentation.
 We will note that AI and cognitive science continue to fertilize each other,
especially in the areas of vision, natural language, and learning.
 How to validate?
 Predicting and testing behavior of human subjects (top-down)
 Direct identification from neurological data (bottom-up)
01/16/2025 15
3.2 ACTING HUMANLY: THE TURING TEST APPROACH
 Turing test: proposed by Alan Turing (1950), was designed to provide a
satisfactory operational definition of intelligence.
 Turing defined intelligent behavior as the ability to achieve human-level
performance in all cognitive tasks, sufficient to fool an interrogator.
 Roughly speaking, the test he proposed is that the computer should be
interrogated by a human via a teletype, and passes the test if the interrogator
cannot tell if there is a computer or a human at the other end.
01/16/2025 16
CONT…
 The computer would need to possess the following capabilities:
 Natural language processing: to enable it to communicate successfully in English (or
some other human language); knowledge representation to store information provided
before or during the interrogation;
 Knowledge representation: to store information provided before or during the
interrogation;
 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
01/16/2025 17
CONT…
 Turing's test deliberately avoided direct physical interaction between the interrogator
and the computer, because physical simulation of a person is unnecessary for
intelligence.
 Total Turing Test includes a video signal so that the interrogator can test the subject's
perceptual abilities, as well as the opportunity for the interrogator to pass physical
objects "through the hatch.“
 To pass the total Turing Test, the computer will need:
 Computer vision: to perceive objects, and
 Robotics: to move them about.
01/16/2025 18
3.3 THINKING RATIONALLY: THE LAWS OF THOUGHT
APPROACH
 The Greek philosopher Aristotle was one of the first to attempt to codify "right
thinking," that is, irrefutable reasoning processes.
 His famous syllogisms provided patterns for argument structures that always gave
correct conclusions given correct premises.
 For example, "Socrates is a man; all men are mortal; therefore Socrates is mortal.“
 These laws of thought were supposed to govern the operation of the mind, and
initiated the field of logic
01/16/2025 19
CONT…
 The development of formal logic in the late nineteenth and early twentieth
centuries provided a precise notation for statements about all kinds of things in the
world and the relations between them
 By 1965, programs existed that could, given enough time and memory, take a
description of a problem in logical notation and find the solution to the problem, if
one exists
 If there is no solution, the program might never stop looking for it
 The so-called logicist tradition within artificial intelligence hopes to build on such
programs to create intelligent systems
01/16/2025 20
3.4 ACTING RATIONALLY: THE RATIONAL AGENT
APPROACH
 Acting rationally means acting so as to achieve one's goals, given one's beliefs
 An agent is just something that perceives and acts
 In the "laws of thought" approach to AI, the whole 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
 On the other hand, correct inference is not all of rationality, because there are often
situations where there is no provably correct thing to do, yet something must still be
done
01/16/2025 21
CONT…
 There are also ways of acting rationally that cannot be reasonably said to involve
inference.
 For example, pulling one's hand off of a hot stove is a reflex action that is more
successful than a slower action taken after careful deliberation.
 All the "cognitive 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.
01/16/2025 22
CONT…
 The study of AI as rational agent design therefore has two advantages.
 First, it is more general than the "laws of thought" approach, because correct inference is
only a useful mechanism for achieving rationality, and not a necessary one.
 Second, it is more amenable to scientific development than approaches based on human
behavior or human thought, because the standard of rationality is clearly defined and
completely general.
 Human behavior, on the other hand, is well-adapted for one specific environment and is the
product, in part, of a complicated and largely unknown evolutionary process that still may
be far from achieving perfection.
01/16/2025 23
4.THE FOUNDATIONS OF ARTIFICIAL INTELLIGENCE
 Although AI itself is a young field, it has inherited many ideas, viewpoints, and techniques from
other disciplines.
 From over 2000 years of tradition in philosophy, theories of reasoning and learning have
emerged.
 From over 400 years of mathematics, we have formal theories of logic, probability, decision
making, and computation.
 From psychology, we have the tools with which to investigate the human mind, and a scientific
language within which to express the resulting theories.
 From linguistics, we have theories of the structure and meaning of language.
 Finally, from computer science, we have the tools with which to make AI a reality.
01/16/2025 24
5. HISTORY AND THE STATE OF THE ART
 Gestation (1943-1952)
 Early learning theory, first neural network,Turing test
 McCulloch and Pitts artificial neuron, Hebbian learning
 Birth (1952 - 1956)
 Name coined by McCarthy
 Workshop at Dartmouth
01/16/2025 25
CONT…
 Early enthusiasm, great expectations (1956-1966)
 GPS, physical symbol system hypothesis
 Geometry Theorem Prover (Gelertner), Checkers (Samuels)
 Lisp (McCarthy),Theorem Proving (McCarthy), Microworlds (Minsky et. al.)
 “neat” (McCarthy @ Stanford) vs.“scruffy” (Minsky @ MIT)
 Dose of Reality (1966-1973)
 Combinatorial explosion
01/16/2025 26
CONT…
 Knowledge-based systems (1969-1979)
 AI Becomes an Industry (1980-present)
 Boom period 1980-88, then AI Winter
 Return of Neural Networks (1986-present)
 AI Becomes a Science (1987-present)
 Security Orchestration, Automation and Response (SOAR)
 Internet as a domain
 The emergence of intelligent agents(1995-present)
01/16/2025 27
CONT…
State of the art
 Deep Blue defeated the reigning world chess champion Garry Kasparov in 1997
 Proved a mathematical conjecture (Robbins conjecture) unsolved for decades
 No hands across America (driving autonomously 98% of the time from Pittsburgh
to San Diego)
 During the 1991 Gulf War, US forces deployed an AI logistics planning and
scheduling program that involved up to 50,000 vehicles, cargo, and people
01/16/2025 28
CONT…
 NASA's on-board autonomous planning program controlled the scheduling of
operations for a spacecraft
 Proverb solves crossword puzzles better than most humans
01/16/2025 29
THE END OF CHAPTER ONE
CHAPTER TWO
Intelligent Agents
01/16/2025 31
LIST OF CONTENTS
1. Introduction
2. Agents and Environments
3. Acting of Intelligent Agents
(Rationality)
4. Structure of Intelligent Agents
5. Agent Types
 Simple reflex agent
 Model-based reflex agent
 Goal-based agent
 Utility-based agent
 Learning agent
6. Important Concepts and Terms
01/16/2025 32
1. INTRODUCTION
 An agent is anything that can be viewed as perceiving its environment through
sensors and acting upon that environment through effectors
 A human agent has eyes, ears, and other organs for sensors, and hands, legs,
mouth, and other body parts for effectors.
 A robotic agent substitutes cameras and infrared range finders for the sensors and
various motors for the effectors
 A software agent has encoded bit strings as its percepts and actions
01/16/2025 33
CONT…
01/16/2025 34
2. AGENTS AND ENVIRONMENTS
 Actions are done by the agent on the environment, which in turn provides percepts to the agent
 Task environments are the problems While the rational agents are the solutions
 Specifying the task environment, apply PEAS description as fully as possible
 Performance
 Environment
 Actuators
 Sensors
 In designing an agent, the first step must always be to specify the task environment as fully as
possible
01/16/2025 35
CONT…
 Take taxi driver as an example, the following are the task environment
descriptions.
Agent type Performance
measure
Environment Actuator Sensor
Taxi driver Safe, fast, legal,
comfortable
trip, maximize
profits.
Roads, other
traffic,
pedestrians,
customers.
Steering,
accelerator,
break, signal,
horn, display.
Cameras, sonar,
speedometer,
GPS, odometer,
accelerometer,
engine sensor,
keyboard.
01/16/2025 36
CONT…
 Properties of environment
 Accessible vs. inaccessible.
If an agent's sensory apparatus gives it access to the complete state of the
environment, then we say that the environment is accessible to that agent
An environment is effectively accessible if the sensors detect all aspects that
are relevant to the choice of action
An accessible environment is convenient because the agent need not
maintain any internal state to keep track of the world
01/16/2025 37
CONT…
Deterministic vs. nondeterministic
If the next state of the environment is completely determined by the current
state and the actions selected by the agents, then we say the environment is
deterministic otherwise it is nondeterministic (stochastic).
In principle, an agent need not worry about uncertainty in an accessible,
deterministic environment.
If the environment is inaccessible, however, then it may appear to be
nondeterministic.
01/16/2025 38
CONT…
This is particularly true if the environment is complex, making it hard to keep
track of all the inaccessible aspects
Thus, it is often better to think of an environment as deterministic or
nondeterministic from the point of view of the agent
Strategic environment: is deterministic except for actions of other agents
Cleaner and taxi driver are:
 Stochastic because of some unobservable aspects -noise or unknown
01/16/2025 39
CONT…
Episodic vs. non-episodic
In an episodic environment, the agent's experience is divided into "episodes.“
 Each episode consists of the agent perceiving and then acting.
The quality of its action depends just on the episode itself
Because subsequent episodes do not depend on what actions occur in previous episodes.
Episodic environments are much simpler because the agent does not need to think ahead.
If Current action may affect all future decisions, then it is non-episodic or sequential
An example is taxi driver
01/16/2025 40
CONT…
Static vs. dynamic
If the environment can change while an agent is deliberating, then we say the environment is
dynamic for that agent, otherwise it is static
Static environments are easy to deal with because the agent need not keep looking at the world
while it is deciding on an action, nor need it worry about the passage of time
If the environment does not change with the passage of time but the agent's performance score
does, then we say the environment is semi-dynamic
• An example of dynamic environment: the number of people in the street (taxi)
• An example of static environment: the destination (taxi)
01/16/2025 41
CONT…
Discrete vs. continuous
If there are a limited number of distinct, clearly defined percepts and actions, we
say that the environment is discrete.
Chess is discrete: there are a fixed number of possible moves on each turn.
Taxi driving is continuous: the speed and location of the taxi and the other
vehicles sweep through a range of continuous values
01/16/2025 42
CONT…
Single agentVS. multi-agent
Playing a crossword puzzle: single agent
Chess playing: two agents
Competitive multi-agent environment
• Chess playing
Cooperative multi-agent environment
• Automated taxi driver: avoiding collision
01/16/2025 43
CONT…
 An examples of properties of an environment
01/16/2025 44
3. ACTING OF INTELLIGENT AGENTS
(RATIONALITY)
 Rational agent
 One that does the right thing
 Every entry in the table for the agent function is correct (rational)
 What is correct?
 The actions that cause the agent to be most successful
 The problem is deciding how and when to evaluate the agent's success
 We use the term performance measure for the how the criteria that determine
how successful an agent is
01/16/2025 45
CONT…
 Performance measure
 An objective function that determines how the agent does successfully
 E.g., 90% or 30% ?
 An agent, based on its percepts:
 If desirable, it is said to be performing well
 No universal performance measure for all agents
01/16/2025 46
CONT…
 Consider the case of an agent that is supposed to vacuum a dirty floor:
A plausible performance measure would be the amount of dirt cleaned up in a
single eight-hour shift.
A more sophisticated performance measure would factor in the amount of
electricity consumed and the amount of noise generated as well.
A third performance measure might give highest marks to an agent that not only
cleans the floor quietly and efficiently, but also finds time to go windsurfing at the
weekend
01/16/2025 47
CONT…
 Rationality
What is rational at any given time depends on four things:
 The performance measure defining the degree of success
 The agent's percept sequence up to now (perceptual history)
 The agent’s prior knowledge of the environment
 The actions that the agent can perform
01/16/2025 48
CONT…
 Ideal rational agent
For each possible percept sequence, an ideal rational agent should:
Do whatever action is expected
To maximize its performance measure, on the basis of the evidence provided
By the percept sequence and
Whatever built-in knowledge the agent has.
 E.g.Taxi driver have to look right and left while crossing
01/16/2025 49
CONT…
 An omniscient agent
 Knows the actual outcome of its actions in advance
 No other possible outcomes
 However, impossible in real world
An example:
crossing a street but died of the fallen cargo door from 33,000ft
o Rational but not omniscient
o Hence, all rational agents are not omniscient
01/16/2025 50
CONT…
 Autonomy
If an agent just relies on the prior knowledge of its designer rather than its own
percepts then the agent lacks autonomy.
 A rational agent should be autonomous: it should learn what it can to compensate for
partial or incorrect prior knowledge.
 E.g. a clock
 No input (percepts)
 Run only by its own algorithm (prior knowledge)
 No learning, no experience, etc.
01/16/2025 51
4.STRUCTURE OF INTELLIGENT AGENTS
 So far we have talked about agents by describing their behavior
Action that is performed after any given sequence of percepts
 Now, we will 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
 Agent = architecture + program
 Architecture = some sort of computing device (sensors + actuators)
 (Agent) Program = some function that implements the agent mapping = “?”
01/16/2025 52
CONT…
 Before we design an agent program, we must have a pretty good idea of the
possible:
percepts and actions,
what goals or performance measure the agent is supposed to achieve,
what sort of environment it will operate in.
 These come in a wide variety
01/16/2025 53
CONT…
 Basic elements for a selection of agent types:
01/16/2025 54
CONT…
 Agent programs
All agent programs have the same skeleton, namely, accepting percepts from an
environment and generating actions
The early versions of agent programs will have a very simple form
This skeleton has two issues:
01/16/2025 55
CONT…
1. First, even though we defined the agent mapping as a function from percept
sequences to actions, the agent program receives only a single percept as its
input.
2. Second, the goal or performance measure is not part of the skeleton program.
Then what is the solution?
The simplest possible way we can think of to write the agent program is a lookup
table
It operates by keeping in memory its entire percept sequence, and using it to index
into table, which contains the appropriate action for all possible percept
01/16/2025 56
CONT…
 It keeps track of the percept sequence and just looks up the best
action.
o P = the set of possible percepts
o T= lifetime of the agent
o The total number of percepts it receives
o Size of the look up table  
T
t
t
P
1
o Consider playing chess
o P =10,T=150
o Will require a table of
at least 10150
entries
01/16/2025 57
5. AGENT TYPES
 Four types
 Simple reflex agents
 Model-based reflex agents
 Goal-based agents
 Utility-based agents
01/16/2025 58
CONT…
 Simple reflex agents
 It uses just condition-action rules
 The rules are like the form “if … then …”
 Efficient but have narrow range of applicability
 Because knowledge sometimes cannot be stated explicitly
 Work only if the environment is fully observable
01/16/2025 59
CONT…
 Schematic diagram of a simple reflex agent
01/16/2025 60
CONT…
 The agent program for simple reflex agent:
01/16/2025 61
CONT…
 Model-based Reflex Agents
For the world that is partially observable:
 The agent has to keep track of an internal state
 That depends on the percept history
 Reflecting some of the unobserved aspects
 E.g., driving a car and changing lane
 Requiring two types of knowledge
 How the world evolves independently of the agent
 How the agent’s actions affect the world
01/16/2025 62
CONT…
 Schematic diagram of model-based agent
01/16/2025 63
CONT…
 Agent program for model-based agent
01/16/2025 64
CONT…
 Goal-based agent
 Knowing about the current state of the environment is not always enough to
decide what to do
 As well as a current state description, the agent needs some sort of goal
information
 Goal-based agents are less efficient but, more flexible
 Agent  Different goals  different tasks
 Search and planning are two other sub-fields in AI to find out the action
sequences to achieve its goal
01/16/2025 65
CONT…
 Schematic diagram of goal-based agent

01/16/2025 66
CONT…
 Agent program for goal-based agent
01/16/2025 67
CONT…
 Utility-based agents
 Goals alone are not enough to generate high-quality behavior
 For example, there are many action sequences that will get the taxi to its destination
 Thereby achieving the goal, but some are quicker, safer, more reliable, or cheaper than
others.
 Goals just provide a crude distinction between "happy" and "unhappy" states
 whereas a more general performance measure should allow a comparison of different
world states (or sequences of states) according to exactly how happy they would make the
agent if they could be achieved
01/16/2025 68
CONT…
 Because "happy" does not sound very scientific, the customary terminology is to
say that if one world state is preferred to another, then it has higher utility for the
agent.
 Utility is therefore a function that maps a state onto a real number, which describes
the associated degree of happiness.
 It is said state A has higher utility If state A is more preferred than others
 Then utility means the degree of success
01/16/2025 69
CONT…
 Schematic diagram of utility-based agent
01/16/2025 70
CONT…
 Learning agent
After an agent is programmed, can it work immediately?
 No, it still need teaching
In AI,
 Once an agent is done
 We teach it by giving it a set of examples
 Test it by using another set of examples
We then say the agent learns
 A learning agent
01/16/2025 71
CONT…
Four conceptual components
 Learning element
 Making improvement
 Performance element
 Selecting external actions
01/16/2025 72
CONT…
 Critic
 Tells the Learning element how well the agent is doing with respect to fixed
performance standard.
 (Feedback from user or examples, good or not?)
 Problem generator
 Suggest actions that will lead to new and informative experiences.
01/16/2025 73
CONT…
 Schematic diagram of learning agent
01/16/2025 74
6. IMPORTANT CONCEPTS AND TERMS
 Percept
 Agent’s perceptual inputs at any given instant
 Percept sequence
 Complete history of everything that the agent has ever perceived.
 Agent function & program
Agent’s behavior is mathematically described by
 Agent function: it is a function mapping any given percept sequence to an
action
 Practically it is described by:
 An agent program (the real implementation)
01/16/2025 75
CONT…
 Vacuum-cleaner world
Perception: Clean or Dirty? where it is in?
Actions: Move left, Move right, suck, do nothing
01/16/2025 76
CONT…
 Partial tabulation of a simple agent function for Vacuum-cleaner world
01/16/2025 77
CONT…
 Program implementation Vacuum-cleaner world
Function Reflex-Vacuum-Agent([location, status]) return an
action
If status = Dirty then return Suck
else if location = A then return Right
else if location = B then return left
01/16/2025 78
THE END OF CHAPTER TWO
CHAPTER THREE
Solving Problems by Searching and
Constraint Satisfaction Problem
01/16/2025 80
LIST OF CONTENTS
1. Problem Solving by Searching
2. Problem Solving Agents
3. Problem Formulation
4. Search Strategies
5. Avoiding Repeated States
6. Constraint Satisfaction Search
7. Games as Search Problems
01/16/2025 81
1. PROBLEM SOLVING BY SEARCHING
 Simple reflex agents are limited in what they can do
 Because, their actions are determined only by the current percept
 Furthermore, they have no knowledge of what their actions do nor of what they are
trying to achieve
 They can’t work well in environments
which this mapping would be too large to store
and would take too long to learn
 Hence, goal-based agent is used
01/16/2025 82
CONT…
 Goal-based agents can succeed by considering future actions and the desirability
of their outcomes
 Goal-based agents that use more advanced factored or structured representations
are usually called planning agents
 Uninformed and informed search algorithms are used to create solution for
problems
01/16/2025 83
2. PROBLEM-SOLVING AGENTS
 Problem-solving agent is A kind of goal-based agent, It solves problem by finding
sequences of actions that lead to desirable states (goals)
 To solve a problem, the first step is the goal formulation, based on the current
situation
 The goal is formulated as a set of world states, in which the goal is satisfied
01/16/2025 84
CONT…
 To reaching from initial state to goal state
Actions are required
 Actions are the operators
causing transitions between world states
Actions should be abstract enough at a certain degree, instead of very detailed
E.g., turn left VS turn left 30 degree, etc.
01/16/2025 85
3. PROBLEM FORMULATION
 Problem formulation: is the process of deciding what actions and states to consider,
and follows goal formulation
 An agent with several immediate options of unknown value can decide what to do by
first examining ; different possible sequences of actions that lead to states of known
value, and then choosing the best one
 This process of looking for such a sequence is called search
 A search algorithm takes a problem as input and returns a solution in the form of an
action sequence
01/16/2025 86
CONT…
 Once a solution is found, the actions it recommends can be carried out.
 This is called the execution phase
 Thus, we have a simple "formulate, search, execute" design for the agent
 There are four essentially different types of problems:
Single state problems,
Multiple-state problems,
Contingency problems, and
Exploration problems
R
e
a
d
i
n
g
a
s
s
i
g
n
m
e
n
t
01/16/2025 87
CONT…
01/16/2025 88
CONT…
 Well-defined problems and solutions
A problem is really a collection of information that the agent will use to decide what to do
A problem is defined by 5 components:
Initial state
Actions
Transition model or (Successor functions)
 Goal Test
Path Cost
01/16/2025 89
CONT…
The initial state that the agent knows itself to be in.
The set of possible actions available to the agent.
The term operator is used to denote the description of an action in terms of
which state will be reached by carrying out the action in a particular state
(An alternate formulation uses a successor function S.
Together, these define the state space of the problem: the set of all states
reachable from the initial state by any sequence of actions.
01/16/2025 90
CONT…
A path in the state space is simply any sequence of actions leading from one state to another
The goal test applied to the current state to test if the agent is in its goal
Sometimes there is an explicit set of possible goal states
Sometimes the goal is described by the properties instead of stating explicitly the set of
states
Example: Chess
o The agent wins if it can capture the KING of the opponent on next move ( checkmate).
o No matter what the opponent does
01/16/2025 91
CONT…
A path cost function is a function that assigns a cost to a path.
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
The solution of a problem is then a path from the initial state to a state satisfying the
goal test
Optimal solution is the solution with lowest path cost among all solutions
01/16/2025 92
CONT…
 Measuring problem-solving performance
Completeness: is the strategy guaranteed to find a solution when there is
one?
Optimality: does the strategy find the highest-quality solution when there are
several different solutions?
Time complexity: how long does it take to find a solution?
Space complexity: how much memory is needed to perform the search?
01/16/2025 93
CONT…
In AI, complexity is expressed in
b, branching factor, maximum number of successors of any node
d, the depth of the shallowest goal node.
(depth of the least-cost solution)
m, the maximum length of any path in the state space
Time and Space is measured in
number of nodes generated during the search
maximum number of nodes stored in memory
01/16/2025 94
CONT…
For effectiveness of a search algorithm
we can just consider the total cost
The total cost = path cost (g) of the solution found + search cost
search cost = time necessary to find the solution
Tradeoff:
(long time, optimal solution with least g)
vs. (shorter time, solution with slightly larger path cost g)
01/16/2025 95
4. SEARCH STRATEGIES
 Because there are many ways to achieve the same goal
Those ways are together expressed as a tree
Multiple options of unknown value at a point,
the agent can examine different possible sequences of actions, and choose
the best
This process of looking for the best sequence is called search
The best sequence is then a list of actions, called solution
01/16/2025 96
CONT…
 It is helpful to think of the search process as building up a search tree
 The root of the search tree is a search node corresponding to the initial state
 The leaf nodes of the tree correspond to states that do not have successors in the
tree,
It is either because they have not been expanded yet, or
because they were expanded, but generated the empty set
 At each step, the search algorithm chooses one leaf node to expand
01/16/2025 97
CONT…
01/16/2025 98
CONT…
 The majority of work in the area of search has gone into finding the right search strategy
for a problem
 In our study of the field we will evaluate strategies in terms of four criteria:
1. Completeness: is the strategy guaranteed to find a solution when there is one?
2. Time complexity: how long does it take to find a solution?
3. Space complexity: how much memory does it need to perform the search?
4. Optimality: does the strategy find the highest-quality solution when there are
several different solutions
01/16/2025 99
CONT…
 Uninformed search (blind search)
no information about the number of steps
or the path cost from the current state to the goal
search the state space blindly
 Informed search, or heuristic search
a cleverer strategy that searches toward the goal,
based on the information from the current state so far
01/16/2025 100
CONT…
 The six Uninformed search strategies
Breadth-first search
Uniform cost search
Depth-first search
Depth-limited search
Iterative deepening search
Bidirectional search