0% found this document useful (0 votes)
3 views

State Space Search

The document discusses various search methods in artificial intelligence, focusing on state space search and automated problem solving techniques. It outlines key concepts such as state configurations, transformation rules, and search algorithms, while also addressing issues like space size and domain knowledge. Additionally, it provides examples of specific problems, including the Two Jug Problem and the Travelling Salesperson Problem, along with basic and cost-based search algorithms.

Uploaded by

rauniyaraman66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

State Space Search

The document discusses various search methods in artificial intelligence, focusing on state space search and automated problem solving techniques. It outlines key concepts such as state configurations, transformation rules, and search algorithms, while also addressing issues like space size and domain knowledge. Additionally, it provides examples of specific problems, including the Two Jug Problem and the Travelling Salesperson Problem, along with basic and cost-based search algorithms.

Uploaded by

rauniyaraman66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

SEARCH METHODS IN AI

STATE SPACE SEARCH


COMPLEX PROBLEMS & SOLUTIONS

Path Finding Chess Playing Robot Assembly

VLSI Chip Design Time-Table Scheduling Symbolic Integration 2


AUTOMATED PROBLEM SOLVING BY SEARCH
• Generalized Techniques for Solving Large Classes of Complex Problems
• Problem Statement is the Input and solution is the Output, sometimes even the
problem specific algorithm or method could be the Output
• Problem Formulation by AI Search Methods consists of the following key concepts
– Configuration or State
– Constraints or Definitions of Valid Configurations
– Rules for Change of State and their Outcomes
– Initial or Start Configurations
– Goal Satisfying Configurations
– An Implicit State or Configuration Space
– Valid Solutions from Start to Goal in the State Space
– General Algorithms which SEARCH for Solutions in this State Space
• ISSUES
– Size of the Implicit Space, Capturing Domain Knowledge, Intelligent Algorithms that
work in reasonable time and Memory, Handling Incompleteness and Uncertainty
3
BASICS OF STATE SPACE MODELLING
• STATE or CONFIGURATION:
– A set of variables which define a state or configuration
– Domains for every variable and constraints among variables to define a valid configuration
• STATE TRANSFORMATION RULES or MOVES:
– A set of RULES which define which are the valid set of NEXT STATE of a given State
– It also indicates who can make these Moves (OR Nodes, AND nodes, etc)
• STATE SPACE or IMPLICIT GRAPH
– The Complete Graph produced out of the State Transformation Rules.
– Typically too large to store. Could be Infinite.
• INITIAL or START STATE(s), GOAL STATE(s)
• SOLUTION(s), COSTS
– Depending on the problem formulation, it can be a PATH from Start to Goal or a Sub-graph of And-ed
Nodes
• SEARCH ALGORITHMS
– Intelligently explore the Implicit Graph or State Space by examining only a small sub-set to find the
solution
– To use Domain Knowledge or HEURISTICS to try and reach Goals faster 4
TWO JUG PROBLEM
• There is a large bucket B full of water and Two (02) jugs, J1 of volume 3 litre and J2 of
volume 5 litre. You are allowed to fill up any empty jug from the bucket, pour all water back
to the bucket from a jug or pour from one jug to another. The goal is to have jug J1 with
exactly one (01) litre of water
• State Definition: <J1, J2> <0,0>
• Rules: <0,5>
– Fill (J1): <J1, J2> to <3,J2> <3,0> <3,5>
– Fill (J2): <J1, J2> to <J1, 5>
– Empty (J1), Empty (J2): Similarly defined <3,2>
<0,3>
– Pour (J1, J2): <J1, J2> to <X,Y>, where <2,0>
• X = 0 and Y = J1 + J2 if J1+J2 ≤ 5,
• Y = 5 and X = (J1+ J2) – 5, if J1+J2 > 5 <3,3> <0,2>
<2,5>
– Pour (J2, J2): Similarly defined
<3,4> <0,4>
• Start: <0,0>, Goal: <1,0> <1,5>
• Part of State Space Shown on the right
(Not all Links shown here) <1,0> <0,1> <3,1>

5
3 DISK, 3 PEG TOWER of HANOI STATE SPACE

6
STATES, SPACES, SOLUTIONS, SEARCH
• States
– Full / Perfect Information and Partial Information States
• State Transformation Rules
– Deterministic Outcomes
– Non-Deterministic / Probabilistic Outcomes
• State Spaces As Generalized Games
– Single Player: OR Graphs
– Multi-Player: And / Or, Adversarial, Probabilistic Graphs
• Solutions
– Paths
– Sub-graphs
– Expected Outcomes
• Costs
• Sizes
• Domain Knowledge
• Algorithms for Heuristic Search
7
OR-Graph: TRAVELLING SALESPERSON PROBLEM
A
100
120

200 190
B C
75
80
110
75 90

D E
50

8
OR-Graph: TRAVELLING SALESPERSON PROBLEM
A <A>,0
100
120
<AB>,100 <AC>,120 <AD>,200 <AE>190
200 190
B C
75
80 <ABC>,175 <ABD>,175 <ABE>,180
110
75 90

<ABCD>,285 <ABCE>,265 <ABDC>,285 <ABDE>,225


D E
50

<ABCDE>,335 <ABCED>,315 <ABDCE>,375 <ABDEC>,315

<ABCDEA>,525 <ABCEDA>,515 <ABDCEA>,565 <ABDECA>,435


9
MODELLING AND/OR GRAPHS:
OR Nodes are ones for which one has a choice.

The AND nodes could be compositional (sum, product, min, max,


etc., depending on the way the sub-problems are composed),

Adversarial (game where the other parties have a choice)


or
Probabilistic (Environmental Actions)

10
AND/OR GRAPHS: ADVERSARIAL

11
AND/OR GRAPHS: COMPOSITIONAL / ADVERSARIAL / PROBABILISTIC

12
COMPOSITIONAL AND/OR GRAPHS – MATRIX CHAIN MULTIPLICATION
(M1 X (M2 X (M3 X M4))) = ((M1 x M2) X (M3 X M4)) = (((M1 x M2) X M3) X M4) =
(M1 X (M2 X M3) ) X M4)
BUT THE NUMBER OF MULTIPLICATIONS TO GET THE ANSWER DIFFER !!

Let A be a [p by q] Matrix and B be a [q by r] Matrix. The number of multiplications needed to


compute A X B = p*q*r

Thus if M1 be a [10 by 30] Matrix, M2 be a [30 by 5] Matrix and M3 be a [5 by 60] Matrix

Then the number of computations for

(M1 X M2) X M3 = 10*30*5 for P = (M1 X M2) and 10*5*60 for P X M3. Total = 4500

M1 X (M2 X M3) = 30*5*60 for Q = (M2 X M3) and 10*30*60 for M1 X Q. Total = 27000
13
COMPOSITIONAL AND/OR GRAPHS: MATRIX CHAIN
OR NODE (Min) MULTIPLICATION
(M1 :M4)
AND NODE (Fn)

(M1 :M4) (M1 :M4)


(M1 :M4)

(M1 :M1) (M2 :M4) (M1 :M2) (M3 :M4) (M1 :M3) (M4 :M4)

(M2 :M4) (M2 :M4) (M1 :M3) (M1 :M3)

(M2 :M2) (M3 :M4) (M2 :M3) (M1 :M2) (M3 :M3)

(M1 X (M2 X (M3 X M4))) = ((M1 x M2) X (M3 X M4)) = (((M1 x M2) X M3) X M4) =
(M1 X (M2 X M3) ) X M4)
14
SEARCHING IMPLICIT GRAPHS
Given the start state the <A>,0
SEARCH Algorithm will
create successors based on
the State Transformation <AB>,100 <AC>,120 <AD>,200 <AE>190
Rules and make part of the
Graph EXPLICIT.
It will EXPAND the Explicit
graph INTELLGENTLY to <ABC>,175 <ABD>,175 <ABE>,180
rapidly search for a solution
without exploring the entire
Implicit Graph or State Space
For OR Graphs, the solution <ABCD>,285 <ABCE>,265 <ABDC>,285 <ABDE>,225
is a PATH from start to Goal.
Cost is usually sum of the
edge costs on the path, <ABCDE>,335 <ABCED>,315 <ABDCE>,375 <ABDEC>,315
though it could be something
based on the problem
<ABCDEA>,525 <ABCEDA>,515 <ABDCEA>,565 <ABDECA>,435
15
SEARCHING IMPLICIT GRAPHS
For And/OR Graphs, the Solution
is an AND Subgraph rooted at
the Start and each leaf is a Goal
Node.
The Cost of OR Node is usually a
Min or Max.
The Cost at the AND Node
depends on the type of Node
(Compositional, Adversarial,
Probabilistic).
For Adversarial two player
games, Max / Min is used at AND
Node (reverse of Or Node)

16
SEARCHING IMPLICIT GRAPHS
The various Search Algorithms include
• BASIC Algorithms: Depth-First (DFS), Breadth-first
(BFS), Iterative Deepening (IDS)
• COST-based Algorithms: Depth-First Branch-and-
Bound, Best First Search, Best-First Iterative Deepening
• Widely Used Algorithms: A* and IDA* (Or Graphs), AO*
(And/Or Graphs), Alpha-beta Pruning (Game-Trees)

17
BASIC ALGORITHMS in OR GRAPHS: DFS
1. [Initialize] Initially the OPEN List contains the
Start Node s. CLOSED List is Empty.
2. [Select] Select the first Node n on the OPEN List.
If OPEN is empty, Terminate
3. [Goal Test] If n is Goal, then decide on
Termination or Continuation / Cost Updation
4. [Expand]
a) Generate the successors n_1, n_2, …. n_k, of
node n, based on the State Transformation
Rules
b) Put n in LIST CLOSED
c) For each n_i, not already in OPEN or CLOSED
List, put n_i in the FRONT of OPEN List
d) For each n_i already in OPEN or CLOSED
decide based on cost of the paths
5. [Continue] Go to Step 2 18
BASIC ALGORITHMS in OR GRAPHS: IDS
1. [Initialize] Initially the OPEN List contains the Start
Node s. CLOSED List is Empty.
2. [Select] Select the first Node n on the OPEN List. If
OPEN is empty, Terminate
3. [Goal Test] If n is Goal, then decide on Termination or
Continuation / Cost Updation
4. [Expand]
a) Generate the successors n_1, n_2, …. n_k, of node
n, based on the State Transformation Rules
b) Put n in LIST CLOSED
c) For each n_i, not already in OPEN or CLOSED List,
put n_i in the FRONT of OPEN List
d) For each n_i already in OPEN or CLOSED decide
based on cost of the paths
3. [Continue] Go to Step 2

Algorithm IDS Performs DFS Level by Level Iteratively


(DFS (1), DFS (2), ……. and so on) 19
BASIC ALGORITHMS in OR GRAPHS: BFS
1. [Initialize] Initially the OPEN List contains the
Start Node s. CLOSED List is Empty.
2. [Select] Select the first Node n on the OPEN List.
If OPEN is empty, Terminate
3. [Goal Test] If n is Goal, then decide on
Termination or Continuation / Cost Updation
4. [Expand]
a) Generate the successors n_1, n_2, …. n_k, of
node n, based on the State Transformation
Rules
b) Put n in LIST CLOSED
c) For each n_i, not already in OPEN or CLOSED
List, put n_i in the END of OPEN List
d) For each n_i already in OPEN or CLOSED
decide based on cost of the paths
5. [Continue] Go to Step 2 20
EXAMPLE: SEARCHING A STATE SPACE GRAPH
A START

• DEPTH-FIRST SEARCH (DFS)


B C D
• BREADTH-FIRST SEARCH (BFS)

• ITERATIVE DEEPENDING SEARCH (IDS)


E F G H
• PROPERTIES
GOAL • SOLUTION GUARANTEES
• MEMORY REQUIREMENTS
I J
GOAL
GOAL

21
EXAMPLE: SEARCHING A STATE SPACE GRAPH
A START DEPTH-FIRST SEARCH:
1. OPEN ={A}, CLOSED = {}
2. OPEN = {B,C,D}, CLOSED = {A}
3. OPEN = {E,F,G,C,D}, CLOSED = (A,B}
B C D 4. OPEN = {I,J,F,G,C,D}, CLOSED = {A,B,E}
5. Goal Node I Found. Can Terminate with
Path from A to I or may Continue for
more Goal nodes if minimum length or
E F G H cost is a criteria

GOAL DFS MAY NOT TERMINATE IF THERE IS AN


INFINITE DEPTH PATH EVEN IF THERE IS A
I J GOAL NODE AT FINITE DEPTH
GOAL
GOAL DFS HAS LOW MEMORY REQUIREMENT

22
EXAMPLE: SEARCHING A STATE SPACE GRAPH
A START ITERATIVE DEEPENING SEARCH:
1. PERFORM DFS TILL LENGTH 1. NO
SOLUTION FOUND
2. PERFORM DFS TILL LEVEL 2. GOAL
B C D NODE H REACHED.
3. Can Terminate with Path from A to H.
This is guaranteed to be the minimum
length path.
E F G H
IDS GUARANTEES SHORTEST LENGTH
GOAL PATH TO GOAL

I J IDS MAY RE-EXPAND NODES MANY TIMES


GOAL
GOAL IDS HAS LOWER MEMORY REQUIREMENT
THAN BFS
23
EXAMPLE: SEARCHING A STATE SPACE GRAPH
A START BREADTH-FIRST SEARCH:
1. OPEN ={A}, CLOSED = {}
2. OPEN = {B,C,D}, CLOSED = {A}
3. OPEN = {C,D,E,F,G}, CLOSED = (A,B}
B C D 4. OPEN = {D,E,F,G}, CLOSED = {A,B,C}
5. OPEN = {E,F,G,H}. CLOSED = {A,B,C,D}
6. OPEN = {F,G,H,I,J}, CLOSED = {A,B,C,D,E}
7. OPEN = {G,H,I,J}, CLOSED = {A,B,C,D,E,F}
E F G H 8. OPEN = {H,I,J}, CLOSED = {A,B,C,D,E,F,G}
9. Goal Node H Found. Can Terminate with
GOAL Path from A to H. This is guaranteed to be
the minimum length path.
I J
BFS GUARANTEES SHORTEST LENGTH PATH
GOAL
GOAL TO GOAL BUT HAS HIGHER MEMORY
REQUIREMENT
24
SEARCHING STATE SPACE GRAPHS WITH EDGE COSTS
A START

10
12 5
B C D
2
6 7 6
8 7 5 4

9 1 13
E F G H
14 3
18 GOAL
18
I J
GOA GOAL
L

25
MODIFYING BASIC ALGORITHMS TO INCORPORATE COSTS
1. [Initialize] Initially the OPEN List contains the Start Node s. CLOSED List is Empty.
2. [Select] Select the first Node n on the OPEN List. If OPEN is empty, Terminate
3. [Goal Test] If n is Goal, then decide on Termination or Continuation / Cost Updation
4. [Expand]
a) Generate the successors n_1, n_2, …. n_k, of node n, based on the State
Transformation Rules
b) Put n in LIST CLOSED
c) For each n_i, not already in OPEN or CLOSED List, put n_i in the FRONT (for
DFS) / END (for BFS) of OPEN List
d) For each n_i already in OPEN or CLOSED decide based on cost of the paths
5. [Continue] Go to Step 2

Algorithm IDS Performs DFS Level by Level Iteratively (DFS (1), DFS (2), ……. and so
on)
26
NEXT: SEARCHING STATE SPACE GRAPHS WITH EDGE COSTS
A START
• COST ORDERED SEARCH:
10 • DFBB
12
5 • Best First Search,
B C D • Best First IDS
2 • Use of HEURISTIC Estimates:
6 7 6
8 7 5 4 Algorithm A* (Or Graphs), AO*
1 13 (And/Or Graphs)
9 F G H
E
14 • PROPERTIES
18 3 GOAL • SOLUTION GUARANTEES
18
• MEMORY REQUIREMENTS
I J
GOA GOAL
L

27
Thank you

You might also like