SlideShare a Scribd company logo
State Space Representation of
Problems
-Dr. Mehak Saini
State Space Representation in Artificial Intelligence
Concept of Search
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
Uninformed (Blind) Search
Figure: A tiny search problem. The figure on the left shows the
MoveGen function in the format Node → (List of neighbours). The
figure on the right shows the corresponding state space which is
implicit and not given upfront. The algorithm itself works with the
MoveGen function and also the GoalTest function. Observe that all
moves are bidirectional.
The tiny search problem has
seven nodes, including the
start node S, the goal node G,
and five other nodes named A,
B, C, D, and E.
Without any loss of generality,
let us assume that the nodes
are states in a state space.
The algorithms apply to the
solution space as well.
The search space that an
algorithm explores is
implicit. It is generated on
the fly by the MoveGen
function, as described in
Algorithm
The candidates
generated are
added to what is
traditionally called
OPEN, from where
they are picked one
by one for
inspection.
The candidate that the search
algorithm picks from OPEN
determines its behaviour
Algorithm SimpleSearch picks node N
from the head of OPEN.
If N is the goal, it terminates with N,
else it calls MoveGen and adds the
neighbours of N to OPEN in some
manner.
The way this is done determines the
behaviour of the search algorithm.
The search tree
depicts the space as
viewed by a given
search algorithm.
Each variation of the
algorithm generates
its own search tree.
Given that we have
decided to extract
the next candidate
from the head of the
OPEN list, we need to
decide how to add
the new nodes to
OPEN.
State space
Search space (or search
tree)
- State space refers to the set of all
possible configurations or states that
a problem can take. It encompasses
all the possible scenarios that can be
reached from the initial state to the
goal state.
- Search space or search tree is a
representation of the paths taken
during the search process. It outlines
the various states explored, as well as
the decisions made during the search.
It can be considered a subset of the
state space, as not all states are
explored in a search process.
State Space Representation in Artificial Intelligence
DFS
v/s
BFS
Parameter BFS (Breadth First Search) DFS (Depth First Search)
Data structure used Queue (FIFO) Stack (LIFO)
Compeleteness
Complete (if the branching factor
is finite)
Incomplete (may get stuck
in infinite paths)
Quality of solution
Guaranteed to find the optimal
solution (shortest path in
unweighted graphs)
May not find the optimal
solution (depends on path
exploration)
Space Complexity
O(b^d) (where b is the branching
factor and d is the depth of the
shallowest solution)
O(bm) (where b is the
branching factor and m is
the maximum depth of the
search space)
Time Complexity O(b^d) O(b^m)
Which works best, where?
DFS is more efficient when the solution is far from the root, and BFS is better when finding the shortest path matters.
(i) Node (List of Neighbors) (ii) State space diagram
DFS Algorithm DFS picks node N from the head of OPEN. If N is the goal it
terminates with N, else it calls MoveGen and concatenates the list of
neighbours of N with OPEN.
(i) Search Tree of DFS (ii)OPEN -> Stack
Algorithm DFS dives headlong into
the first branch it sees.
The fact that it does so on the
leftmost branch is only because the
first node in the list returned by
MoveGen always ends up in at the
head of OPEN.
OPEN behaves like a stack with the
LIFO property.
The behaviour of depth first search
can thus be seen to embody the
newest nodes first strategy.
In the search tree that translates to
deepest nodes first, giving the
algorithm its name.
As can be seen in the Figure, the search oscillates between nodes S and A.
This keeps on happenning until the machine crashes.
For the 8-puzzle this would mean moving the same tile back and forth.
This happens because even though the state space is finite, the search tree
is infinite.
How to stop going around in circles?
The problem faced by a search algorithm is similar to a person trying to solve an actual maze (or
Labyrinth, which is a confusing structure in which one finds it difficult to reach the end as one keeps
on going in circles. Here, the person doesn’t have a map or top-view of the area. There is lack of a
global perspective of the kind humans have when, for example, poring over a city map. However,
when on the ground at a crossroads, one often does not have a sense of direction looking only at the
immediate neighbourhood).
This happens because the algorithm has access only to the immediate neighbours, and needs to
somehow find a path to the goal.
There is lack of a global perspective here.
Solution: Maintain another list apart from OPEN, that stores the nodes already
inspected. This list is traditionally called CLOSED.
When nodes already on CLOSED are not added to OPEN, the search space accessible to DFS shrinks dramatically to the subtree with solid
edges. It finds the path to the goal as shown. Note that the search tree depends on the left to right order of depth first search, which is why
it does not go beyond the nodes D, B, and C on the right. All their neighbours would already be on CLOSED.
Search tree for the given state space diagram.for DFS
BFS
Search tree for the given state space diagram for BFS
Water Jug Problem
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
State Space Representation in Artificial Intelligence
Advantages of state space representation
It allows for a formal definition of a problem as the need to convert some
given situation into some desired situation using a set of permissible
operations.
It permits us to define the process of solving a particular problem as a
combination of known techniques and search.
Search is the general technique of exploring the state space to try to find
some path from the current state to a goal state.
Search is a very important process in the solution of hard problems for
which no direct techniques are available.
Limitations of state space representation
It is not possible to visualize all the states for a given problem.
The resources of the computer system are limited to handle the huge state space
representations.
It doesn’t provide the order of the search that can give a solution to the problem.
Production systems and control strategies
Production system is a model of computation used for automated problem solving and rule-based
systems in AI. It consists of:
1. Set of production rules: These are condition-action pairs of the form "If condition, then action." Each
rule represents a way to transform one state into another.
2. Working memory: This contains the current state of the problem, represented by facts or symbols.
3. Control strategy: The mechanism for selecting which rule to apply at any given time.
Control Strategies: These determine how to choose and apply production rules. Common strategies
include:
- Forward chaining: Start with the initial state and apply rules to reach the goal state. This is data-driven.
- Backward chaining: Start with the goal state and work backward by applying rules to reach the initial
state. This is goal-driven.
- Conflict resolution: If multiple rules are applicable, a strategy (e.g., priority, specificity) is used to decide
which rule to apply next.
The combination of production rules, working memory, and control strategies defines how a system
moves through its state space to find a solution to a given problem.
Production systems
Production systems provide structures that
facilitate describing and performing the search
process.
A production system consists of :-
A set of rules
One or more Knowledge/databases
A control strategy
A rule applier
Production system rules
Forward rules: The left side determine the
applicability of the rule and the right side
describes the operation to be performed, if the
rule is applied.
Backward rules: The right side determine the
applicability of the rule and the left side
describes the operation to be performed, if the
rule is applied.
Tasks of a Control Strategy
It specifies the order in which the rules will be
compared to the DB.
It decides which rule to apply next during the
process of searching for a solution to a
problem.
It provides a way of resolving the conflicts
that arise when several rules match at once.
Requirements of a good control strategy
• It causes motion : In water Jug problem, if we apply a
simple control strategy of starting each time at the top
of the list of rules and choosing the first applicable
and then we will never move towards solution.
• It is systematic: If we choose another control strategy
saying that choose at random from among the
applicable rules then definitely it cause motion and
eventually will lead to a solution. But this control
strategy is not systematic. We may arrive at the same
state several times & thus waste time.
Forward vs Backward reasoning
• Forward Reasoning : Control strategy starts with
known fact and works towards a conclusion.
• Backward Reasoning: Goal directed control strategy.
Begin with final conclusion, draw sub goals, generate
further sub goals until all sub goals are satisfied.
A Systematic control strategy
Construct a tree with the initial state as its root.
Generate all the offspring of the root by applying each
of the applicable rules to the initial state.
Now for each leaf node, generate all its successors by
applying all the rules that are applicable:
Continue this process until some rules produces a goal
state. This process is called Breadth First Search
State Space Representation in Artificial Intelligence

More Related Content

PPTX
Knowledge Representation in Artificial Intelligence
PDF
Dimensionality Reduction Techniques in Machine Learning
PPT
Artificial Intelligence: Case-based & Model-based Reasoning
PPTX
Curse of dimensionality
PPTX
Logistic Regression
PDF
State space representation and search.pdf
PPTX
Machine Learning Tutorial | Machine Learning Basics | Machine Learning Algori...
PDF
Lecture 8: Decision Trees & k-Nearest Neighbors
Knowledge Representation in Artificial Intelligence
Dimensionality Reduction Techniques in Machine Learning
Artificial Intelligence: Case-based & Model-based Reasoning
Curse of dimensionality
Logistic Regression
State space representation and search.pdf
Machine Learning Tutorial | Machine Learning Basics | Machine Learning Algori...
Lecture 8: Decision Trees & k-Nearest Neighbors

What's hot (20)

PPTX
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
PDF
Dimentionality Reduction PCA Version 1.pdf
PPTX
WEKA: Output Knowledge Representation
PDF
Principal Component Analysis
PDF
Lec5: Pre-Processing Medical Images (III) (MRI Intensity Standardization)
PPTX
Data mining introduction
PDF
heuristic search Techniques and game playing.pdf
PDF
Introduction to Artificial Intelligence.pdf
PPTX
Genetic Algorithm
PPTX
Decision trees and random forests
PPT
5.5 graph mining
PPTX
Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...
PDF
Parametric & Non-Parametric Machine Learning (Supervised ML)
PPTX
Principal component analysis
PPTX
Machine learning & Time Series Analysis
PPTX
Computational learning theory
PDF
Neural Networks: Self-Organizing Maps (SOM)
PDF
Feature selection
PPT
Cure, Clustering Algorithm
PPT
introduction to data mining tutorial
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Dimentionality Reduction PCA Version 1.pdf
WEKA: Output Knowledge Representation
Principal Component Analysis
Lec5: Pre-Processing Medical Images (III) (MRI Intensity Standardization)
Data mining introduction
heuristic search Techniques and game playing.pdf
Introduction to Artificial Intelligence.pdf
Genetic Algorithm
Decision trees and random forests
5.5 graph mining
Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...
Parametric & Non-Parametric Machine Learning (Supervised ML)
Principal component analysis
Machine learning & Time Series Analysis
Computational learning theory
Neural Networks: Self-Organizing Maps (SOM)
Feature selection
Cure, Clustering Algorithm
introduction to data mining tutorial
Ad

Similar to State Space Representation in Artificial Intelligence (20)

PPTX
AI UNIT 2 PPT AI UNIT 2 PPT AI UNIT 2 PPT.pptx
PPT
2.Problems Problem Spaces and Search.ppt
PPTX
CHAPTER 5.pptx of the following of our discussion
PPT
Amit ppt
PPTX
AI_03_Solving Problems by Searching.pptx
PPTX
Artificial Intelligence
PPTX
3. ArtificialSolving problems by searching.pptx
PPTX
Unit-III-AI Search Techniques and solution's
PDF
problem solving in Artificial intelligence .pdf
PPTX
Learning (e.g., machine learning) Reasoning (solving problems, making decisi...
PPTX
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
PPTX
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
PPTX
Artificial Intelligence uninformed Search techniques.pptx
PPT
Artificial intelligent Lec 3-ai chapter3-search
PPTX
Module4_planning.ppt ygzghgs8txtofzifzifsjgxdvhfzurs8fsts
PDF
Artificial Intelegince-chapter three-problem solving.pdf
PPT
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
PPTX
Aritificial Intelligence Search Techniques Unit 1
PPTX
AI(Module1).pptx
PDF
Chapter 3 - Searching and prPlanning.pdf
AI UNIT 2 PPT AI UNIT 2 PPT AI UNIT 2 PPT.pptx
2.Problems Problem Spaces and Search.ppt
CHAPTER 5.pptx of the following of our discussion
Amit ppt
AI_03_Solving Problems by Searching.pptx
Artificial Intelligence
3. ArtificialSolving problems by searching.pptx
Unit-III-AI Search Techniques and solution's
problem solving in Artificial intelligence .pdf
Learning (e.g., machine learning) Reasoning (solving problems, making decisi...
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
UNIT 2-FULL.pptxLearning (e.g., machine learning) Reasoning (solving problem...
Artificial Intelligence uninformed Search techniques.pptx
Artificial intelligent Lec 3-ai chapter3-search
Module4_planning.ppt ygzghgs8txtofzifzifsjgxdvhfzurs8fsts
Artificial Intelegince-chapter three-problem solving.pdf
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
Aritificial Intelligence Search Techniques Unit 1
AI(Module1).pptx
Chapter 3 - Searching and prPlanning.pdf
Ad

Recently uploaded (20)

PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Well-logging-methods_new................
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Construction Project Organization Group 2.pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
web development for engineering and engineering
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
CYBER-CRIMES AND SECURITY A guide to understanding
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Digital Logic Computer Design lecture notes
OOP with Java - Java Introduction (Basics)
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Well-logging-methods_new................
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
bas. eng. economics group 4 presentation 1.pptx
additive manufacturing of ss316l using mig welding
Construction Project Organization Group 2.pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
web development for engineering and engineering
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CH1 Production IntroductoryConcepts.pptx
Internet of Things (IOT) - A guide to understanding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS

State Space Representation in Artificial Intelligence

  • 1. State Space Representation of Problems -Dr. Mehak Saini
  • 9. Figure: A tiny search problem. The figure on the left shows the MoveGen function in the format Node → (List of neighbours). The figure on the right shows the corresponding state space which is implicit and not given upfront. The algorithm itself works with the MoveGen function and also the GoalTest function. Observe that all moves are bidirectional. The tiny search problem has seven nodes, including the start node S, the goal node G, and five other nodes named A, B, C, D, and E. Without any loss of generality, let us assume that the nodes are states in a state space. The algorithms apply to the solution space as well.
  • 10. The search space that an algorithm explores is implicit. It is generated on the fly by the MoveGen function, as described in Algorithm The candidates generated are added to what is traditionally called OPEN, from where they are picked one by one for inspection. The candidate that the search algorithm picks from OPEN determines its behaviour Algorithm SimpleSearch picks node N from the head of OPEN. If N is the goal, it terminates with N, else it calls MoveGen and adds the neighbours of N to OPEN in some manner. The way this is done determines the behaviour of the search algorithm.
  • 11. The search tree depicts the space as viewed by a given search algorithm. Each variation of the algorithm generates its own search tree. Given that we have decided to extract the next candidate from the head of the OPEN list, we need to decide how to add the new nodes to OPEN.
  • 12. State space Search space (or search tree) - State space refers to the set of all possible configurations or states that a problem can take. It encompasses all the possible scenarios that can be reached from the initial state to the goal state. - Search space or search tree is a representation of the paths taken during the search process. It outlines the various states explored, as well as the decisions made during the search. It can be considered a subset of the state space, as not all states are explored in a search process.
  • 15. Parameter BFS (Breadth First Search) DFS (Depth First Search) Data structure used Queue (FIFO) Stack (LIFO) Compeleteness Complete (if the branching factor is finite) Incomplete (may get stuck in infinite paths) Quality of solution Guaranteed to find the optimal solution (shortest path in unweighted graphs) May not find the optimal solution (depends on path exploration) Space Complexity O(b^d) (where b is the branching factor and d is the depth of the shallowest solution) O(bm) (where b is the branching factor and m is the maximum depth of the search space) Time Complexity O(b^d) O(b^m)
  • 16. Which works best, where? DFS is more efficient when the solution is far from the root, and BFS is better when finding the shortest path matters.
  • 17. (i) Node (List of Neighbors) (ii) State space diagram
  • 18. DFS Algorithm DFS picks node N from the head of OPEN. If N is the goal it terminates with N, else it calls MoveGen and concatenates the list of neighbours of N with OPEN.
  • 19. (i) Search Tree of DFS (ii)OPEN -> Stack Algorithm DFS dives headlong into the first branch it sees. The fact that it does so on the leftmost branch is only because the first node in the list returned by MoveGen always ends up in at the head of OPEN. OPEN behaves like a stack with the LIFO property. The behaviour of depth first search can thus be seen to embody the newest nodes first strategy. In the search tree that translates to deepest nodes first, giving the algorithm its name. As can be seen in the Figure, the search oscillates between nodes S and A. This keeps on happenning until the machine crashes. For the 8-puzzle this would mean moving the same tile back and forth. This happens because even though the state space is finite, the search tree is infinite.
  • 20. How to stop going around in circles? The problem faced by a search algorithm is similar to a person trying to solve an actual maze (or Labyrinth, which is a confusing structure in which one finds it difficult to reach the end as one keeps on going in circles. Here, the person doesn’t have a map or top-view of the area. There is lack of a global perspective of the kind humans have when, for example, poring over a city map. However, when on the ground at a crossroads, one often does not have a sense of direction looking only at the immediate neighbourhood). This happens because the algorithm has access only to the immediate neighbours, and needs to somehow find a path to the goal. There is lack of a global perspective here. Solution: Maintain another list apart from OPEN, that stores the nodes already inspected. This list is traditionally called CLOSED.
  • 21. When nodes already on CLOSED are not added to OPEN, the search space accessible to DFS shrinks dramatically to the subtree with solid edges. It finds the path to the goal as shown. Note that the search tree depends on the left to right order of depth first search, which is why it does not go beyond the nodes D, B, and C on the right. All their neighbours would already be on CLOSED.
  • 22. Search tree for the given state space diagram.for DFS
  • 23. BFS
  • 24. Search tree for the given state space diagram for BFS
  • 34. Advantages of state space representation It allows for a formal definition of a problem as the need to convert some given situation into some desired situation using a set of permissible operations. It permits us to define the process of solving a particular problem as a combination of known techniques and search. Search is the general technique of exploring the state space to try to find some path from the current state to a goal state. Search is a very important process in the solution of hard problems for which no direct techniques are available.
  • 35. Limitations of state space representation It is not possible to visualize all the states for a given problem. The resources of the computer system are limited to handle the huge state space representations. It doesn’t provide the order of the search that can give a solution to the problem.
  • 36. Production systems and control strategies Production system is a model of computation used for automated problem solving and rule-based systems in AI. It consists of: 1. Set of production rules: These are condition-action pairs of the form "If condition, then action." Each rule represents a way to transform one state into another. 2. Working memory: This contains the current state of the problem, represented by facts or symbols. 3. Control strategy: The mechanism for selecting which rule to apply at any given time. Control Strategies: These determine how to choose and apply production rules. Common strategies include: - Forward chaining: Start with the initial state and apply rules to reach the goal state. This is data-driven. - Backward chaining: Start with the goal state and work backward by applying rules to reach the initial state. This is goal-driven. - Conflict resolution: If multiple rules are applicable, a strategy (e.g., priority, specificity) is used to decide which rule to apply next. The combination of production rules, working memory, and control strategies defines how a system moves through its state space to find a solution to a given problem.
  • 37. Production systems Production systems provide structures that facilitate describing and performing the search process. A production system consists of :- A set of rules One or more Knowledge/databases A control strategy A rule applier
  • 38. Production system rules Forward rules: The left side determine the applicability of the rule and the right side describes the operation to be performed, if the rule is applied. Backward rules: The right side determine the applicability of the rule and the left side describes the operation to be performed, if the rule is applied.
  • 39. Tasks of a Control Strategy It specifies the order in which the rules will be compared to the DB. It decides which rule to apply next during the process of searching for a solution to a problem. It provides a way of resolving the conflicts that arise when several rules match at once.
  • 40. Requirements of a good control strategy • It causes motion : In water Jug problem, if we apply a simple control strategy of starting each time at the top of the list of rules and choosing the first applicable and then we will never move towards solution. • It is systematic: If we choose another control strategy saying that choose at random from among the applicable rules then definitely it cause motion and eventually will lead to a solution. But this control strategy is not systematic. We may arrive at the same state several times & thus waste time.
  • 41. Forward vs Backward reasoning • Forward Reasoning : Control strategy starts with known fact and works towards a conclusion. • Backward Reasoning: Goal directed control strategy. Begin with final conclusion, draw sub goals, generate further sub goals until all sub goals are satisfied.
  • 42. A Systematic control strategy Construct a tree with the initial state as its root. Generate all the offspring of the root by applying each of the applicable rules to the initial state. Now for each leaf node, generate all its successors by applying all the rules that are applicable: Continue this process until some rules produces a goal state. This process is called Breadth First Search