SlideShare a Scribd company logo
CSE 412: Artificial IntelligenceCSE 412: Artificial Intelligence
Fall 2018Fall 2018
Topic – 3: Solving ProblemsTopic – 3: Solving Problems
by Searchingby Searching
Tajim Md. Niamat Ullah Akhund
Lecturer
Department of Computer Science and Engineering
Daffodil International University
Email: tajim.cse@diu.edu.bd
Topic ContentsTopic Contents
Problem Solving AgentsProblem Solving Agents
Problem Formulation and Search SpacesProblem Formulation and Search Spaces
Example ProblemsExample Problems
Tree Search AlgorithmTree Search Algorithm
 Breadth-First SearchBreadth-First Search
 Uniform-Cost SearchUniform-Cost Search
 Depth-First SearchDepth-First Search
 Depth Limited SearchDepth Limited Search
 Iteratively Deepening SearchIteratively Deepening Search
 Bidirectional SearchBidirectional Search 2
IntroductionIntroduction
In this topic, we see how an agent can find
a sequence of actions that achieves its
goals, when no single action will do.
3
Majidur RahmanMajidur Rahman
Problem-SolvingProblem-Solving AgentAgent
Four general steps in problem solving:
• Goal formulation
– What are the successful world states
• Problem formulation
– What actions and states to consider given the goal
• Search
– Examine different possible sequences of actions that
lead to states of known value and then choose the
best sequence
• Execute
– Perform actions on the basis of the solution
4
Majidur RahmanMajidur Rahman
Example: RomaniaExample: Romania
5
Majidur RahmanMajidur Rahman
Example: RomaniaExample: Romania
On holiday the agent is in Romania visiting in
Arad. Flight leaves tomorrow from Bucharest.
• Formulate goal
– Be in Bucharest
• Formulate problem
– States: various cities
– Actions: drive between cities
• Find solution
– Sequence of cities; e.g. Arad, Sibiu, Fagaras,
Bucharest,…
6
Majidur RahmanMajidur Rahman
Problem TypeProblem Type
Given how we have defined the problem:
• Environment is fully observable
• Environment is deterministic
• Environment is sequential
• Environment is static
• Environment is discrete
• Environment is single-agent
7
Majidur RahmanMajidur Rahman
Problem FormulationProblem Formulation
A problem is defined by:
 An initial state, e.g. In(Arad)
 A successor function S(x) = set of action-state pairs
• S(In(Arad)) = {(Go(Sibiu), In(Sibiu)), (Go(Zerind), In(Zerind)),
(Go(Timisoara), In(Timisoara))}
• initial state + successor function = state space
 Goal test
• Explicit, e.g. x=‘In(Bucharest)’
 Path cost (assume additive)
• e.g. sum of distances, number of actions executed, …
A solution is a sequence of actions from initial to
goal state
 the optimal solution has the lowest path cost
8
Majidur RahmanMajidur Rahman
Vacuum WorldVacuum World
State space of the vacuum world
9
Majidur RahmanMajidur Rahman
Example ProblemsExample Problems
The problem-solving approach has been applied to
a vast array of task environments.
Some of the best known are listed here,
distinguishing between toy and real-world problems.
A toy problem is intended to illustrate or exercise
various problem-solving methods.
It is usable by different researchers to compare the
performance of algorithms.
 A real-world problem is one whose solutions
people actually care about.
We will mainly focus on toy problems in this topic.
10
Majidur RahmanMajidur Rahman
Toy Problems: 8-PuzzleToy Problems: 8-Puzzle
 States: location of each tile plus blank
 Initial state: Any state can be initial
 Actions: Move blank {Left, Right, Up, Down}
 Goal test: Check whether goal configuration is reached
 Path cost: Number of actions to reach goal
11
Majidur RahmanMajidur Rahman
Toy Problems: 8-QueensToy Problems: 8-Queens
Place eight queens on a chessboard such that
no queen attacks any other.
Two kinds of problem formulation:
• Complete-state formulation
• Incremental formulation
12
Majidur RahmanMajidur Rahman
Toy Problems: 8-QueensToy Problems: 8-Queens
Complete-state formulation
• States: Any arrangement of 0 to 8 queens on the board
• Initial state: No queens
• Actions: Add queen to any empty square
• Goal test: 8 queens on board and none attacked
• Path cost: N/A
64.63.62…..57 ≈ 3 x 1014
possible sequences to investigate
13Tajim Md. Niamat Ullah AkhundTajim Md. Niamat Ullah Akhund
Incremental formulation
• States: n (0 to 8) queens on the board, one per column in
the n leftmost columns with no queen attacking any other
• Actions: Add queen in leftmost empty column such that
the queen is not attacking any other queen
• 2057 possible sequences to investigate; solutions are
easy to find
But with 100 queens the problem is much harder
14
Toy Problems: 8-QueensToy Problems: 8-Queens
Real-World ProblemsReal-World Problems
 Route-finding problems
 Touring problems
 Traveling Salesman problem
 VLSI layout problem
 Robot navigation
 Automatic assembly sequencing
 Internet searching
15
Majidur RahmanMajidur Rahman
Basic Search AlgorithmsBasic Search Algorithms
How do we find the solutions of previous
problems?
• Search the state space
– State space can be represented by a search tree
– Root of the tree is the initial state
– Children generated through successor function
• In general we may have a search graph rather
than tree (same state can be reached through
multiple paths)
16
Majidur RahmanMajidur Rahman
Simple Tree Search ExampleSimple Tree Search Example
17
Majidur RahmanMajidur Rahman
Simple Tree Search ExampleSimple Tree Search Example
18
Majidur RahmanMajidur Rahman
Simple Tree Search ExampleSimple Tree Search Example
19
Majidur RahmanMajidur Rahman
State Space vs. Search TreeState Space vs. Search Tree
• A state corresponds
to a configuration of
the world
• A node is a data
structure in a search
tree
– e.g. node = <state,
parent-node, action,
path-cost, depth>
20
Majidur RahmanMajidur Rahman
Search StrategiesSearch Strategies
 A search strategy is defined by picking the order of node
expansion
 Problem-solving performance is measured in four ways:
• Completeness: Is a solution found if one exists?
• Optimality: Does the strategy find the optimal solution?
• Time Complexity: How long does it take to find a solution?
• Space Complexity: How much memory is needed to perform
the search?
 Time and space complexity are measured in terms of
problem difficulty defined by:
• b - branching factor of the search tree
• d - depth of the shallowest goal node
• m - maximum length of any path in the state space
21
Majidur RahmanMajidur Rahman
Uninformed Search StrategiesUninformed Search Strategies
• Uninformed search (or blind search)
– Strategies have no additional information about states beyond
that provided in the problem definition
• Informed (or heuristic) search
– Search strategies know whether one state is more promising
than another
• Uninformed strategies (defined by order in which nodes
are expanded):
– Breadth-first search
– Uniform-cost search
– Depth-first search
– Depth-limited search
– Iterative deepening search
– Bidirectional search
22
Majidur RahmanMajidur Rahman
Breadth-First SearchBreadth-First Search
• Expand shallowest unexpanded node
• Fringe is the collection of nodes that have been generated
but not yet expanded.
• The set of all leaf nodes available for expansion at any
given point is called the frontier.
• Implementation: fringe/frontier is a FIFO queue
23
Breadth-First SearchBreadth-First Search
24
Majidur RahmanMajidur Rahman
Breadth-First SearchBreadth-First Search
25
Majidur RahmanMajidur Rahman
Breadth-First SearchBreadth-First Search
26
Majidur RahmanMajidur Rahman
Breadth-First SearchBreadth-First Search
• Completeness: is a solution always found
if one exists?
– YES
• If shallowest goal node is at some finite depth d
• If branching factor b is finite
• BF search is optimal if the path cost is a
non-decreasing function of the depth of
the node
27
Majidur RahmanMajidur Rahman
Breadth-First SearchBreadth-First Search
• Time complexity: Assume a state space where
every state has b successors
– Assume solution is at depth d
– Worst case: expand all but the last node at depth d
– Total number of nodes generated:
– b + b2
+ b3
+ ...+ bd
+ (bd +1
− b) = O(bd +1
)
• Space complexity: every node generated must
remain in memory, so same as time complexity
28
Majidur RahmanMajidur Rahman
Breadth-First SearchBreadth-First Search
• Memory requirements are a bigger problem than
execution time.
29
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
• Extension of BF-search:
– Expand node with lowest path cost
• Implementation: fringe = queue ordered by
path cost
• UC-search is the same as BF-search
when all step costs are equal
30
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
 Let us consider the following search tree, where A
and G are the initial and goal node, respectively.
31
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
32
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
33
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
34
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
35
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
36
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
 Let us consider the another search tree, where A
and G are the initial and goal node, respectively.
37
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
38
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
39
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
40
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
41
Majidur RahmanMajidur Rahman
Uniform-Cost SearchUniform-Cost Search
• Completeness:
– YES, if step-cost > some small positive constant ε
• Optimality:
– nodes expanded in order of increasing path cost
– YES, if complete
• Time and space complexity:
– Uniform-cost search is guided by path costs rather than
depths, so its complexity cannot easily be characterized
in terms of b and d.
– Instead, assume C* is the cost of the optimal solution
– Assume that every action costs at least ε
– Worst-case: O(bC*/ε
)
42
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
43
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
44
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
45
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
46
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
47
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
48
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
49
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
50
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
51
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
52
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
53
Majidur RahmanMajidur Rahman
Depth-First SearchDepth-First Search
• Expand deepest unexpanded node
• Implementation: fringe is a LIFO queue (= stack)
54
Majidur RahmanMajidur Rahman
DF-Search: EvaluationDF-Search: Evaluation
• Completeness:
– Is a solution always found if one exists?
– No (unless search space is finite and no loops
are possible)
• Optimality:
– Is the least-cost solution always found?
– No
55
Majidur RahmanMajidur Rahman
DF-Search: EvaluationDF-Search: Evaluation
• Time complexity: O(bm
)
• In general, time is terrible if m (maximal
depth) is much larger than d (depth of
shallowest solution)
– But if there exist many solutions then faster
than BF-search
• Space complexity: O(bm)
– Backtracking search uses even less memory
(one successor instead of all b)
56
Majidur RahmanMajidur Rahman
Depth-Limited SearchDepth-Limited Search
• DF-search with depth limit l
– i.e. nodes at depth l have no successors
– Problem knowledge can be used
• Solves the infinite-path problem
• If l < d then incompleteness results
• Time complexity: O(bl
)
• Space complexity: O(bl)
57
Majidur RahmanMajidur Rahman
Depth-Limited Search withDepth-Limited Search with ll = 2= 2
58
Majidur RahmanMajidur Rahman
Depth-Limited Search withDepth-Limited Search with ll = 2= 2
59
Majidur RahmanMajidur Rahman
Depth-Limited Search withDepth-Limited Search with ll = 2= 2
60
Majidur RahmanMajidur Rahman
Depth-Limited Search withDepth-Limited Search with ll = 2= 2
61
Majidur RahmanMajidur Rahman
Iterative Deepening SearchIterative Deepening Search
• A general strategy to find best depth limit l
– Goal is found at depth d, the depth of the
shallowest goal-node
– Often used in combination with DF-search
• Combines benefits of DF- and BF-search
62
Majidur RahmanMajidur Rahman
ID-Search: ExampleID-Search: Example
63
Majidur RahmanMajidur Rahman
ID-Search: ExampleID-Search: Example
64
Majidur RahmanMajidur Rahman
ID-Search: ExampleID-Search: Example
65Majidur RahmanMajidur Rahman
ID-Search: ExampleID-Search: Example
66Majidur RahmanMajidur Rahman
Bidirectional SearchBidirectional Search
Two simultaneous searches run from start and goal.
– Motivation:
– One forward from the initial state
– Other backward from goal
– Stops when the two searches meet in the middle
• Check whether the node belongs to the other fringe before
expansion
67
bd/2
+bd/2
≠bd
Bidirectional SearchBidirectional Search
Time complexity: O(bd/2
)
Space complexity: O(bd/2
)
– This space complexity is the most significant
weakness of bidirectional search.
Completeness and Optimality: Yes
– If step costs are uniform
– If both searches are breadth-first search.
68Majidur RahmanMajidur Rahman
The reduction in time complexity makes
bidirectional search attractive, but how do we
search backwards?
The predecessor of each node should be
efficiently computable.
– When actions are easily reversible.
Bidirectional SearchBidirectional Search
Majidur RahmanMajidur Rahman
Summary of AlgorithmsSummary of Algorithms
70
Majidur RahmanMajidur Rahman
********** ********** If You Need Me ********** **********
Mail: tajim.cse@diu.edu.bd
Website: https://www.tajimiitju.blogspot.com
ORCID: https://orcid.org/0000-0002-2834-1507
LinkedIn: https://www.linkedin.com/in/tajimiitju
ResearchGate: https://www.researchgate.net/profile/Tajim_Md_Niamat_Ullah_Akhund
YouTube: https://www.youtube.com/tajimiitju?sub_confirmation=1
SlideShare: https://www.slideshare.net/TajimMdNiamatUllahAk
Facebook: https://www.facebook.com/tajim.mohammad
GitHub: https://github.com/tajimiitju
Google+: https://plus.google.com/+tajimiitju
Gmail: tajim.mohammad.3@gmail.com
Twitter: https://twitter.com/Tajim53
Thank you
Tajim Md. Niamat Ullah AkhundTajim Md. Niamat Ullah Akhund

More Related Content

What's hot (20)

PPTX
Problem solving in Artificial Intelligence.pptx
kitsenthilkumarcse
 
PPTX
Problem solving agents
Megha Sharma
 
PPT
Artificial Intelligence -- Search Algorithms
Syed Ahmed
 
PDF
Informed search
Amit Kumar Rathi
 
PDF
Problem Solving
Amar Jukuntla
 
PDF
AI 7 | Constraint Satisfaction Problem
Mohammad Imam Hossain
 
PPTX
Adversarial search
Nilu Desai
 
PDF
Hill climbing algorithm in artificial intelligence
sandeep54552
 
PPTX
Hill climbing algorithm
Dr. C.V. Suresh Babu
 
PPTX
A* Algorithm
Dr. C.V. Suresh Babu
 
PPTX
State space search
chauhankapil
 
PDF
Heuristic search-in-artificial-intelligence
grinu
 
PPTX
Water jug problem ai part 6
Kirti Verma
 
PPT
Classical Planning
ahmad bassiouny
 
PPT
AI Lecture 4 (informed search and exploration)
Tajim Md. Niamat Ullah Akhund
 
PDF
I.ITERATIVE DEEPENING DEPTH FIRST SEARCH(ID-DFS) II.INFORMED SEARCH IN ARTIFI...
vikas dhakane
 
PPTX
Uninformed search /Blind search in AI
Kirti Verma
 
PPTX
Planning
Amar Jukuntla
 
PPT
Type Checking(Compiler Design) #ShareThisIfYouLike
United International University
 
PPT
Heuristic Search Techniques {Artificial Intelligence}
FellowBuddy.com
 
Problem solving in Artificial Intelligence.pptx
kitsenthilkumarcse
 
Problem solving agents
Megha Sharma
 
Artificial Intelligence -- Search Algorithms
Syed Ahmed
 
Informed search
Amit Kumar Rathi
 
Problem Solving
Amar Jukuntla
 
AI 7 | Constraint Satisfaction Problem
Mohammad Imam Hossain
 
Adversarial search
Nilu Desai
 
Hill climbing algorithm in artificial intelligence
sandeep54552
 
Hill climbing algorithm
Dr. C.V. Suresh Babu
 
A* Algorithm
Dr. C.V. Suresh Babu
 
State space search
chauhankapil
 
Heuristic search-in-artificial-intelligence
grinu
 
Water jug problem ai part 6
Kirti Verma
 
Classical Planning
ahmad bassiouny
 
AI Lecture 4 (informed search and exploration)
Tajim Md. Niamat Ullah Akhund
 
I.ITERATIVE DEEPENING DEPTH FIRST SEARCH(ID-DFS) II.INFORMED SEARCH IN ARTIFI...
vikas dhakane
 
Uninformed search /Blind search in AI
Kirti Verma
 
Planning
Amar Jukuntla
 
Type Checking(Compiler Design) #ShareThisIfYouLike
United International University
 
Heuristic Search Techniques {Artificial Intelligence}
FellowBuddy.com
 

Similar to AI Lecture 3 (solving problems by searching) (20)

PPTX
AI_03_Solving Problems by Searching.pptx
Yousef Aburawi
 
PPTX
AI UNIT 2 PPT AI UNIT 2 PPT AI UNIT 2 PPT.pptx
pank011
 
PPTX
Artificial intelligence with the help of
madhurrajverma
 
PDF
Lecture 3 problem solving
Vajira Thambawita
 
PPTX
3. ArtificialSolving problems by searching.pptx
NAZMUSSAKIBMDADIL200
 
PPTX
Chapter 3.pptx
ashetuterefa
 
PPT
state-spaces29Sep06.ppt
PerumalPitchandi
 
PPTX
CHAPTER 5.pptx of the following of our discussion
BifaHirpo1
 
PPTX
Lecture 3 Problem Solving.pptx
AndrewKuziwakwasheMu
 
PDF
problem solving in Artificial intelligence .pdf
ElectricalTech3
 
PPT
Ch4: Searching Techniques 6_2018_12_25!05_35_25_PM.ppt
Sasal6
 
PPTX
Moduleanaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad-II.pptx
Baseemkhan3
 
PDF
Chapter 3 - Searching and prPlanning.pdf
naolseyum9
 
PPTX
Jarrar: Un-informed Search
Mustafa Jarrar
 
PPT
Artificial intelligent Lec 3-ai chapter3-search
Taymoor Nazmy
 
PPTX
AI_Lec2.pptx dive in to ai hahahahahahah
inambscs4508
 
PPTX
Lec#2
Ali Shah
 
PPTX
Searching is the universal technique of problem solving in Artificial Intelli...
KarpagaPriya10
 
PPTX
chapter 3 Problem Solving using searching.pptx
gadisaAdamu
 
AI_03_Solving Problems by Searching.pptx
Yousef Aburawi
 
AI UNIT 2 PPT AI UNIT 2 PPT AI UNIT 2 PPT.pptx
pank011
 
Artificial intelligence with the help of
madhurrajverma
 
Lecture 3 problem solving
Vajira Thambawita
 
3. ArtificialSolving problems by searching.pptx
NAZMUSSAKIBMDADIL200
 
Chapter 3.pptx
ashetuterefa
 
state-spaces29Sep06.ppt
PerumalPitchandi
 
CHAPTER 5.pptx of the following of our discussion
BifaHirpo1
 
Lecture 3 Problem Solving.pptx
AndrewKuziwakwasheMu
 
problem solving in Artificial intelligence .pdf
ElectricalTech3
 
Ch4: Searching Techniques 6_2018_12_25!05_35_25_PM.ppt
Sasal6
 
Moduleanaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaad-II.pptx
Baseemkhan3
 
Chapter 3 - Searching and prPlanning.pdf
naolseyum9
 
Jarrar: Un-informed Search
Mustafa Jarrar
 
Artificial intelligent Lec 3-ai chapter3-search
Taymoor Nazmy
 
AI_Lec2.pptx dive in to ai hahahahahahah
inambscs4508
 
Lec#2
Ali Shah
 
Searching is the universal technique of problem solving in Artificial Intelli...
KarpagaPriya10
 
chapter 3 Problem Solving using searching.pptx
gadisaAdamu
 
Ad

More from Tajim Md. Niamat Ullah Akhund (20)

PPT
AI Lecture 7 (uncertainty)
Tajim Md. Niamat Ullah Akhund
 
PPT
AI Lecture 6 (logical agents)
Tajim Md. Niamat Ullah Akhund
 
PPT
AI Lecture 5 (game playing)
Tajim Md. Niamat Ullah Akhund
 
PPT
AI Lecture 2 (intelligent agents)
Tajim Md. Niamat Ullah Akhund
 
PPT
AI Lecture 1 (introduction)
Tajim Md. Niamat Ullah Akhund
 
PDF
Course outline (cse 412 - artificial intelligence)
Tajim Md. Niamat Ullah Akhund
 
PPTX
Artificial intelligence LAB 1 overview &amp; intelligent systems
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 9 – simpson 1,3 and trapezoidal method@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 8 – newton's forward and backword interpolation@taj copy
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 7 – regula falsi or false position method@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 6 – newton raphson method@taj copy
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 5 bisection method@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 4 loops@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 3 – commands, the m files, data types, bitwise op, set@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 2 matlab basic syntax &amp; variables @taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Matlab lecture 1 - installation of matlab, introduction and course outline@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Circuit lab 10 verification of norton's theorem@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Circuit lab 9 verification of maximum power transfer theorem@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Circuit lab 8 verification of thevenin's theorem@taj
Tajim Md. Niamat Ullah Akhund
 
PDF
Circuit lab 7 verification of superposition theorem@taj
Tajim Md. Niamat Ullah Akhund
 
AI Lecture 7 (uncertainty)
Tajim Md. Niamat Ullah Akhund
 
AI Lecture 6 (logical agents)
Tajim Md. Niamat Ullah Akhund
 
AI Lecture 5 (game playing)
Tajim Md. Niamat Ullah Akhund
 
AI Lecture 2 (intelligent agents)
Tajim Md. Niamat Ullah Akhund
 
AI Lecture 1 (introduction)
Tajim Md. Niamat Ullah Akhund
 
Course outline (cse 412 - artificial intelligence)
Tajim Md. Niamat Ullah Akhund
 
Artificial intelligence LAB 1 overview &amp; intelligent systems
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 9 – simpson 1,3 and trapezoidal method@taj
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 8 – newton's forward and backword interpolation@taj copy
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 7 – regula falsi or false position method@taj
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 6 – newton raphson method@taj copy
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 5 bisection method@taj
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 4 loops@taj
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 3 – commands, the m files, data types, bitwise op, set@taj
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 2 matlab basic syntax &amp; variables @taj
Tajim Md. Niamat Ullah Akhund
 
Matlab lecture 1 - installation of matlab, introduction and course outline@taj
Tajim Md. Niamat Ullah Akhund
 
Circuit lab 10 verification of norton's theorem@taj
Tajim Md. Niamat Ullah Akhund
 
Circuit lab 9 verification of maximum power transfer theorem@taj
Tajim Md. Niamat Ullah Akhund
 
Circuit lab 8 verification of thevenin's theorem@taj
Tajim Md. Niamat Ullah Akhund
 
Circuit lab 7 verification of superposition theorem@taj
Tajim Md. Niamat Ullah Akhund
 
Ad

Recently uploaded (20)

PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PPTX
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
PPT
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PPTX
Big Data and Data Science hype .pptx
SUNEEL37
 
PPT
Electrical Safety Presentation for Basics Learning
AliJaved79382
 
PPTX
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
MRRS Strength and Durability of Concrete
CivilMythili
 
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Shinkawa Proposal to meet Vibration API670.pptx
AchmadBashori2
 
Carmon_Remote Sensing GIS by Mahesh kumar
DhananjayM6
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Big Data and Data Science hype .pptx
SUNEEL37
 
Electrical Safety Presentation for Basics Learning
AliJaved79382
 
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 

AI Lecture 3 (solving problems by searching)

  • 1. CSE 412: Artificial IntelligenceCSE 412: Artificial Intelligence Fall 2018Fall 2018 Topic – 3: Solving ProblemsTopic – 3: Solving Problems by Searchingby Searching Tajim Md. Niamat Ullah Akhund Lecturer Department of Computer Science and Engineering Daffodil International University Email: [email protected]
  • 2. Topic ContentsTopic Contents Problem Solving AgentsProblem Solving Agents Problem Formulation and Search SpacesProblem Formulation and Search Spaces Example ProblemsExample Problems Tree Search AlgorithmTree Search Algorithm  Breadth-First SearchBreadth-First Search  Uniform-Cost SearchUniform-Cost Search  Depth-First SearchDepth-First Search  Depth Limited SearchDepth Limited Search  Iteratively Deepening SearchIteratively Deepening Search  Bidirectional SearchBidirectional Search 2
  • 3. IntroductionIntroduction In this topic, we see how an agent can find a sequence of actions that achieves its goals, when no single action will do. 3 Majidur RahmanMajidur Rahman
  • 4. Problem-SolvingProblem-Solving AgentAgent Four general steps in problem solving: • Goal formulation – What are the successful world states • Problem formulation – What actions and states to consider given the goal • Search – Examine different possible sequences of actions that lead to states of known value and then choose the best sequence • Execute – Perform actions on the basis of the solution 4 Majidur RahmanMajidur Rahman
  • 6. Example: RomaniaExample: Romania On holiday the agent is in Romania visiting in Arad. Flight leaves tomorrow from Bucharest. • Formulate goal – Be in Bucharest • Formulate problem – States: various cities – Actions: drive between cities • Find solution – Sequence of cities; e.g. Arad, Sibiu, Fagaras, Bucharest,… 6 Majidur RahmanMajidur Rahman
  • 7. Problem TypeProblem Type Given how we have defined the problem: • Environment is fully observable • Environment is deterministic • Environment is sequential • Environment is static • Environment is discrete • Environment is single-agent 7 Majidur RahmanMajidur Rahman
  • 8. Problem FormulationProblem Formulation A problem is defined by:  An initial state, e.g. In(Arad)  A successor function S(x) = set of action-state pairs • S(In(Arad)) = {(Go(Sibiu), In(Sibiu)), (Go(Zerind), In(Zerind)), (Go(Timisoara), In(Timisoara))} • initial state + successor function = state space  Goal test • Explicit, e.g. x=‘In(Bucharest)’  Path cost (assume additive) • e.g. sum of distances, number of actions executed, … A solution is a sequence of actions from initial to goal state  the optimal solution has the lowest path cost 8 Majidur RahmanMajidur Rahman
  • 9. Vacuum WorldVacuum World State space of the vacuum world 9 Majidur RahmanMajidur Rahman
  • 10. Example ProblemsExample Problems The problem-solving approach has been applied to a vast array of task environments. Some of the best known are listed here, distinguishing between toy and real-world problems. A toy problem is intended to illustrate or exercise various problem-solving methods. It is usable by different researchers to compare the performance of algorithms.  A real-world problem is one whose solutions people actually care about. We will mainly focus on toy problems in this topic. 10 Majidur RahmanMajidur Rahman
  • 11. Toy Problems: 8-PuzzleToy Problems: 8-Puzzle  States: location of each tile plus blank  Initial state: Any state can be initial  Actions: Move blank {Left, Right, Up, Down}  Goal test: Check whether goal configuration is reached  Path cost: Number of actions to reach goal 11 Majidur RahmanMajidur Rahman
  • 12. Toy Problems: 8-QueensToy Problems: 8-Queens Place eight queens on a chessboard such that no queen attacks any other. Two kinds of problem formulation: • Complete-state formulation • Incremental formulation 12 Majidur RahmanMajidur Rahman
  • 13. Toy Problems: 8-QueensToy Problems: 8-Queens Complete-state formulation • States: Any arrangement of 0 to 8 queens on the board • Initial state: No queens • Actions: Add queen to any empty square • Goal test: 8 queens on board and none attacked • Path cost: N/A 64.63.62…..57 ≈ 3 x 1014 possible sequences to investigate 13Tajim Md. Niamat Ullah AkhundTajim Md. Niamat Ullah Akhund
  • 14. Incremental formulation • States: n (0 to 8) queens on the board, one per column in the n leftmost columns with no queen attacking any other • Actions: Add queen in leftmost empty column such that the queen is not attacking any other queen • 2057 possible sequences to investigate; solutions are easy to find But with 100 queens the problem is much harder 14 Toy Problems: 8-QueensToy Problems: 8-Queens
  • 15. Real-World ProblemsReal-World Problems  Route-finding problems  Touring problems  Traveling Salesman problem  VLSI layout problem  Robot navigation  Automatic assembly sequencing  Internet searching 15 Majidur RahmanMajidur Rahman
  • 16. Basic Search AlgorithmsBasic Search Algorithms How do we find the solutions of previous problems? • Search the state space – State space can be represented by a search tree – Root of the tree is the initial state – Children generated through successor function • In general we may have a search graph rather than tree (same state can be reached through multiple paths) 16 Majidur RahmanMajidur Rahman
  • 17. Simple Tree Search ExampleSimple Tree Search Example 17 Majidur RahmanMajidur Rahman
  • 18. Simple Tree Search ExampleSimple Tree Search Example 18 Majidur RahmanMajidur Rahman
  • 19. Simple Tree Search ExampleSimple Tree Search Example 19 Majidur RahmanMajidur Rahman
  • 20. State Space vs. Search TreeState Space vs. Search Tree • A state corresponds to a configuration of the world • A node is a data structure in a search tree – e.g. node = <state, parent-node, action, path-cost, depth> 20 Majidur RahmanMajidur Rahman
  • 21. Search StrategiesSearch Strategies  A search strategy is defined by picking the order of node expansion  Problem-solving performance is measured in four ways: • Completeness: Is a solution found if one exists? • Optimality: Does the strategy find the optimal solution? • Time Complexity: How long does it take to find a solution? • Space Complexity: How much memory is needed to perform the search?  Time and space complexity are measured in terms of problem difficulty defined by: • b - branching factor of the search tree • d - depth of the shallowest goal node • m - maximum length of any path in the state space 21 Majidur RahmanMajidur Rahman
  • 22. Uninformed Search StrategiesUninformed Search Strategies • Uninformed search (or blind search) – Strategies have no additional information about states beyond that provided in the problem definition • Informed (or heuristic) search – Search strategies know whether one state is more promising than another • Uninformed strategies (defined by order in which nodes are expanded): – Breadth-first search – Uniform-cost search – Depth-first search – Depth-limited search – Iterative deepening search – Bidirectional search 22 Majidur RahmanMajidur Rahman
  • 23. Breadth-First SearchBreadth-First Search • Expand shallowest unexpanded node • Fringe is the collection of nodes that have been generated but not yet expanded. • The set of all leaf nodes available for expansion at any given point is called the frontier. • Implementation: fringe/frontier is a FIFO queue 23
  • 27. Breadth-First SearchBreadth-First Search • Completeness: is a solution always found if one exists? – YES • If shallowest goal node is at some finite depth d • If branching factor b is finite • BF search is optimal if the path cost is a non-decreasing function of the depth of the node 27 Majidur RahmanMajidur Rahman
  • 28. Breadth-First SearchBreadth-First Search • Time complexity: Assume a state space where every state has b successors – Assume solution is at depth d – Worst case: expand all but the last node at depth d – Total number of nodes generated: – b + b2 + b3 + ...+ bd + (bd +1 − b) = O(bd +1 ) • Space complexity: every node generated must remain in memory, so same as time complexity 28 Majidur RahmanMajidur Rahman
  • 29. Breadth-First SearchBreadth-First Search • Memory requirements are a bigger problem than execution time. 29 Majidur RahmanMajidur Rahman
  • 30. Uniform-Cost SearchUniform-Cost Search • Extension of BF-search: – Expand node with lowest path cost • Implementation: fringe = queue ordered by path cost • UC-search is the same as BF-search when all step costs are equal 30 Majidur RahmanMajidur Rahman
  • 31. Uniform-Cost SearchUniform-Cost Search  Let us consider the following search tree, where A and G are the initial and goal node, respectively. 31 Majidur RahmanMajidur Rahman
  • 37. Uniform-Cost SearchUniform-Cost Search  Let us consider the another search tree, where A and G are the initial and goal node, respectively. 37 Majidur RahmanMajidur Rahman
  • 42. Uniform-Cost SearchUniform-Cost Search • Completeness: – YES, if step-cost > some small positive constant ε • Optimality: – nodes expanded in order of increasing path cost – YES, if complete • Time and space complexity: – Uniform-cost search is guided by path costs rather than depths, so its complexity cannot easily be characterized in terms of b and d. – Instead, assume C* is the cost of the optimal solution – Assume that every action costs at least ε – Worst-case: O(bC*/ε ) 42 Majidur RahmanMajidur Rahman
  • 43. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 43 Majidur RahmanMajidur Rahman
  • 44. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 44 Majidur RahmanMajidur Rahman
  • 45. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 45 Majidur RahmanMajidur Rahman
  • 46. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 46 Majidur RahmanMajidur Rahman
  • 47. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 47 Majidur RahmanMajidur Rahman
  • 48. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 48 Majidur RahmanMajidur Rahman
  • 49. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 49 Majidur RahmanMajidur Rahman
  • 50. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 50 Majidur RahmanMajidur Rahman
  • 51. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 51 Majidur RahmanMajidur Rahman
  • 52. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 52 Majidur RahmanMajidur Rahman
  • 53. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 53 Majidur RahmanMajidur Rahman
  • 54. Depth-First SearchDepth-First Search • Expand deepest unexpanded node • Implementation: fringe is a LIFO queue (= stack) 54 Majidur RahmanMajidur Rahman
  • 55. DF-Search: EvaluationDF-Search: Evaluation • Completeness: – Is a solution always found if one exists? – No (unless search space is finite and no loops are possible) • Optimality: – Is the least-cost solution always found? – No 55 Majidur RahmanMajidur Rahman
  • 56. DF-Search: EvaluationDF-Search: Evaluation • Time complexity: O(bm ) • In general, time is terrible if m (maximal depth) is much larger than d (depth of shallowest solution) – But if there exist many solutions then faster than BF-search • Space complexity: O(bm) – Backtracking search uses even less memory (one successor instead of all b) 56 Majidur RahmanMajidur Rahman
  • 57. Depth-Limited SearchDepth-Limited Search • DF-search with depth limit l – i.e. nodes at depth l have no successors – Problem knowledge can be used • Solves the infinite-path problem • If l < d then incompleteness results • Time complexity: O(bl ) • Space complexity: O(bl) 57 Majidur RahmanMajidur Rahman
  • 58. Depth-Limited Search withDepth-Limited Search with ll = 2= 2 58 Majidur RahmanMajidur Rahman
  • 59. Depth-Limited Search withDepth-Limited Search with ll = 2= 2 59 Majidur RahmanMajidur Rahman
  • 60. Depth-Limited Search withDepth-Limited Search with ll = 2= 2 60 Majidur RahmanMajidur Rahman
  • 61. Depth-Limited Search withDepth-Limited Search with ll = 2= 2 61 Majidur RahmanMajidur Rahman
  • 62. Iterative Deepening SearchIterative Deepening Search • A general strategy to find best depth limit l – Goal is found at depth d, the depth of the shallowest goal-node – Often used in combination with DF-search • Combines benefits of DF- and BF-search 62 Majidur RahmanMajidur Rahman
  • 67. Bidirectional SearchBidirectional Search Two simultaneous searches run from start and goal. – Motivation: – One forward from the initial state – Other backward from goal – Stops when the two searches meet in the middle • Check whether the node belongs to the other fringe before expansion 67 bd/2 +bd/2 ≠bd
  • 68. Bidirectional SearchBidirectional Search Time complexity: O(bd/2 ) Space complexity: O(bd/2 ) – This space complexity is the most significant weakness of bidirectional search. Completeness and Optimality: Yes – If step costs are uniform – If both searches are breadth-first search. 68Majidur RahmanMajidur Rahman
  • 69. The reduction in time complexity makes bidirectional search attractive, but how do we search backwards? The predecessor of each node should be efficiently computable. – When actions are easily reversible. Bidirectional SearchBidirectional Search Majidur RahmanMajidur Rahman
  • 70. Summary of AlgorithmsSummary of Algorithms 70 Majidur RahmanMajidur Rahman
  • 71. ********** ********** If You Need Me ********** ********** Mail: [email protected] Website: https://www.tajimiitju.blogspot.com ORCID: https://orcid.org/0000-0002-2834-1507 LinkedIn: https://www.linkedin.com/in/tajimiitju ResearchGate: https://www.researchgate.net/profile/Tajim_Md_Niamat_Ullah_Akhund YouTube: https://www.youtube.com/tajimiitju?sub_confirmation=1 SlideShare: https://www.slideshare.net/TajimMdNiamatUllahAk Facebook: https://www.facebook.com/tajim.mohammad GitHub: https://github.com/tajimiitju Google+: https://plus.google.com/+tajimiitju Gmail: [email protected] Twitter: https://twitter.com/Tajim53 Thank you Tajim Md. Niamat Ullah AkhundTajim Md. Niamat Ullah Akhund