0% found this document useful (0 votes)
40 views15 pages

Problem Solving & Uninformed Search: Artificial Intelligence

The document discusses various techniques for uninformed search in artificial intelligence problem solving, including: 1) Depth-first search which explores nodes as deeply as possible before backtracking. 2) Breadth-first search which explores all nodes at each level before moving to the next level, always finding the shortest path. 3) Iterative deepening search which combines depth-first and breadth-first search by performing depth-limited searches with increasing depth limits until the goal is found.

Uploaded by

bernad tukan
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)
40 views15 pages

Problem Solving & Uninformed Search: Artificial Intelligence

The document discusses various techniques for uninformed search in artificial intelligence problem solving, including: 1) Depth-first search which explores nodes as deeply as possible before backtracking. 2) Breadth-first search which explores all nodes at each level before moving to the next level, always finding the shortest path. 3) Iterative deepening search which combines depth-first and breadth-first search by performing depth-limited searches with increasing depth limits until the goal is found.

Uploaded by

bernad tukan
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/ 15

Artificial Intelligence

Problem Solving &


Uninformed Search

Gloria Virginia & Matahari Bhakti Nendya

DWCU, Genap 2019/2020

Applying AI Concepts

Computer

Knowledge Inference
Inputs base mechanism Outputs

2
Applying AI Concepts (2)
• Inference mechanism:
– A program that employs search and pattern matching
techniques

• Knowledge base & inference mechanism are separate but


very much interrelated

• The selection of a particular knowledge representation


method will greatly affect the type of search control strategy
used, and vice versa.

Problem Solving by Humans


• Fundamentally is a search process
– More random and less organized approach to problem
solving
– Using one or more algorithms
– Any solution is better than no solution at all
– Good solution is just as acceptable as the best solution,
moreover if the time & cost are less

Problem solving in AI is fundamentally


a search

4
Problem Solving by AI
Steps:
1. Problem formulation
➡ Process of deciding what conditions & states to consider,
given a goal

2. Searching
➡ Process of looking for subsequent stages of a
hypothetical journey (an action sequence)

3. Execution
➡ Implementation of the searching method chosen

Searching
• Is a problem-solving technique that enumerates a problem
space from an initial position in search of a goal position (or
solution)

• The manner in which the problem space is explored is


defined by the search algorithm or strategy

• How well a strategy works is based on the problem at hand


➡ depends on the characteristic of the problem and the
algorithm

6
Searching (2)
• When solving a problem, it’s convenient to think about the problem/
solution space
• The problem of search is to find a sequence of operators that
transition from the start to goal state

• Elements:
1. Problem state
• define the problem situation & existing condition, i.e. the initial state
2. Goal
• the objective to be achieved; can be more than one
3. Operator
• procedure used for changing from one state to another (an
algorithmic subroutine)

Searching (3)
• Problem space representation:

1. State graph/state space

Ø A graph to define problem, visualize a solution, or select a


search method

2. Search tree

Ø A tree diagram of a problem

8
Searching: Strategy
1. Uninformed search strategy
– Blind Search = naive search
– They are given no information other than its definition
– A general purpose search algorithm, operates in a brute-force
way

2. Informed search strategy


– could be a heuristic Search
– Have some knowledge or heuristics of where to look for solutions
– Widely used in optimization problem
– Heuristic: a rule of thumb or problem knowledge

Uninformed Search

1. Generate and Test


2. Random search
3. Depth first search (DFS)
4. Breadth first search (BFS)
5. Non-Deterministic Search
6. Depth-Limited Search (DLS)
7. Iterative Deepening Search (IDS)
8. Bidirectional Search (BIDI)

10
Generate and Test

1. Generate a path serves as potential solution


2. IF solution found THEN done ELSE repeat by trying
another path

• We don’t keep track of what we’ve tried before; just move


ahead with potential solutions

11

Random Search

1. Randomly selects a new state from the current state


2. IF solution found THEN done ELSE randomly select
another new state or operator (leading to a new state)
and continue

12
Notes

• Generate and Test and Random Search are truly blind


methods of search

• They can get lost, get caught in loops, and potentially


never find a solution even though one exists within the
search space

13

Depth First Search


• Begin with the root node then works downward to
successively deeper level
à expand the tree as deep as possible

• Returning to upper levels (backtracking) when needed


• Select a child : left-to-right (convention)

• Problem:
– It can often lead into deeper & deeper sub-network that
are far from the goal node which may exist at a much
higher level

14
Depth First Search (2)
Root node
(Start)
1

2 8 11

3 5 9 12 14

4 6 7 10 13 15 16
Goal
(End)

15

Depth First Search (3)


1. QUEUE ← path only containing the root

2. WHILE QUEUE is not empty


AND goal is not reached

DO remove the first path from the QUEUE;


create new paths (to all children);
reject the new paths with loops;
add the new paths to front of the QUEUE;

3. IF goal reached THEN success ELSE failure

16
Breadth First Search

• Begin with the root node then examine all nodes in each level
before moving onto the next level
à expand the tree layer by layer, progressing in depth,
until goal is reached

• Always find the shortest path

17

Breadth First Search (2)


Root node
(Start)

2 3 4

5 6 7 8 9 10

Goal
(End)

18
Breadth First Search (3)
1. QUEUE ← path only containing the root

2. WHILE QUEUE is not empty


AND goal is not reached

DO remove the first path from the QUEUE;


create new paths (to all children);
reject the new paths with loops;
add the new paths to back of the QUEUE;

3. IF goal reached THEN success ELSE failure

19

Non-Deterministic Search

• Similar with DFS/BFS


• Except that the new paths being added are located
randomly in the stack/queue

20
Non-Deterministic Search (2)
1. QUEUE ← path only containing the root

2. WHILE QUEUE is not empty


AND goal is not reached

DO remove the first path from the QUEUE;


create new paths (to all children);
reject the new paths with loops;
add the new paths in random places in the QUEUE;

3. IF goal reached THEN success ELSE failure

21

Depth-Limited Search

• A modification of Depth First Search (DFS)

• Restrict a DFS to a fixed depth

• Minimize the depth of the tree that the search

algorithm may go

22
Depth-Limited Search (2)
1. DEPTH ← some_natural_number
QUEUE ← path only containing the root;

2. WHILE QUEUE is not empty


AND goal is not reached

DO remove the first path from the QUEUE;


IF path_length ≤ DEPTH THEN
create new paths (to all children);
reject the new paths with loops;
add the new paths to front of the QUEUE;

3. IF goal reached THEN success ELSE failure

23

Iterative Deepening Search

• A derivative of Depth-Limited Search (DLS)

• Combine the feature of DFS and BFS

• Performing DLS with increased depth until the goal is


found

24
Iterative Deepening Search (2)
1. DEPTH ← 1
QUEUE ← path only containing the root;

2. WHILE QUEUE is not empty


AND goal is not reached

DO remove the first path from the QUEUE;


IF path_length ≤ DEPTH THEN
create new paths (to all children);
reject the new paths with loops;
add the new paths to front of the QUEUE;
IF goal is not reached AND open_node in DEPTH is
empty THEN increase DEPTH by 1;

3. IF goal reached THEN success ELSE failure

25

Bidirectional Search

• A derivative of Breadth First Search (BFS)

• Compute the tree using BFS both from the start-node

and from a goal-node, until these searches meet in a

common node (a node visited by both searches)

• When the 2 searches meet in a common node, a path

can be reconstructed from the root to the goal

26
Bidirectional Search (2)
1. QUEUE1 ← path only containing the root;
QUEUE2 ← path only containing the goal;

2. WHILE both QUEUEi are not empty


AND QUEUE1 and QUEUE2 do not share a state

DO remove their first paths;


create their new paths (to all children);
reject their new paths with loops;
add their new paths to back of the QUEUE;

3. IF goal reached THEN success ELSE failure

27

Metrics
1. Time complexity
‣ Measure the worst-case time required to find a solution

2. Space complexity
‣ Measure the memory required during the search

3. Completeness
‣ Measure whether the algorithm find a path of solution

4. Optimality
‣ Measure whether the algorithm find the ‘optimal’ solution
available

28
Big-O Notation
• A common comparison tool for algorithms

• Provides a worst-case measure of the complexity of a search


algorithm

No. Algorithm Time Space Complete Optimal


1 DFS O(bd) O(bd) No/Yes No/Yes
2 BFS O(bm) O(bm) Yes Yes
3 DLS O(bl) O(bl) No/Yes No/Yes
4 IDS O(bm) O(bm) Yes Yes
5 BIDI O(bm/2) O(bm/2) Yes Yes

b = branching factor m = tree depth of solution


d = tree depth l = search depth limit

29

Problem in Uninformed Search

• Combinatorial explosion:
– It occurs when a small increase in the number of elements
that can be combined increase the number of combinations
to be computed so fast that it quickly reaches computational
limits
– So much time taken by blind search

30

You might also like