Download as pdf or txt
Download as pdf or txt
You are on page 1of 197

Artificial Intelligence

By
Ahmad DIN
Why AI?
• Algorithms
• an algorithm is a finite sequence of well-defined, computer-implementable
instructions, typically to solve a class of problems or to perform a
computation. Algorithms are always unambiguous and are used as
specifications for performing calculations, data processing, automated
reasoning, and other tasks.
Big Picture
• “We are survival machines – robot vehicles blindly programmed to preserve
the selfish molecules known as genes. This is a truth which still fills me with
astonishment.” ― Richard Dawkins, The Selfish Gene

http://www.freevectors.net/human http://www.bbc.com/earth/story/20150929-why-are-we-the-only-human-species-still-alive
Sensing

What is the basic purpose of animal sensory system?


What is the basic purpose of animal sensory
system?
What is the basic purpose of animal sensory
system?

• Survival
• Uncertainties
Why don’t animals have wheels?
Reference Books
□R. Siegwart, I. Nourbakhsh and David Scaramuzza. Introduction to
Autonomous Mobile Robots. MIT Press. 2004.
□ R. Murphy. Introduction to AI Robotics. MIT Press. 2000.
□ S. Thrun, W. Burgard and D. Fox. Probabilistic Robotics. MIT Press.
2005.
□B. Siciliano and O. Khatib. Handbook of Robotics. Springer. 2008.
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?
The Rise of Humans
• Only 1M humans 10K years back
• Today, 7B humans in the world
• Our weight 300M tons
• Weight of domesticated animals is 700M tons
• Weight of wild animals less than 100 M tons
• Survival of these all animals depends on us.
The Rise of Humans
• 70K years back humans were insignificant animals
• Today, Humans control this planet
• How humans come from there to here?
• How humans turned from insignificant apes to the rulers of the
earth?
• On the individual level humans are similar to the chimpanzee.
• Real difference between humans and other animals is on the
collective level.
The Rise of Humans
• Huge achievements of humans are due to the ability
to cooperate and coordinate.
• How humans do it?
• Imagination (we cooperate with countless number of strangers)
• Animals communicate objective reality
• But, human constructed fictional reality on top of this
objective reality
• Reality made of fictional entities likes nations, gods,
cooperates, money etc.
• Realities likes tress, animals depends on decisions of these
fictional realties.
What is Intelligence?

Plan and Reason


What is Intelligence?

Problem
solving
What is Intelligence?

Problem
solving
What is Intelligence?

Neanderthals
What is Intelligence?
What is Intelligence?
What is Intelligence?
What is Intelligence?

think abstractly
What is Intelligence?

Language
What is Intelligence?

ideas
What is Intelligence?
What is Intelligence?
What is Intelligence?
□Intelligence is a general mental capability that
involves the ability to reason, plan, solve
problems, think abstractly, comprehend ideas
and language, and learn.
What is Intelligence?
“Everybody is a genius. But if you judge a fish by its ability to climb a
tree, it will live its whole life believing that it is stupid.”
• Anonymous
What is AI?
What is AI?
The science of making machines that:

act intelligently

“…making machines that will be


proud of us.”
– Thinking Machines, Inc. company slogan
Will AI Surpass Human Intelligence?
Why Robot Need AI
Intelligence is a general mental capability that involves
the ability to reason, plan, solve problems, think
abstractly, comprehend ideas and language, and learn.
What Are Robots?
□Physically situated agent
□Physically situated intelligent agent
□Intelligent agent is a system that perceives its environment and takes
actions which maximize its chances of success. (Russell & Norvig)
Week #2 : Introduction – Intelligent
Agent & Environments
Outline
• Agents and Environments

• Rationality

• PEAS (Performance Measure, Environment,


Actuators, Sensors)

• Environment Types

• Agent types
Intelligent Agents: Introduction
• Computers do as they are designed to do.
• Traditionally: we are happy to consider computers as obedient and
unimaginative servants.
• Recently: computers represent system which exhibit decision
making in a rapidly changing, unpredictable, or open environment,
through
– Intelligent or autonomous agents
• Examples
– Space probes in NASA
– Searching on the Internet
Agents
• An agent is anything that can be viewed as perceiving
its environment through sensors and acting upon that
environment through actuators
• Human agent:
– Eyes, ears, and other organs for sensors
– Hands, legs, mouth, and other body parts for
actuators
• Robotic agent:
– Cameras and infrared range finders for sensors
– Various motors for actuators.
Intelligent Agents: What are Agents
• An agent is a computer system
that is situated in some influence
environment, and that is capable
of autonomous action in this being influenced

environment in order to meet its


design objectives.
– Autonomy: agents are able to act Non-deterministic (same decision
may have different outputs)
without the intervention of
humans or other systems: they
have control both over their own
internal state, and over their
behavior.
Intelligent Agents: What are Agents

• An agent is an entity which is:


– Situated in some environment.
– Autonomous, in the sense that it can act without direct intervention from humans or other
software processes, and controls over its own actions and internal state.
– Flexible which means:
• Responsive (reactive): agents should perceive their environment and respond to changes that
occur in it;
• Proactive: agents should not simply act in response to their environment, they should be able
to exhibit opportunistic, goal-directed behavior and take the initiative when appropriate;
• Social: agents should be able to interact with humans or other artificial agents
Intelligent Agents: What are Agents
• "An agent is anything that can be viewed as perceiving its environment
through sensors and acting upon that environment through effectors."

Russell & Norvig


Agents, what are these?

Intelligent devices
Robots
Heating systems
Mobile phones

Intelligent software
Searchbots
Expert systems
Help functions ...
Agents and Environments
• The agent function maps from percept histories to
actions:
[f: P* → A]
• The agent program runs on the physical architecture
to produce f
– Agent = architecture + program
Vacuum-cleaner World
• Percepts: location and contents, e.g., [A,Dirty]
• Actions: Left, Right, Pick_Dirt, NoOp
A vacuum-cleaner function
Percept Sequence Action
[A, Clean] Right
[A, Dirty] Pick_Dirt
[B, Clean] Left
[B, Dirty] Pick_Dirt
[A, Clean], [A, Clean] Right
[A, Clean], [A, Dirty] Pick_Dirt

Agents & Environments
• In complex environments:
– An agent do not have complete control over its environment, it just
have partial control
– Partial control means that an agent can influence the environment
with its actions
– An action performed by an agent may fail to have the desired effect.
• Conclusion: environments are non-
deterministic, and agents must be prepared
for the possibility of failure.
Agent Characterisation
An agent is responsible for satisfying specific goals. There can be
different types of goals such as achieving a specific status, keeping
certain status, maximising a given function (e.g., utility), etc.

beliefs
knowledge
Goal1
Goal2

The state of an agent includes state of its internal environment +


state of knowledge and beliefs about its external environment.
Situatedness
• An agent is situated in an environment, that consists of the objects
and other agents it is possible to interact with.

environment

• An agent has an identity that distinguishes it from the other agents


of its environment.
Abstract Architecture for Agents
• Assume the environment may be in any of a finite set E of
discrete, instantaneous states:

• Agents are assumed to have a repertoire of possible actions


available to them, which transform the state of the
environment:

• A run, r, of an agent in an environment is a sequence of


interleaved environment states and actions:

15
History
• History represents the interaction between an
agent and its environment. A history is a
sequence:
α0 α1 α2 αu-1 αu
h:e0 e1 e2 … eu

Where:
e0 is the initial state of the environment
αu is the u’th action that the agent choose to
perform
eu is the u’th environment state
Abstract Architecture for Agents
• Let:
– R be the set of all such possible finite sequences
(over E and Ac)
– RAc be the subset of these that end with an
action
– RE be the subset of these that end with an
environment state

17
State Transformer Functions
• A state transformer function represents behavior of the
environment:

• Note that environments are…


– history dependent
– non-deterministic
• If (r)=, then there are no possible successor states to r.
In this case, we say that the system has ended its run
• Formally, we say an environment Env is a triple Env
=E,e0, where: E is a set of environment states, e0 E is
the initial state, and  is a state transformer function

18
Agents
• Agent is a function which maps runs to actions:

An agent makes a decision about what action to perform based


on the history of the system that it has witnessed to date. Let
AG be the set of all agents

19
Systems
• A system is a pair containing an agent and an environment
• Any system will have associated with it a set of possible runs;
we denote the set of runs of agent Ag in environment Env by
R(Ag, Env)
• (We assume R(Ag, Env) contains only terminated runs)

20
Systems
• Formally, a sequence

represents a run of an agent Ag in environment Env =E,e0,


if:
1. e0 is the initial state of Env
2. 0 = Ag(e0); and
3. For u > 0,

21
Purely Reactive Agents
• Some agents decide what to do without reference to their
history — they base their decision making entirely on the
present, with no reference at all to the past
• We call such agents purely reactive:

• A thermostat is a purely reactive agent

22
Purely reactive agents
• A purely reactive agent decides what to do
without reference to its history (no references to
the past).
• It can be represented by a function
action: E → A
• Example: thermostat
Environment states: temperature OK; too cold

heater off if e = temperature OK


action(e) =
heater on otherwise
Perception
• Now introduce perception system:

see action
Agent

Environment

24
Perception
• The see function is the agent’s ability to
observe its environment, whereas the action
function represents the agent’s decision
making process
• Output of the see function is a percept:
see : E → Per
which maps environment states to percepts, and
action is now a function
action : Per* → A
which maps sequences of percepts to actions
25
Perception ability

• Example:
x = “The room temperature is OK”
y = “There is no war at this moment”
then:
E={ (x,y), (x,y), (x,y), (x,  y)}
e1 e2 e3 e4
but for the thermostat:
p1 if s=e1 or s=e2
see(s) =
p2 if s=e3 or s=e4
Agents with State
• We now consider agents that maintain state:

Agent

see action

next state

Environment

27
Agents with State
• These agents have some internal data structure, which is typically
used to record information about the environment state and
history.
Let I be the set of all internal states of the agent.
• The perception function see for a state-based agent is unchanged:
see : E → Per
The action-selection function action is now defined as a mapping
action : I → Ac
from internal states to actions. An additional function next is
introduced, which maps an internal state and percept to an
internal state:
next : I  Per → I

28
Agent Control Loop
1. Agent starts in some initial internal state i0
2. Observes its environment state e, and generates a percept
see(e)
3. Internal state of the agent is then updated via next function,
becoming next(i0, see(e))
4. The action selected by the agent is action(next(i0, see(e)))
5. Goto 2

29
Tasks for Agents
• We build agents in order to carry out tasks
for us
• The task must be specified by us…
• But we want to tell agents what to do
without telling them how to do it

30
Utility Functions over States
• One possibility: associate utilities with
individual states — the task of the agent is
then to bring about states that maximize
utility
• A task specification is a function
u:E→
which associates a real number with every
environment state

31
Utility Functions over States
• But what is the value of a run…
– minimum utility of state on run?
– maximum utility of state on run?
– sum of utilities of states on run?
– average?
• Disadvantage: difficult to specify a long term
view when assigning utilities to individual
states
(One possibility: a discount for states later on.)

32
Utilities over Runs
• Another possibility: assigns a utility not to
individual states, but to runs themselves:
u:R→
• Such an approach takes an inherently long
term view
• Other variations: incorporate probabilities of
different states emerging
• Difficulties with utility-based approaches:
– where do the numbers come from?
– we don’t think in terms of utilities!
– hard to formulate tasks in these terms
33
Predicate Task Specifications
• A special case of assigning utilities to histories is
to assign 0 (false) or 1 (true) to a run
• If a run is assigned 1, then the agent succeeds
on that run, otherwise it fails
• Call these predicate task specifications
• Denote predicate task specification by .
Thus  : R → {0, 1}.

34
Task Environments
• A task environment is a pair Env,  where
Env is an environment,
 : R → {0, 1}
is a predicate over runs.
Let TE be the set of all task environments.
• A task environment specifies:
– the properties of the system the agent will
inhabit
– the criteria by which an agent will be judged to
have either failed or succeeded

35
Achievement & Maintenance Tasks
• Two most common types of tasks are
achievement tasks and maintenance
tasks:
1. Achievement tasks are those of the form
“achieve state of affairs ”
2. Maintenance tasks are those of the form
“maintain state of affairs ”

36
Achievement & Maintenance Tasks
• An achievement task is specified by a set G of “good” or
“goal” states: G  E
The agent succeeds if it is guaranteed to bring about at
least one of these states (we do not care which one —
they are all considered equally good).
• A maintenance goal is specified by a set B of “bad”
states: B  E
The agent succeeds in a particular environment if it
manages to avoid all states in B — if it never performs
actions which result in any state in B occurring

37
Rationality – Performance Measure
• An agent should strive to "do the right thing", based on
what it can perceive and the actions it can perform

• The right action is the one that will cause the agent to
be most successful

• Performance measure: An objective criterion for success


of an agent's behavior
– 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.
Rational Agent - Role
• Rational Agent: For each possible percept
sequence, a rational agent should select an action
that is expected to maximize its performance
measure, given the evidence provided by the
percept sequence and whatever built-in
knowledge the agent has

• We can also use the term “optimizing the


performance measure”.
Rational Agent – 3 Traits
• Rationality is distinct from omniscience (all-
knowing with infinite knowledge)
– The Agent doesn’t know the actual outcome of its
actions

• Agents can perform actions in order to modify


future percepts so as to obtain useful information
(information gathering, exploration)

• An agent is autonomous if its behavior is


determined by its own experience (with ability to
learn and adapt).
PEAS
• PEAS: Performance measure, Environment, Actuators,
Sensors
• Must first specify the setting for intelligent agent design
• Consider, e.g., the task of designing an automated taxi
driver:
– Performance measure: Safe, fast, legal, comfortable trip,
maximize profits
– Environment: Roads, other traffic, pedestrians,
customers
– Actuators: Steering wheel, accelerator, brake, signal,
horn
– Sensors: Cameras, sonar, speedometer, GPS, odometer,
engine sensors, keyboard.
PEAS
• Agent: Medical Diagnosis System
– Performance measure: Healthy patient, minimize
costs, lawsuits
– Environment: Patient, hospital, staff
– Actuators: Screen display (questions, tests,
diagnoses, treatments, referrals)
– Sensors: Keyboard (entry of symptoms, findings,
patient's answers).
PEAS
• Agent: Part-picking robot
– Performance measure: Percentage of parts in correct bins
– Environment: Conveyor belt with parts, bins
– Actuators: Jointed arm and hand
– Sensors: Camera, joint angle sensors.
PEAS
• Agent: Interactive English tutor
– Performance measure: Maximize student's score
on test
– Environment: Set of students
– Actuators: Screen display (exercises, suggestions,
corrections)
– Sensors: Keyboard.
Environment Types
• Fully Observable (vs. Partially Observable): An
agent's sensors give it access to the complete
state of the environment at each point in time

• In FO, the agent can be confident that it requires


nothing more in order to decide on the optimal
action

• PO can be due to faulty sensors


– If we are driving along a stretch of road that we know
well, and if dust enters our eyes, we are still able to
drive on the route with blinking eyes (partial
observation)
– PO requires the agent to have an internal
representation of the state.
Environment Types
• Deterministic (vs. Stochastic): The next state of
the environment is completely determined by the
current state and the action executed by the
agent
– Stochastic (Non-Deterministic): There can be more
than one next state, for a given state-action
combination
• Consider a Multi-agent environment
– If the environment is deterministic except for the
actions of other agents, then the environment is
strategic
– Strategy Games.

46
Environment Types
• Episodic (vs. sequential): The agent's
experience is divided into atomic "episodes”
– Each episode consists of the agent perceiving and
then performing a single action, and the choice of
action in each episode depends only on the
episode itself, e.g., a robot whose job is to detect
faulty parts on a line in some factory
– In a sequential setting, the next episode depends
on the previous one(s), e.g., learning which chess
move to execute at each sequential step, in order
to win the game at the end
– Also called a sequential decision process.

47
Environment Types
• Static (vs. Dynamic): The environment is unchanged
while an agent is deliberating which action to execute
– Much more simpler to deal with
– For the dynamic case, the agent needs to keep track
of the changes
– The environment is semi-dynamic if the environment
itself does not change with the passage of time but
the agent's performance score does, e.g., checkers.

• Discrete (vs. Continuous): A limited number of distinct,


clearly defined percepts and actions.
Environment Types
• Single Agent (vs. Multi-Agent): An agent
operating by itself in an environment
– In the multi-agent case, the performance measure
of one agent depends on the performance
measures of the other agent(s)
– Competitive multi-agent: Chess Playing
– Collaborative multi-agent: Robo Soccer.
– A quite complicated field which is currently the
focus of much research.

49
Environment Types
Chess with Chess without Taxi driving
a clock a clock
Fully observable Yes Yes No
Deterministic Strategic Strategic No
Episodic No No No
Static Semi Yes No
Discrete Yes Yes No
Single agent No No No

• The environment type largely determines the agent


design

• The real world is (of course) partially observable,


stochastic, sequential, dynamic, continuous, multi-
agent.
Agent Functions and Programs
• An agent is completely specified by the agent
function that maps percept sequences to
actions
– Can also be labeled as the strategy of the agent
• There could be many possible agent functions
• Aim: Discover the most rational (optimal)
agent function.
Table-lookup Agent
• Simplest possible agent function:
– All possible states and their optimal actions
specified by the designers in advance
• Drawbacks:
– Huge table (consider continuous states)
– Could take a long time to build the table
– No autonomy!
– Even with learning, agent could need a long time
to learn the table entries.
Agent types
• Four basic types in order of increasing generality:
– Simple Reflex agents
– Model-based Reflex agents
– Goal-based agents
– Utility-based agents

• And Finally: Learning agents


Simple Reflex Agents

Applies condition-
action rules based
only on the current
input (reflex)
Simple Reflex Agents

55
Simple Reflex Agents

56
Simple Reflex agents
• Automated Taxi:
– Agent observes rain falling on the windshield:
Agent powers on the viper
– Agent observes a red signal; Agent breaks the taxi
until it stops.
Model-based Reflex agents

Handles Partial Observability


by creating a model
Model-based Reflex agents

59
Model-based Reflex agents
• Robo-Soccer Example:
– Imagine a robotic goalkeeper
– It can build a model of the dynamics of the game that
is played on the field, e.g., when the ball is kicked in
its direction, the ball will be nearer to it in the next
time step
– If this robot is not able to acquire its state at some
time step, then using the model, it knows that the ball
has come nearer
– It also know what consequences a dive will have
– So, it can time its dive early and hence, save the goal.
Goal-based agents

Along with the model, you need


goals to direct the agent
function.
Goal-based Agents
• Automated Taxi:
– Consider the agent at a crossing, where it can turn
right, left, or go straight
– Using the model, the Agent can understand the
consequences of turning left, right or going
straight ahead
– All 3 might seem the optimal actions to take
– However, the agent needs to select one of these
actions in order to reach the destination of the
passenger.
62
Utility-based agents

Solves the problem of


conflicting goals, and
quantifies the acquirement
of goal
Utility-based Agent
• Automated Taxi:
– Consider the agent at a crossing, where it can turn
right, left, or go straight
– The agent will calculate the utility of each such
action
– It will select the action which maximizes the utility
function, i.e., in most cases, the expected profit
that the agent can expect to receive in the long
run (when the passenger reaches the destination)
– E.g., going straight could have highest utility.
64
Learning Agents

Feedback
Agent
Agent Function
Program

Random
Action
Selector
The End
Artificial Intelligence
Search Agents
Informed search
Informed search

Use domain knowledge!

• Are we getting close to the goal?

• Use a heuristic function that estimates how close a state is to


the goal

• A heuristic does NOT have to be perfect!


Informed search

Use domain knowledge!

• Are we getting close to the goal?

• Use a heuristic function that estimates how close a state is to


the goal

• A heuristic does NOT have to be perfect!

• Example of strategies:

1. Greedy best-first search

2. A* search

3. IDA*
Informed search

Heuristic!

The distance is the straight line distance. The goal is to get to Sault Ste Marie,
so all the distances are from each city to Sault Ste Marie.
Greedy search

• Evaluation function h(n) (heuristic)

• h(n) estimates the cost from n to the closest goal

• Example: hSLD(n) = straight-line distance from n to Sault Ste


Marie

• Greedy search expands the node that appears to be closest to


goal
Greedy search
Greedy search example
The initial state:
Greedy search example
After expanding St Louis:
Greedy search example
After expanding Chicago:
Greedy search example
After expanding Duluth:
Examples using the map
Start: Saint Louis
Goal: Sault Ste Marie

Greedy search
Examples using the map
Start: Las Vegas
Goal: Calgary

Greedy search
A* search

• Minimize the total estimated solution cost

• Combines:
– g(n): cost to reach node n
– h(n): cost to get from n to the goal
– f (n) = g(n) + h(n)

f (n) is the estimated cost of the cheapest


solution through n
A* search
A* search example
The initial state:
A* search example
After expanding St Louis:
A* search example
After expanding Chicago:
A* search example
After expanding Kansas City:
A* search example
After expanding Little Rock:
A* search example
After expanding Nashville:
A* search example
After expanding Pittsburgh:
A* search example
After expanding Toronto:
Examples using the map
Start: Saint Louis
Goal: Sault Ste Marie

A*
Examples using the map
Start: Las Vegas
Goal: Calgary

A*
Admissible heuristics

A good heuristic can be powerful.

Only if it is of a “good quality”


Admissible heuristics

A good heuristic can be powerful.

Only if it is of a “good quality”

A good heuristic must be admissible.


Admissible heuristics

• An admissible heuristic never overestimates the cost to reach


the goal, that is it is optimistic

• A heuristic h is admissible if

8 node n, h(n)  h⇤(n)


where h⇤ is true cost to reach the goal from n.

• hSLD (used as a heuristic in the map example) is admissible


because it is by definition the shortest distance between two
points.
A* Optimality
If h(n) is admissible, A* using tree search is optimal.
A* Optimality
If h(n) is admissible, A* using tree search is optimal.
Rationale:
• Suppose Go is the optimal goal.
• Suppose Gs is some suboptimal goal.
• Suppose n is an unexpanded node in the fringe such that n is
on the shortest path to Go.
• f (Gs) = g(Gs) since h(Gs) = 0
f (Go) = g(Go) since h(Go) = 0
f (Gs) > g(Go) since Gs is suboptimal
Then f (Gs) > f (Go) . . . (1)
• h(n)  h⇤(n) since h is admissible
g(n) + h(n)  g(n) + h⇤(n) = g(Go) = f (Go)
Then, f (n)  f (Go) . . . (2)
From (1) and (2) f (Gs) > f (n)
so A* will never select Gs during the search and hence A* is
optimal.
A* search criteria

• Complete: Yes

• Time: exponential

• Space: keeps every node in memory, the biggest problem

• Optimal: Yes!
Heuristics

• The solution is 26 steps long.


• h1(n) = number of misplaced tiles
• h2(n) =total Manhattan distance (sum of the horizontal and
vertical distances).
• h1(n) = 8
• Tiles 1 to 8 in the start state gives: h2 = 3 + 1 + 2 + 2 + 2 +
3 + 3 + 2 = 18 which does not overestimate the true solution.
Search Algorithms: Recap

• Uninformed Search: Use no domain knowledge.

BFS, DFS, DLS, IDS, UCS.

• Informed Search: Use a heuristic function that estimates how


close a state is to the goal.

Greedy search, A*, IDA*.


DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

Searches branch by branch ...


... with each branch pursued to maximum depth.
DFS

The frontier consists of unexplored siblings of all ancestors.


Search proceeds by exhausting one branch at a time.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Searches subtree by subtree ...


... with each subtree increasing by depth limit.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
IDS

Each iteration is simply an instance of depth-limited search.


Search proceeds by exhausting larger and larger subtrees.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

Searches layer by layer ...


... with each layer organized by node depth.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
BFS

The frontier consists of nodes of similar depth (horizontal).


Search proceeds by exhausting one layer at a time.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

Searches layer by layer ...


... with each layer organized by path cost.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
UCS

The frontier consists of nodes of various depths (jagged).


Search proceeds by expanding the lowest-cost nodes.
Recap
We can organize the algorithms into pairs where the first proceeds
by layers, and the other proceeds by subtrees.

(1) Iterate on Node Depth:

• BFS searches layers of increasing node depth.

• IDS searches subtrees of increasing node depth.


Recap
We can organize the algorithms into pairs where the first proceeds
by layers, and the other proceeds by subtrees.

(1) Iterate on Node Depth:

• BFS searches layers of increasing node depth.

• IDS searches subtrees of increasing node depth.

(2) Iterate on Path Cost + Heuristic Function:

• A* searches layers of increasing path cost + heuristic function.

• IDA* searches subtrees of increasing path cost + heuristic


function.
Recap

Which cost function?

• UCS searches layers of increasing path cost.

• Greedy best first search searches layers of increasing heuristic


function.

• A* search searches layers of increasing path cost + heuristic


function.
Credit
• Artificial Intelligence, A Modern Approach. Stuart Russell and
Peter Norvig. Third Edition. Pearson Education.

http://aima.cs.berkeley.edu/

You might also like