Search Strategies
Search Strategies
Search Strategies
o Steepest-Ascent hill-climbing:
c. Else if not better than the current state, then return to step2.
o Step 5: Exit.
o Step 2: Loop until a solution is found or the current state does not
change.
o Step 5: Exit.
3. Stochastic hill climbing:
Stochastic hill climbing does not examine for all its neighbor before
moving. Rather, this search algorithm selects one neighbor node at
random and decides whether to choose it as a current state or examine
another state.
2. Plateau: A plateau is the flat area of the search space in which all the
neighbor states of the current state contains the same value, because of
this algorithm does not find any best direction to move. A hill-climbing
search might be lost in the plateau area.
Solution: The solution for the plateau is to take big steps or very little
steps while searching, to solve the problem. Randomly select a state
which is far away from the current state so it is possible that the
algorithm could find non-plateau region.
3. Ridges: A ridge is a special form of the local maximum. It has an area
which is higher than its surrounding areas, but itself has a slope, and
cannot be reached in a single move.
Simulated Annealing:
Dijkstra's Algorithm
Step 1: Start at the ending vertex by marking it with a distance of 0, because it's 0
units from the end. Call this vertex your current vertex, and put a circle around it
indicating as such.
Step 2: #Identify all of the vertices that are connected to the current vertex with an
edge. Calculate their distance to the end by adding the weight of the edge to the
mark on the current vertex. Mark each of the vertices with their corresponding
distance, but only change a vertex's mark if it's less than a previous mark. Each time
you mark the starting vertex with a mark, keep track of the path that resulted in that
mark.
Step 3: Label the current vertex as visited by putting an X over it. Once a vertex is
visited, we won't look at it again.
Step 4: Of the vertices you just marked, find the one with the smallest mark, and
make it your current vertex. Now, you can start again from step 2.
Step 5: Once you've labeled the beginning vertex as visited - stop. The distance of
the shortest path is the mark of the starting vertex, and the shortest path is the path
that resulted in that mark.
Let's now consider finding the shortest path from your house to Divya's house to
illustrate this algorithm.
Application
First, we start at the ending vertex (Divya's house). Mark it with a zero and call this
vertex the current vertex, putting a circle around it, as you can see on the graph:
The next step is to mark any vertices that are connected to Divya's house by an
edge with the distance from the end. Let's quickly calculate these distances while we
look at a visual representation of what's going on using our previous graph:
Movie theater = 0 + 4 = 4
Grocery store = 0 + 5 = 5
Gas station = 0 + 6 = 6
We're now done with Divya's house, so we label it as visited with an X. We see that
the smallest marked vertex is the movie theater with a mark of 4. This our new
current vertex, and we start again at step 2.
Now, we mark any vertices connected by an edge to the movie theater, by adding
the weight of the connecting edge to the movie theater's mark. Since Divya's house
is marked as visited, we don't need to consider this vertex.
Depth limited search is the new search algorithm for uninformed search. The
unbounded tree problem happens to appear in the depth-first search algorithm, and
it can be fixed by imposing a boundary or a limit to the depth of the search domain.
We will say that this limit as the depth limit which makes the DFS search strategy
more refined and organized into a finite loop. We denote this limit by l and thus this
provides the solution to the infinite path problem that originated earlier in the DFS
algorithm. Thus, Depth limited search can be called an extended and refined version
of the DFS algorithm. In a nutshell, we can say that to avoid the infinite loop status
while execution of the codes, depth limited search algorithm is being executed into a
finite set of depth called depth limit.
Algorithm
This algorithm essentially follows a similar set of steps as in the DFS algorithm.
When we compare the above steps with DFS we may found that DLS can also be
implemented using the queue data structure. In addition to each level of the node
needs to be computed to check the finiteness and reach of the goal node from the
source node.
If we fix the depth limit to 2, DLS can be carried out similarly to the DFS until the goal
node is found to exist in the search domain of the tree.
Algorithm of the example
1. Now we will check whether the current node is lying under the depth limit
specified earlier or not.
If the answer is yes: Then we explore the node further and save all of its successors
into a stack.
Advantages:
Disadvantages:
o The main drawback of IDDFS is that it repeats all the work of the
previous phase.
Example:
Completeness:
Time Complexity:
Let's suppose b is the branching factor and depth is d then the worst-case
time complexity is O(bd).
Space Complexity:
Optimal:
IDDFS algorithm is optimal if path cost is a non- decreasing function of
the depth of the node.
Advantages:
Disadvantages:
Example: