Informed Search and Exploration - Air Universityportals.au.edu.pk/imc/Content/course/lecs/Lecture-4...

Post on 05-Jun-2020

15 views 0 download

Transcript of Informed Search and Exploration - Air Universityportals.au.edu.pk/imc/Content/course/lecs/Lecture-4...

Informed Search and Exploration

Uninformed vs Informed

Search Strategies,

Best-First Search Algorithm,

Uniform Cost Search

Algorithm (UCS),

Greedy best-first search

algorithm,

- Complete?,

- Time?,

- Space?,

- Optimal?.

A* search algorithm,

Iterative Deepening Search

Algorithm,

- QueuingFn,

- Expand(state),

Explore: Topics based

Research Areas:

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

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

2. Best-First Search Algorithm (Cont…)

Example:- Step -2:-

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

Example:- Step -3:-

2. Best-First Search Algorithm (Cont…)

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

Example:- Step -4:-

2. Best-First Search Algorithm (Cont…)

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

Example:- Step -5:-

2. Best-First Search Algorithm (Cont…)

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

Example:- Step -6:-

2. Best-First Search Algorithm (Cont…)

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

Example:- Step -7:-

2. Best-First Search Algorithm (Cont…)

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

Example:- Step -8:-

2. Best-First Search Algorithm (Cont…)

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

Example:- Step -9:-

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

distance” ????

2. Best-First Search Algorithm (Cont…)

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

Example:- Class Evaluation:-

Estimated distance = 24, 37, 49

H

e u i a ai o

a r g g m t s z w tt

h yl

19 6 11 9 14 2317

16 12 826

315 13 14

73 54

31 0 27

2. Best-First Search Algorithm (Cont…)

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

Example:- Generate “English dictionary” by using best-first search

algorithm.

2. Best-First Search Algorithm (Class Participation)

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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

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

Step 1:- Open list: C

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

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

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

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

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

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

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

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

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

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

{T(1) is excluded}

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

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

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

{B(2) at stack}

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

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

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

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

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

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

{E(2) at stack}

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

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

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

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

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

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

{O(3) at stack}

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

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

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

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

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

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

{A(3) is excluded}

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

Step 12:- Open list: P(5) S(5) N(5) R(6) Z(6) G(7)

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

{I(4) at stack}

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

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

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

{P(5) at stack}

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

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

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

{S(5) is excluded}

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

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

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

{N(5) is excluded}

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

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

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

{R(6) is excluded}

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

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

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

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

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

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

3. Uniform Cost Search Algorithm (Class Participation)

A

B

C

D

E

F

Goal

5

8

10

2

16

30

14

26

4

18

3 12

A)

B)

6

2 3 41

5 7 8

9 10 11 12 Goal

2 1 2

5

1

1

8 3

1 5

1

1

15

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

Comparison of Search Techniques

DF

S

BF

S

UC

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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

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

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

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

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

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

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

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

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

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

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

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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

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

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

Sibiu = cost + estimated cost

Sibiu = 140+253

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

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: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

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

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

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

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

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

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

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 + b2] + .. + [b + b2 + .. + bd]@Copyrights: Advanced Artificial Intelligence Organized by Dr. Ahmad Jalal (http://portals.au.edu.pk/imc/)

6. Iterative Deepening Search Algorithm (Cont…)

Figure: Example of iterative deepening search

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

7. Explore: Topics based Research Areas

(1) Dynamic Walking over Uneven Terrain :-

Proposed architecture of Model

Implemented results

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

Assignment # 2(Searching Algorithms)

1. Adversarial Search

2. Bidirectional Search

3. Beam Search

4. Local & International

applications of;

a) Best-First Search

Algorithm,

b) Uniform Cost Search

Algorithm (UCS),

c) Greedy best-first

search algorithm,

d) A* search algorithm.

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