You are on page 1of 33

Introduction to Artificial Intelligence

CT017-3-1

Problem Solving Part 2

Learning outcomes
At the end of the session, you should be able to:
Explain problem characteristics Explain the cost of doing search Traverse a search tree using depth-first search Explain iterative deepening search Discuss how to evaluate blind searches in relation to cost
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Slide 2 of 16

Problem characteristics
Issues to consider: is the problem decomposable? can solution steps be ignored or undone? is the universe predictable? is a good solution absolute or relative? is the solution a state or a path? what is the role of knowledge?

dost the task require human-interaction?

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 3 of 16

Search can be applied to many problems


solution to a puzzle shortest path on a map proof of a theorem sequence of moves to win a game

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 4 of 16

Other considerations
Completeness - can find solution?
Can the algorithm guarantee the solution

Space complexity - how big is the storage?


Memory space required by algorithm in keep track the size of fringe (list of nodes)

Time complexity - how many operations?


Time taken for number of nodes expanded

Solution quality - how good is the


solutions?
Does the solution guarantee minimum cost
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Slide 5 of 16

Search performance
The factors to determine:

Branching factor - how many branches can be applied at any time? Depth level - how long is the path to the closest solution?

All these are known as the search cost.


CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI

Slide 6 of 16

Search cost
Sometimes referred to as path cost based on previous example:

The path cost from node A to node B is 6, from node B to node D is 3 and so on.
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Slide 7 of 16

Implementation
Using breadth-first search for this search tree, The path is A-B-C-D-ED-G The path cost is 6+4+3+2+2+14 = 31

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 8 of 16

Objective of search

To find the shortest path (least cost) from the initial state to the goal state

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 9 of 16

Depth-first search

It searches through the tree systematically, exploring each branch in turn to its tip until it finds a goal node.

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 10 of 16

Example
The path traversed is A-B-D-C-G. Stop since G is found. The path cost: 6+3+2+14=25

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 11 of 16

Iterative deepening search


Combines breadth-first and depth-first search technique It will try all possible depth limit until a goal is found Make use of the data structure queue.

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 12 of 16

Implementation
1st iteration: Starts with A node

Queue content
A Visit A Empty

Goal not reached yet. Continue with 2nd iteration


CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI

Slide 13 of 16

Implementation
2nd iteration:
Start with A Queue content A

A visited & expanded Visit B Visit C

B,C C empty

Goal not found yet, continue to 3rd iteration

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 14 of 16

Implementation
3rd iteration: Starts with node A Queue content

A
A visited & Expanded B,C B visited, expand B D,E,C Visit D E,C Visit E C C visited, expand C D,G Visit D G Visit G empty Goal found. Stop searching.
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Slide 15 of 16

Blind Search CT017-3-1 Introduction to Artificial Intelligence

16
Slide 16 of 16

Basic Concept of AI

Blind Search CT017-3-1 Introduction to Artificial Intelligence

17
Slide 17 of 16

Basic Concept of AI

Blind Search CT017-3-1 Introduction to Artificial Intelligence

18
Slide 18 of 16

Basic Concept of AI

Fig 4.15

The heuristic f applied to states in the 8-puzzle.

ch for the 8-Puzzle problem

19
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Luger: Artificial Intelligence, 6th edition. Pearson Education Limited, 2009 Slide 19 of 16

Fig 4.16 puzzle graph.

State space generated in heuristic search of the 8-

20
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Luger: Artificial Intelligence, 6th edition. Pearson Education Limited, 2009 Slide 20 of 16

Evaluation of blind search


Evaluati Breadth- Depthon first first Time Space Optimal ? Complet e? BD BD Yes Yes BM B*M No No Iterative deepening BD B*D Yes Yes

B = Branching factor
D = Depth of solution (shallowest goal solution) M = Maximum depth of the search tree
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Slide 21 of 16

Research

Go to the library and research the at least 2 additional search techniques (besides the ones covered in the lecture). Your answer should also state when will the search techniques be applied.

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 22 of 16

Tutorial 4
1) Find more information about the optimum and completeness criteria in relation to depth first search.

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 23 of 16

Optimal
In depth first search, algorithm works by traversing to left most branch to the deepest level to find goal state. If the goal state is not found in that left most branch, traversing need be continued to the right branch.

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 24 of 16

Completeness
In general DFS is not complete because it doesnt find any solution that lies beyond the given search depth (infinite depth level)

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 25 of 16

Question & Answer

Any questions?

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 26 of 16

Next topic
Define knowledge Types of knowledge Knowledge representation Introduction to AIML

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 27 of 16

Types of search
Blind search (uninformed search) Without any specific domain knowledge Search without any additional knowledge Breadth-first search Depth-first search Iterative deepening search Bidirectional search Uniform cost search Beam search Branch and bound search Informed search (heuristics) Has some functions to guide the search A* search Best first search Hill climbing search Least cost search
CT017-3-1 Introduction to Artificial Intelligence Basic Concept of AI Slide 28 of 16

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 29 of 16

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 30 of 16

Best-First Search
Combines the advantages of Breadth-First and Depth-First searchs.
DFS: follows a single path, dont need to generate all competing paths. BFS: doesnt get caught in loops or dead-endpaths.

Best First Search: explore the most promising path seen so far.

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 31 of 16

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 32 of 16

CT017-3-1 Introduction to Artificial Intelligence

Basic Concept of AI

Slide 33 of 16

You might also like