How to check if search problem has no solution in depth limit search?

In summary, to check if a search problem has no solution in depth limit search, one must first define the problem and its constraints. Then, a depth limit search algorithm can be implemented to explore the search space within the given limit. If the algorithm exhausts all possible paths without finding a solution, then it can be concluded that the search problem has no solution within the given depth limit. However, if a solution is found within the limit, the algorithm can be terminated and the solution can be returned. This approach can be useful for efficiently handling problems with potentially infinite search spaces.
  • #1
shivajikobardan
674
54
Thread moved from the technical forums to the schoolwork forums
Summary:: standard failure in depth limit search.

Depth-limited search can be terminated with two Conditions of failure:

Standard Failure: it indicates that the problem does not have any solutions.

Cutoff Failure Value: It defines no solution for the problem within a given depth limit.

https://www.analyticsvidhya.com/blog/2021/02/uninformed-search-algorithms-in-ai/

https://www.javatpoint.com/ai-uninformed-search-algorithms

I checked for cut off failure. But I don't know how to check for standard failure. Can you guide me a bit?
Python:
# Python dictionary to act as an adjacency list
graph = {
  '7' : ['19','21', '14'],
  '19': ['1', '12', '31'],
  '21': [],
  '14': ['23', '6'],
  '1' : [],
  '12': [],
  '31': [],
  '23': [],
  '6' : []
}

goal='6'
visited = [] # List of visited nodes of graph.
def dls(visited, graph, node,depth):
    if(depth>=0):
        if node not in visited:
            visited.append(node)
       
        if(node==goal):
            print("goal found")
            print("path to goal=",visited)
            exit()

        for neighbor in graph[node]:
            dls(visited, graph, neighbor,depth-1)       

        print(node)

# Driver Code
print("Following is the Depth-First Search")
res=dls(visited, graph, '7',1)
if(res):
    print("Path to goal node available")
    print("Path",path)
else:
    print("No path available for the goal node in given depth limit ie cut off failure")

print("visited=",visited)
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
shivajikobardan said:
I checked for cut off failure. But I don't know how to check for standard failure. Can you guide me a bit?
Standard failure -- the item you're searching for isn't in the data structure. See what happens if you search for '15'.
Cutoff failure -- the item you're searching for is in the data structure, but you have specified a goal that is deeper in the structure than you are allowing. For example, if you search only to the 2nd level you won't find any of the nodes at the 3rd level.
 
  • Like
Likes shivajikobardan and pbuk
  • #3
Remember I said before that that algorithm performs a traversal not a search? It doesn't search for anything, it simply prints what is there.

If it did perform a search then a 'standard failure' simply means it looked through the whole tree and didn't find the item you are searching for.

Note that I have used the word tree rather than graph: you can't really apply the terms depth-first or breadth-first to a graph that is not connected or is cyclic because there is no ordering.
 

FAQ: How to check if search problem has no solution in depth limit search?

How do I know if a search problem has no solution?

To check if a search problem has no solution, you can use a depth limit search algorithm. This algorithm will search through a limited number of levels in the problem's search space. If no solution is found within the specified depth limit, then it can be concluded that the problem has no solution.

What is the depth limit in a depth limit search?

The depth limit in a depth limit search is the maximum number of levels that the algorithm will search through in the problem's search space. This limit is set by the user and can vary depending on the complexity of the problem.

How does a depth limit search differ from other search algorithms?

A depth limit search differs from other search algorithms in that it has a predetermined limit on the number of levels it will search through. This makes it more efficient for problems with large search spaces, as it avoids getting stuck in an endless loop.

Can a depth limit search algorithm guarantee that a problem has no solution?

No, a depth limit search algorithm cannot guarantee that a problem has no solution. It can only determine that a solution cannot be found within the specified depth limit. There may still be a solution beyond the depth limit that the algorithm was not able to reach.

Are there any drawbacks to using a depth limit search?

One drawback of using a depth limit search is that it may miss potential solutions that are beyond the specified depth limit. Additionally, the depth limit may need to be adjusted depending on the problem, which can be time-consuming and may require trial and error.

Back
Top