Skip to content

Commit cca7b8e

Browse files
committed
Uninformed search strategies
1 parent a93eba3 commit cca7b8e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

md/Depth-Limited-Search.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# DEPTH-LIMITED-SEARCH
22

3+
## AIMA4e
4+
5+
__function__ DEPTH-LIMITED-SEARCH(_problem_, _l_) __returns__ a solution, or failure, or cutoff
6+
 _frontier_ ← a FIFO queue initially containing one path, for the _problem_'s initial state
7+
 _solution_ ← failure
8+
 __while__ _frontier_ is not empty __do__
9+
   _parent_ ← pop(_frontier_)
10+
   __if__ depth(_parent_) > l __then__
11+
     _solution_ ← cutoff
12+
     __else__
13+
       __for__ _child_ __in__ successors(_parent_) __do__
14+
         __if__ _child_ is a goal __then__
15+
           __return__ _child_
16+
         add _child_ to __frontier__
17+
 __return__ _solution_
18+
19+
---
20+
__Figure 3.14__ An implementation of depth-limited tree search. The algorithm has two dif-
21+
ferent ways to signal failure to find a solution: it returns failure when it has exhausted all
22+
paths and proved there is no solution at any depth, and returns cutoff to mean there might be
23+
a solution at a deeper depth than l. Note that this algorithm does not keep track of reached
24+
states, and thus might visit the same state multiple times on different paths.
25+
326
## AIMA3e
427
__function__ DEPTH-LIMITED-SEARCH(_problem_,_limit_) __returns__ a solution, or failure/cutoff
528
 __return__ RECURSIVE\-DLS(MAKE\-NODE(_problem_.INITIAL\-STATE),_problem_,_limit_)

md/Iterative-Deepening-Search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ITERATIVE-DEEPENING-SEARCH
22

3-
## AIMA3e
3+
## AIMA3e / AIMA4e
44
__function__ ITERATIVE-DEEPENING-SEARCH(_problem_) __returns__ a solution, or failure
55
 __for__ _depth_ = 0 to ∞ __do__
66
   _result_ ← DEPTH\-LIMITED\-SEARCH(_problem_,_depth_)

0 commit comments

Comments
 (0)