You are on page 1of 54

Informed Search and Exploration

 Uninformed vs Informed  Iterative Deepening Search


Search Strategies, Algorithm,
 Best-First Search Algorithm, - QueuingFn,
 Uniform Cost Search - Expand(state),
Algorithm (UCS),  Explore: Topics based
 Greedy best-first search Research Areas:
algorithm,
- Complete?,
- Time?,
- Space?,
- Optimal?.
 A* search algorithm,

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


1. Uninformed Vs Informed Search Strategies
Uninformed Search Strategies:

Uninformed search strategies look for solutions by systematically


generating new states and checking each of them against the goal.

 This approach is very inefficient in most cases.

 Most successor states are “obviously” a bad choice.

Such strategies do not know because they have minimal problem-


specific knowledge.

 Strategies are;
- Breadth-first search,
- depth-first search.

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


1. Uninformed Vs Informed Search Strategies (Cont…)
Informed Search Strategies:

Informed search strategies exploit problem-specific knowledge as


much as possible to drive the search.

 They are almost always more efficient than uninformed searches

 Also, more consistent and optimal.

Main Idea:-
①Use the knowledge of the problem domain to build an evaluation function f.
②For every node n in the search space, f ( n ) quantifies the desirability of expanding
n in order to reach the goal.
③Then, use the desirability value of the nodes in the fringe (destination) to decide
which node to expand next.
@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan
1. Uninformed Vs Informed Search Strategies (Cont…)
Informed Search Strategies:

 Informed search strategies deal as best-first search.

 Idea: use an evaluation function for each node to estimate of


“desirability”.

 Strategy: Always expand most desirable unexpanded node.

Implementation: fringe is a priority queue sorted in decreasing order


of desirability.

 Special cases:
 Best-first search
 Uniform-cost search
 Greedy search
 A* search

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm
 Efficient selection of the current best candidate for extension is
typically implemented using a priority queue.
 Best-first search only as good as heuristic.
– Example heuristic for 8 puzzle:
– Manhattan Distance
Example:- Step -1:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -2:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -3:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -4:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -5:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -6:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -7:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -8:-

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Step -9:-

Is there any other “GOAL” is possible at specific “Estimated


distance” ????

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Cont…)
Example:- Class Evaluation:-
H

19 6 11 9 14 23
i e u i a a 17 o

16 12 26 3 54
8 15 7
13 14
t a r g 3 g m t s z w t

31 0 27
l h y

 Estimated distance = 24, 37, 49

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


2. Best-First Search Algorithm (Class Participation)
Example:- Generate “English dictionary” by using best-first search
algorithm.

Parent Node Total level (max) Total Estimated distance Total number of nodes

S 4 34 18

D 3 46 16

R 2 23 12

A 5 69 27

I 2 18 9

P 3 25 14

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS)
 QueueingFn is SortByCostSoFar.

 Cost from root to current node n is g(n).


– Add operator costs along path

 First goal found is least-cost solution.

 Space & time can be exponential because large subtrees with


inexpensive steps may be explored before useful paths with costly
steps.

 If costs are equal, time and space are O(bd).


– Otherwise, complexity related to cost of optimal solution.

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 1:- Open list: C

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 2:- Open list: B(2) T(1) O(3) E(2) P(5)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 3(ordering):- Open list: T(1) B(2) E(2) O(3) P(5)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 4:- Open list: B(2) E(2) O(3) P(5) {T(1) is excluded}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 5:- Open list: E(2) O(3) P(5) {B(2) at stack}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 6:- Open list: E(2) O(3) A(3) S(5) P(5) R(6)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 7:- Open list: O(3) A(3) S(5) P(5) R(6) {E(2) at stack}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 8:- Open list: O(3) A(3) S(5) P(5) R(6) G(7)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 9:- Open list: A(3) S(5) P(5) R(6) G(7) {O(3) at stack}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 10:- Open list: A(3) I(4) S(5) N(5) P(5) R(6) G(7)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 11:- Open list: I(4) P(5) S(5) N(5) R(6) G(7)
{A(3) is excluded}
@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan
3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 12:- Open list: P(5) S(5) N(5) R(6) Z(6) G(7)
{I(4) at stack}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 13:- Open list: S(5) N(5) R(6) Z(6) F(6) G(7) D(8) L(10)
{P(5) at stack}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 14:- Open list: N(5) R(6) Z(6) F(6) G(7) D(8) L(10)
{S(5) is excluded}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 15:- Open list: R(6) Z(6) F(6) G(7) D(8) L(10)
{N(5) is excluded}

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 16:- Open list: Z(6) F(6) G(7)D(8) L(10)


{R(6) is excluded}
@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan
3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

Step 17:- Open list: F(6) G(7)D(8) L(10)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (UCS Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


3. Uniform Cost Search Algorithm (Class Participation)

A) 16
B E
26
5 2 30
14
A 10 D Goal

3 12
4
8
18
C F

B)
2 1 2
1 2 3 4
1 1
5 1 5
5 6 7 8
1 15
8 3 1
9 10 11 12 Goal

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


Comparison of Search Techniques

DF BF UC
S S S
Complete N Y Y
Optimal N N Y
Heuristic N N N
Time bm bd+1 bm
Space bm bd+1 bm

@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)


4. Greedy best-first search algorithm
 Greedy best-first search expands the node that appears to be
closest to goal.
- Less number of nodes,
- shortest time in between compared nodes.
 Evaluation function f(n) = h(n) (heuristic) = estimate of cost from
n to goal.
 Example; hSLD(n) = straight-line distance from n to Bucharest.

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


4. Greedy best-first search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


4. Greedy best-first search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


4. Greedy best-first search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


4. Greedy best-first search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


4. Greedy best-first search algorithm (Cont…)

 Complete? No – can get stuck in loops, e.g., Iasi  Neamt 


Iasi  Neamt 

 Time? O(bm), but a good heuristic can give dramatic


improvement

 Space? O(bm) -- keeps all nodes in memory

 Optimal? No

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


5. A* search algorithm

 Idea: avoid expanding paths that are already expensive.

 Evaluation function f(n) = g(n) + h(n)

g(n) = cost so far to reach n


h(n) = estimated cost from n to goal
f(n) = estimated total cost of path through n to goal

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


5. A* search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


5. A* search algorithm (Example) (Cont…)

Sibiu = cost + estimated cost


Sibiu = 140+253

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


5. A* search algorithm (Example) (Cont…)

Arad = (140+140)+366
Arad = 280+366

Fagaras= (140+99)+176
Fagaras= 239+176

Oradea= (140+151)+380
Oradea = 291+380

Rimnicu Vilcea= (140+80)+193


Rimnicu Vilcea = 220+193

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


5. A* search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


5. A* search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


5. A* search algorithm (Example) (Cont…)

@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan


6. Iterative Deepening Search Algorithm
 DFS with depth bound.

 QueuingFn is enqueue at front as with DFS


- Expand(state) only returns children such
that depth(child) <= threshold
- This prevents search from going down
infinite path.

 First threshold is 1
- If do not find solution, increment threshold
and repeat.

Problem:-
What about the repeated work?
Time complexity (number of generated nodes)
 [b] + [b @Copyrights:
+ b2] +Artificial
.. +Intelligence b2 +by ..Ms. +
[b +Organized b d]
Zullatun Gull Khan
6. Iterative Deepening Search Algorithm (Cont…)

Figure: Example of iterative deepening search


@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan
7. Explore: Topics based Research Areas
(1) Dynamic Walking over Uneven Terrain :-

Implemented results

Proposed architecture of Model


@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan
Assignment # 2(Searching Algorithms)

1. Adversarial Search 4. Local & International


2. Bidirectional Search applications of;
3. Beam Search a)Best-First Search
Algorithm,
b)Uniform Cost Search
Algorithm (UCS),
c)Greedy best-first
search algorithm,
d) A* search algorithm.
@Copyrights: Artificial Intelligence Organized by Ms. Zullatun Gull Khan

You might also like