Introduction to Artificial Intelligence|Course hero helper

Posted: March 4th, 2023

CS 4332 Introduction to Artificial Intelligence

Project 2 – A* Search and Bi-Directional A* Search

Get your paper done on time by an expert in your field.
plagiarism free


Search is an integral part of AI. It helps in problem solving across a wide variety of domains where a solution isn’t immediately clear. You will implement a graph search algorithm with the goal of solving bi-directional search.


Submit the file in Blackboard. The deliverable for the assignment is this ‘’ file with the necessary functions/methods completed. No other Python source files need to be submitted.


Also include snapshots of the output of your program and the generated graph showing the search results in your submission.

The Files

While you’ll only have to edit and submit, there are a number of notable files:

1. Where you will implement your bi-directional A* Search.

2. : Sample tests to validate your searches locally.

3. romania_graph.pickle : Serialized graph files for Romania.

4. : A wrapper around networkx that tracks explored nodes.  FOR DEBUGGING ONLY

5. : Module to visualize search results. See below on how to use it.

6. : Module used by visualize graph to read OSM networks.

The Assignment

Your task is to implement an informed search algorithm that will calculate a driving route between two points in Romania with a minimal time and space cost. There is a file to help you along the way. We will be using an undirected network representing a map of Romania.


Notes There are some things that are among our most common questions:

· Remember that if start and goal are the same, you should return []. This keeps your results consistent with ours and avoids some headache.

· Most ‘NoneType object …’ errors are because the path you return is not completely connected (a pair of successive nodes in the path are not connected). Or because the path variable itself is empty.

· Individual tests can be run using the following:

import search_submission_tests as tests


· For running the search tests, use this:

import search_submission_tests as tests

testclass = tests.TestBasicSearch()



A* search

The implemented A* search uses Euclidean distance as the default heuristic, which is implemented in function euclidean_dist_heuristic(). It is passed to a_star() as the heuristic parameter. We provide null_heuristic() as a baseline heuristic to test against when calling a_star tests.



1. You need to include start and goal in the path.

2. If your start and goal are the same then just return [].

3. The above are just to keep your results consistent with our test cases.

4. You can access all the neighbors of a given node by calling graph[node], or graph.neighbors(node) ONLY.

5. You can access the weight of an edge using: graph.get_edge_weight(node_1, node_2). Not using this method will result in your explored nodes count being higher than it should be.

6. You can access the (x, y) position of a node using: graph.nodes[n][‘pos’]. You will need this for calculating the heuristic distance.

Bidirectional A* search

Implement bidirectional A* search. Remember that you need to calculate a heuristic for both the start-to-goal search and the goal-to-start search.

bidirectional_a_star() should return the path from the start node to the goal node, as a list of nodes.



· A* Search

Links from Udacity, below the videos:

· Reach for A∗: An Efficient Point-to-Point Shortest Path Algorithm

· Computing the Shortest Path: A∗ Search Meets Graph Theory



Artificial Intelligence (AI) is a branch of computer science that aims to create machines that can perform tasks that would typically require human intelligence, such as visual perception, speech recognition, decision-making, and language translation. AI systems can be programmed to learn and improve through experience, enabling them to adapt to new situations and perform more complex tasks. There are various types of AI, including rule-based systems, machine learning algorithms, and deep learning models. Rule-based systems use a set of pre-defined rules to make decisions or perform tasks. Machine learning algorithms, on the other hand, learn from data and use statistical models to make predictions or decisions. Deep learning models use artificial neural networks, which are inspired by the structure and function of the human brain, to learn from large amounts of data and perform complex tasks such as image and speech recognition.

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price: