Blind Search

4.2 Blind Search

In the first section we have shown how a search tree is generated for a state space (cf. Fig. 4.2 c). Of course, in real-world problems such a tree is very big. Therefore, we generate a part of it only, i.e., we generate it till we reach a goal state representing a solution. In the case of our labyrinth problem, however, we can define a search tree representing all the possible tours from the initial state to the goal state as is shown

in Fig. 4.3 a. 8 In Fig. 4.3 a we marked additionally the root node (we start constructing our tree at this node), (some) leaf nodes (nodes which do not have successors) and tree levels determined recursively from the predecessor of each node. The number of child nodes of a given node v is called the rank of v. For example, the rank of the root node A equals 2, because this node has two child nodes (labeled B and C). The rank of any leaf node equals 0.

One can easily notice in Fig. 4.3 a that there are four possible routes to the exit (the state I marked with a double border), 9 namely A-B-C-E-D-F-I, A-B-D-F-I, A- C-B-D-F-I, and A-C-E-D-F-I. (The reader can compare it with the labyrinth shown in Fig. 4.1 b.) The remaining leaf nodes do not represent a solution and can be divided into two groups. The first group represents cul-de-sacs: G and H (cf. Fig. 4.1 b) at the end of paths A-B-C-E-G, A-B-C-E-D-F-H, A-B-D-E-G, A-B-D-F-H, A-C-B-D-F-

H, A-C-B-D-E-G, and A-C-E-G. The second group represents path intersections that have already been visited by us. (We have found a mark made by us with chalk.) In such cases we should go back to a previous point. 10 This is the case for paths

A-B-D-E-C (from point C we can go to A or B only: both points have already been visited, so we should go back to E) and A-C-E-D-B (from point B we can go to A or C only: both points have already been visited, so we should go back to D).

8 Again, from the “perspective of Providence”. 9 Of course, assuming we do not pass through paths we have already visited.

10 According to the old rule of walking in a labyrinth. Otherwise, we can go round in circles.

36 4 Search Methods

(a)

level 0 A root node

level 1 B C

level 2 C D B E

level 5 F H I G H I

leaf nodes

level 6 H I

(b)

Fig. 4.3 Search trees: a a complete search tree for the labyrinth problem, b a search tree for Breadth-First Search

If we had a map in the form of such a tree, we would escape the labyrinth easily. Moreover, we could choose the shortest path to find the exit as soon as possible. However, we do not have such a map. Therefore, we have to generate the tree one node after another, i.e., wander around in the labyrinth in hope of finding the exit. Of course, we should do this in a systematic way. Blind search methods allow us to generate tree nodes in a systematic way. Now, we introduce the most important methods.

Breadth-First Search, BFS , consists of expanding tree paths by generating nodes one level after another, as shown in Fig. 4.3 b. The order in which the nodes are generated is depicted with a dashed line. Let us notice that a complete search tree is not generated all at once, but generation halts at the moment of reaching the goal

4.2 Blind Search 37 Fig. 4.4 Search tree for

Depth-First Search A

state, which represents the solution. In our example the path A-B-D-F-I represents the solution.

Breadth-First Search gives good results if the ranks of the nodes are not too big, i.e., a tree is not “broad” and “shallow”. Otherwise, if we generate nodes across the tree in such a case, we waste a lot of time. If the nature of the problem is such that

there are a lot of direct transitions from any state to other states, 11 then a search tree is just “broad” and “shallow”. In such a case we should use another method, namely Depth-First Search, DFS , which generates only one node of the nth level for a node of the (n − 1)th level. Then, we generate only one node of the (n + 1)th level for

a node of the nth level, etc. For our search tree, an application of the DFS method is shown in Fig. 4.4 . Let us notice that we really explore deeply into the tree. If we reach a leaf node that is not a solution (such as the cul-de-sac node G in Fig. 4.4 ), then we have to move back to the nearest ancestor and continue our exploration from there.

In our example, we have found a solution making only ten steps (including steps performed back from cul-de-sac nodes) with the DFS method, whereas we had to make many more steps with the BFS method (cf. Figs. 4.3 b and 4.4 ). Does this mean DFS has an advantage over BFS in general? Of course not. If the nature of the problem is such that a search tree is unbalanced, i.e., some leaf nodes have a very small level

and some of them have a very big level, 12 then DFS can be not efficient at all. (In 11 In the case of a labyrinth this would mean that there are a lot of alternative paths at each intersection.

12 In case of a labyrinth it would mean that some paths are very long during a search process and some of them are very short.

38 4 Search Methods the case of a labyrinth this can be dangerous. If we try to go along a very long path,

then we can die because of a lack of water, food, etc.) To improve the method the following two modifications have been defined.

In Depth-Limited Search we generate nodes according to the DFS scheme, how- ever only till a fixed level c is attained. 13 If we reach a node of level c, then we treat it as a leaf node and we move back. Such a limitation of the search depth allows us to eliminate very long paths, which are treated as not promising ones.

In order to use Depth-Limited Search effectively we should be able to determine the constant c, which limits a search level. Otherwise, the method can finish a search without finding a solution. In order to protect the method against such a situation we can modify it further. In Iterative Deepening Search [167] we fix a level l, up to which we generate nodes according to the DFS scheme, but if a solution is not found among nodes of levels 0, 1, 2, …, l then we increase the limitation of the search by

1, i.e., till the level l + 1, and we start a search. If a solution is not found with such a parameter, then we increase the limitation of the search by 1 again, i.e., till the level l+

2, and we start a search, etc. At the end of this section, we introduce the Uniform Cost Search method that is based on the well-known shortest-path algorithm introduced by Edsger W. Dijkstra. 14 The method can be treated as a modification of BFS. However, we assume that the

cost of moving from any tree node to any other is known. 15 Then, we move to the node of least cost. Summing up this section, let us notice that if we use blind search strategies, then we search for a solution by the systematic generation of new states and checking whether the solution is found (by chance). 16 Of course, such a strategy is not efficient. Therefore, if we can use knowledge concerning the nature of the problem, then we use heuristic strategies. These are discussed in the next section.

Dokumen yang terkait

Hubungan pH dan Viskositas Saliva terhadap Indeks DMF-T pada Siswa-siswi Sekolah Dasar Baletbaru I dan Baletbaru II Sukowono Jember (Relationship between Salivary pH and Viscosity to DMF-T Index of Pupils in Baletbaru I and Baletbaru II Elementary School)

0 46 5

Institutional Change and its Effect to Performance of Water Usage Assocition in Irrigation Water Managements

0 21 7

The Effectiveness of Computer-Assisted Language Learning in Teaching Past Tense to the Tenth Grade Students of SMAN 5 Tangerang Selatan

4 116 138

the Effectiveness of songs to increase students' vocabuloary at second grade students' of SMP Al Huda JAkarta

3 29 100

The effectiveness of classroom debate to improve students' speaking skilll (a quasi-experimental study at the elevent year student of SMAN 3 south Tangerang)

1 33 122

Kerjasama ASEAN-China melalui ASEAN-China cooperative response to dangerous drugs (ACCORD) dalam menanggulangi perdagangan di Segitiga Emas

2 36 164

The Effect of 95% Ethanol Extract of Javanese Long Pepper (Piper retrofractum Vahl.) to Total Cholesterol and Triglyceride Levels in Male Sprague Dawley Rats (Rattus novergicus) Administrated by High Fat Diet

2 21 50

Factors Related to Somatosensory Amplification of Patients with Epigas- tric Pain

0 0 15

The Concept and Value of the Teaching of Karma Yoga According to the Bhagavadgita Book

0 0 9

Pemanfaatan Permainan Tradisional sebagai Media Pembelajaran Anak Usia Dini untuk Mengembangkan Aspek Moral dan Bahasa Anak Utilization of Traditional Games as Media Learning Early Childhood to Develop Aspects of Moral and Language Children Irfan Haris

0 0 11