Endu1
Uploaded by
6 SLIDES
25 VIEWS
0LIKES

AI assignment group 1

DESCRIPTION

prepare in powerpoint

Download Presentation

AI assignment group 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WACHEMO UNIVERSITY COLLEGE OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING AND INFORMATICS DEPARTMENT OF INFORMATION TECHNOLOGY COURSE TITLE: ARTIFICIAL INTELLIGENCE Submitted to Mrs. Menbere Hailu Submission Date: 10/07/2016 E.C

  2. 1. Write the definition and the purpose of of the given surching algorithm.  Iterative Deepening Depth-First Search (IDDFS) and Bidirectional Search are two different searching algorithms used to explore and find paths in a graph or tree structure. a.  Iterative Deepening Depth-First Search (IDDFS): Definition: Iterative Deepening Depth-First Search is a combination of depth-first search (DFS) and breadth-first search (BFS) algorithms. It repeatedly performs a depth-first search with an increasing depth limit until the goal node is found. Purpose: The main purpose of IDDFS is to address the drawbacks of both DFS and BFS. It combines the space efficiency of DFS and the completeness of BFS. IDDFS guarantees to find the shortest path in a tree or graph with unit edge costs. It is especially useful when the search space is large and the depth of the goal node is unknown.  b.  Bidirectional Search: Definition: Bidirectional Search is a graph search algorithm that starts searching from both the initial state (source) and the goal state (target) simultaneously. It performs a breadth-first search from both directions and stops when the two searches meet in the middle. Purpose: The primary purpose of Bidirectional Search is to reduce the search space and improve efficiency compared to traditional search algorithms. By searching from both directions, it can significantly reduce the number of nodes explored and reduce the time complexity of the search. Bidirectional Search is particularly useful when the branching factor is high, and the search space is vast. It is often employed in applications where finding the shortest path is crucial, such as route planning and game playing.   Overall, both IDDFS and Bidirectional Search are algorithms designed to improve the efficiency and effectiveness of searching in large graphs or trees. They aim to reduce the time and space complexity of the search while ensuring completeness and finding the shortest path whenever possible. 2. Write Advantages and Disadvantages of the given algorithm. a. Advantages and Disadvantages of Iterative Deepening Depth-First Search (IDDFS): Advantages: i. Completeness: IDDFS guarantees to find a solution if one exists, even in infinite search spaces or with unknown depths. It explores the search space in a systematic manner, gradually increasing the depth limit until the goal is found. ii. Memory Efficiency: Unlike breadth-first search, IDDFS does not require storing an entire level of nodes in memory. It only keeps track of the current path being explored, resulting in lower memory usage. iii. Optimal Solution: When applied to a tree or graph with unit edge costs, IDDFS is optimal and finds the shortest path to the goal node. Page 1

  3. Disadvantages: i. Time Complexity: IDDFS can be time-consuming, especially in scenarios where the depth of the goal node is significantly larger than the initial depth limit. The algorithm may repeat the same search multiple times, resulting in redundant computations. ii. Inefficiency with High Branching Factors: IDDFS may suffer from inefficiency when the branching factor of the search tree is high. It explores all possible paths at each depth level, which can lead to a significant number of redundant explorations. iii. Lack of Heuristics: IDDFS does not incorporate any heuristics or domain-specific knowledge to guide the search. It treats all nodes equally, which can be suboptimal in certain problem domains. b. Advantages and Disadvantages of Bidirectional Search: Advantages: i. Reduced Search Space: Bidirectional Search explores the search space from both the initial state and the goal state simultaneously. By searching from both directions, it can significantly reduce the number of nodes explored and improve efficiency. ii. Faster Solution: In many cases, Bidirectional Search can find a solution faster compared to traditional search algorithms. It exploits the knowledge of both the start and goal states to converge towards a solution more rapidly. iii. Optimal Solution: When used with certain conditions, such as unit edge costs and an admissible heuristic function, Bidirectional Search can find the optimal solution. Disadvantages: 1. Increased Memory Usage: Bidirectional Search requires storing the explored nodes and their connections from both the initial state and the goal state. This can lead to increased memory usage compared to traditional search algorithms. Dependency on Connectivity Information: Bidirectional Search relies on having access to the connectivity information between the initial and goal states. In some cases, obtaining this information may be challenging or computationally expensive. Inefficiency with Complex Heuristics: When using heuristics in Bidirectional Search, finding consistent and admissible heuristics that work effectively from both directions can be difficult. In such cases, the efficiency and effectiveness of the search may be compromised. 2. 3. It's important to note that the advantages and disadvantages mentioned above are general observations and may vary depending on the specific problem domain and implementation details. Page 2

  4. 3. Show how it works with Examples. → Examples of how Iterative Deepening Depth-First Search (IDDFS) and Bidirectional Search work. a. Iterative Deepening Depth-First Search (IDDFS) Example: → Consider the following tree: A / | \ B C / \ E F D | G Let's say we want to find a path from node A to node G using IDDFS. We start with a depth limit of 0 and perform a depth-first search from node A. Since the depth limit is 0, we cannot go beyond the starting node, so we don't find the goal node. We increase the depth limit to 1 and perform another depth-first search from node A. This time, we explore node B and its children E and F. Still, we don't find the goal node. iii. We increase the depth limit to 2 and perform a depth-first search from node A. This time, we explore node C and its children. We still do not find the goal node. iv. Finally, we increase the depth limit to 3 and perform a depth-first search from node A. This time, we explore node D and find the goal node G. i. ii. The path from node A to node G using IDDFS is: A -> D -> G. b. Bidirectional Search Example: → Consider the following graph: A / \ B / \ C / \ D E F G Let's say we want to find a path from node A to node G using Bidirectional Search. We start by performing a breadth-first search from both the initial state (A) and the goal state (G) simultaneously. From A, we explore B and C. From G, we explore F and C. Since both searches meet at node C, we have found a potential path. iii. We now perform a backward search from C towards A, exploring node B. We continue the forward search from C towards G, exploring node G. i. ii. Page 3

  5. iv. The backward search from C reaches node B, and the forward search from C reaches node G. As a result, we have found a path from A to G: A -> C -> G. The path from node A to node G using Bidirectional Search is: A -> C -> G.  In both examples, IDDFS and Bidirectional Search effectively find paths in the given tree and graph, respectively. These algorithms demonstrate their ability to explore the search space efficiently and find solutions in an optimal manner when applicable. 4. Write the algorithms using your preferred programming language → Here an implementation of the algorithms using Python: a. Iterative Deepening Depth-First Search (IDDFS): python def iddfs(graph, start, goal): depth_limit = 0 while True: visited = set() result = dls(graph, start, goal, depth_limit, visited) if result is not None: return result depth_limit += 1 def dls(graph, node, goal, depth_limit, visited): if node == goal: return [node] if depth_limit == 0: return None if node in visited: return None visited.add(node) for neighbor in graph[node]: result = dls(graph, neighbor, goal, depth_limit - 1, visited) if result is not None: return [node] + result return None a. Bidirectional Search: python def bidirectional_search(graph, start, goal): forward_queue = [start] backward_queue = [goal] forward_visited = set([start]) backward_visited = set([goal]) while forward_queue and backward_queue: # Forward search Page 4

  6. forward_node = forward_queue.pop(0) for neighbor in graph[forward_node]: if neighbor not in forward_visited: forward_visited.add(neighbor) forward_queue.append(neighbor) if neighbor in backward_visited: return reconstruct_path(forward_node, neighbor, graph) # Backward search backward_node = backward_queue.pop(0) for neighbor in graph[backward_node]: if neighbor not in backward_visited: backward_visited.add(neighbor) backward_queue.append(neighbor) if neighbor in forward_visited: return reconstruct_path(neighbor, backward_node, graph) return None def reconstruct_path(start, goal, graph): path = [start] while start != goal: for neighbor in graph[start]: if neighbor == goal: path.append(neighbor) return path start = graph[start][0] # Assume single path between start and goal path.append(start) return path Note: These implementations assume that the graph is represented as an adjacency list, where graph is a dictionary where each key represents a node, and the corresponding value is a list of neighboring nodes. Page 5

More Related
SlideServe
Audio
Live Player
Audio Wave
Play slide audio to activate visualizer