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

Ch5 State Space Search Methods Master

This document discusses state-space search methods used in artificial intelligence and expert systems. It describes trees and graphs as representations of state-spaces. Blind search methods like breadth-first search and depth-first search are explained, along with their properties and suitability for different problems. The document also introduces heuristic search methods that use domain knowledge to guide the search towards more promising solutions, reducing search effort compared to exhaustive blind searches.

Uploaded by

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

Ch5 State Space Search Methods Master

This document discusses state-space search methods used in artificial intelligence and expert systems. It describes trees and graphs as representations of state-spaces. Blind search methods like breadth-first search and depth-first search are explained, along with their properties and suitability for different problems. The document also introduces heuristic search methods that use domain knowledge to guide the search towards more promising solutions, reducing search effort compared to exhaustive blind searches.

Uploaded by

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

Artificial Intelligence &

Expert Systems

State-Space
State-Space Search
Search Methods
Methods

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


➪ 15-Puzzle constitutes !16 = (1.1 x 1013) nodes (combinations).
➣ Trees: A

B C D

E G
F
H
1- This tree is composed of 8 nodes.
2- Ǝ only one path between each 2 nodes (at most).
3- B is a child of A 4- C is the parent of H
5- E,F,G are called siblings 6- A is the root of the tree
7- A is the ancestor of E,F,G, and H and any child node…
8- E is the descendent of A
9- E,F,G,H,D are end-nodes.

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


➣ Graphs: A 10
E

15 20
12

D
28
B
26
16

This graph: 20
C
1- Contains 5 nodes.
2- contains 8 weighted links and directed links.
3- has a root node A
4- Ǝ 2 paths from A to B
a- A B directly with weight 20
b- A E B with sum weight 22
5- D C D is a cycle path (infinite).

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


➣ When to choose a search method. You must choose
the method that:
1- Reach the goal with less time.
2- Reach the goal with less state-space.
3- Guaranteed to reach the goal.
4- Must end either by reaching a goal or fail to reach
a goal.
5- We have to choose the ideal method to solve the
problem.
6- The method must be as simple as possible and does
not contain complex calculations that affect the
efficiency and speed

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


➣ State Process
➪ Is the process of creating new states from old ones,
and then examining the new state to check if they
contain the goal or not ?

➪ So, we must describe the goal state precisely before


starting the search process.

➪ It is not important only to reach the goal, but to


reach
it with less time and less cost.

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


➣ State-space search methods

I- Blind-search methods:
➪ called blind because in these search methods we
check all the generated states in an ordered fashion.

➪ Usually the resulted state-space is huge, and


contains a lot of unused states, and closed paths.

➪ But, these methods are better than haphazard


methods that do not contain search strategies.

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


➪ Divided into 2 methods

I.1 Breadth First search method.


I.2 Depth First search method.

I.1 Breadth First search method.


The breadth-first search method expands nodes in the
order in which they are generated. A simple algorithm
for searching trees, breadth-first consists of the
following sequences of steps.

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


1- Put the start node on a list called OPEN.
2- If OPEN id empty, exit with failure; otherwise continue
3- Remove the first node in OPEN and put it on a list
called CLOSED, call this node n.
4- Expand node n, generating all of its successors. If there
are no successors, go immediately to (2). Put the
successors at the end of OPEN and provide pointers from
these successors back to n.
5- If any of the successors are goal nodes, exit with the
solution obtained by tracing back through the pointers;
otherwise go to (2).

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
We note from the figure the following:
1- 26 nodes are expanded from the total of 46 generated
nodes.
2- The generated tree consists of 5 levels (5 steps)
3- 20 nodes not expanded.
4- We reached the goal with the shortest path ( with 5 steps)

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


This method :
1- Reaches the goal with the shortest path.
2- It moves from one level to another after expanding all
nodes in the level.
3- Is not suitable for problems in which the goal is faraway
from the initial state.
4- Is not suitable for problems in which the branching factor
is large ( like chess branching factor = 50)

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


I.2 Depth First search method.
- In this method, we expand the most recently generated
nodes first.
- the depth of the tree can be defined as follows:
* The depth of the root node is zero.
* The depth of any node that is a descendent of the root
is one plus the depth of its parent.
- Depth bound is used to prevent long paths.

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


The following sequence of steps defines the depth-first method:

1- Put the start node on a list called OPEN.


2- If OPEN is empty, exit with failure; otherwise continue
3- Remove the first node from OPEN and put it on a list
called CLOSED, call this node n.
4- If the depth of n equals the depth bound, o to (2);
otherwise continue.
5- Expand node n, generating all successors of n, put these
(in arbitrary order) at the beginning of OPEN and
provide pointers back to n.
6- If any of these successors are goal nodes, exit with the solution
obtained by tracing back through the pointers; otherwise go to (2).

Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems


Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Using Depth-First Method, we note:

1. When searching for a goal, it goes through one


path until it reaches the end of this path or reaches
the depth bound. If it does not reach the goal in
this path it moves to another path and so on…

2. This method is suitable for problems with the goal


far away from S.

3. Suitable for problems that have high branching


factor.

17
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
01/18/22 Search
Heuristic Search Methods:

 Breadth-First and Depth-First methods are exhaustive


methods.

 There are always practical limits on the amount of time and


storage available to expend on the search.

 Heuristics are rules of thumb or information used to speed


up the search.

 One way is to use a move "informed" that does not generate


so many extraneous successors.

 Can be applied on Breadth-First and Depth-First methods.


18
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Step 5 can be modified to let the generated successors
to be placed in some definite order determined by the
heuristic information.

A more flexible way to use heuristics information is to


use some criterion to reorder all of the nodes on OPEN at
every step.

In order to apply such an ordering procedure we need


some measure by which to evaluate the "promise" of a
node. Such measures are called Evaluation Functions.

It is often possible to specify heuristics that reduce


search effort without sacrificing the guarantee of finding a
minimal cost path.

19
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
More frequently, heuristics used greatly reduce search effort
at the expense of giving up the guarantee of finding a minimal
cost path on some problems.

So, we are interested in minimizing some combination of:


- The cost of the path, and
- The cost of the search required to
obtain the path.

20
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
If the averaged combination cost of search
method 1 is lower than the averaged
combination cost of search method 2, then
we say that search method 1 has more
heuristic power than method 2.

21
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Evaluation Functions:

Used for ordering the search.

Used to provide a means for ranking those nodes that


are candidates for expansion to determine which one is
most likely to be on the best path to the goal.

Suppose f^ is the function that could be used to order


nodes for expansion.

Then f^(n) is the value of f^ at node n.

The algorithm that uses these ideas is called Ordered-


Search Algorithm (A*) 22
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Example:
Evaluation function of an 8-puzzle game f^(n) = g^(n) + W(n) will be
used, where:

g^(n) is the length of the path in the search tree from S to node n,
and

W(n) counts the number of misplaced tiles in the state description


of n.

2 8 3 1 2 3
w(n) = 4 8 4
7 1 4
6 5 7 6 5

23
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
With these needed provisions, the ordered-search algorithm then consists of the
following sequence of steps:

Put the start node s on a list called OPEN and compute f(s).
If OPEN is empty, exit with failure; otherwise continue.
Remove from OPEN that node whose f value is smallest and put it on a list
called CLOSED. Call this node n. (Resolve ties for minimal f values arbitrarily,
but always in favor of any goal node.)
If n is a goal node, exit with the solution path obtained by tracing back
through the pointers; otherwise continue.
Expand the node n, generating all of its successors. (If there are no
successors, go immediately to (2).) For each successor n, compute f(ni).
Associate with the successors not already on either OPEN or CLOSED the f
values just computed. Put these nodes on OPEN and direct pointers from them
back to n.
Associate with those successors that were already on OPEN or CLOSED the
smaller of the f values just computed and their previous f values. Put on OPEN
those successors on CLOSED whose f values were thus lowered, and redirect
to n the pointers from all nodes whose f values were lowered.
Go to (2).

24
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
25
Hence in summary;

The cost of the path


The number of nodes expanded
The difficulty of computing h^

Influences the heuristic power of an ordered-search


algorithm.

26
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
The Importance of g^:

In some problems we need to find some path to a goal, not necessarily
the optimal path.

Then we can argue for and against including g^ in f^.

Argument for ignoring g^:

"During a search we do not care about the path already developed but what
lies ahead“

Argument for including g^:

"Even when it is not essential to find the minimal cost path, g^ should be
included to make sure that some path will be found.“
27
This is particularly true if h^ is not a good estimator.
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
The choice of the evaluation function critically
determines the search results.

The use of an evaluation function that ignores the


true promise of some nodes (weak) can result in non-
minimal cost paths.

On the other hand, the use of an evaluation function


that over-generously acknowledges the possible
promise of all nodes (over strong) will result in the
expansion of too many nodes.

28
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
An Optimal Search Algorithm:

1)Maximizes search efficiency


2)Guarantees minimal cost path to a goal.
•f^(n) is an estimate of the cost of the minimal cost
path to a goal constrained to go through the node n.
•The node on OPEN having the smallest f^ value is
estimated to be on a minimal cost path.

29
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
The Heuristic power of h^

•The selection of h^ is crucial.


•h^ = 0 assures admissibility but results in blind
search.
•If h^ is "highest" lower bound on h, then fewest
nodes will be expanded and admissibility will be
maintained.
•Sometimes it is possible to increase heuristic power
by using h^ that is not a lower bound on h ‫ ـــ‬but then
A* will not be admissible.
30
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
Example:

In the 8-puzzle, instead of using h^a(n) = W(n) where W(n)


where W(n) is the number of tiles in the wrong place could
use h^b(n) =P(n) where P(n) is the sum of the distances of
each tile from home. Clearly h^ a ≤ h^ b ≤ h^

But if we use h^ C (n) = P(n) + 3S(n) Where P(n) is as


before S(n) is the "sequence score" for non-central tiles
found by adding 2 for every tile not followed by its
successor, and 1 for the center tile. 

31
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
32
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
33
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
• In this example h^ is not a lower bound on h.
• The path found happens to be minimal cost path
• but this is not always true.
• In general h^ focuses search towards the goal.
• Amount of effort that goes into the computation of h^ is also an
important consideration.
• Best h^ would be a function identical to h.
• This will result in minimum number of expansions.
• If h^ not lower bound on h is easier to compute than one that is.
Then the heuristic power of h^ is even higher.
• In some cases the heuristic power of h^ can be increased by
multiplying it by a positive constant greater than 1.
• If this constant value is very large then it will have the same
effect as setting g^=0.
• This will improve search efficiency but loose admissibility
characteristic.
34
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems
MEASURES OF PERFORMANCE:

Penetrance(P): of a search measures the extend of focusing


toward a goal. P = L/T Where L: is the length of the path T:
is the number of nodes expanded.

Effective Branching Factor B: is independent of path


length of the optimal solution, Defined as:
B + B^2 + ……..+ B^L = T

35
Dr. Saleh Abu-soud Artificial Intelligence & Expert Systems

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy