City Search – v1.0

For this assignment, we created three search algorithms to find routes between cities, or points, on a map.

Each algorithm is slightly different, however, they all have the same basic structure. Starting at an origin city, the neighboring ("connected") cities are loaded into a queue with a certain cost (distance, for example). The lowest cost city is opened next, and its neighboring cities are added to the queue.

Uniform Search

Uniform search is the simplest of them all. As each city is loaded into the queue, the cost is calculated by finding the distance between the current city and the neighboring city. When the target city is found, a route is declared. The cost for the route is the sum of all the distances traveled between the cities.

Greedy Search

Greedy search is also relatively simple. Instead of queued cities being sorted by the distance between this and the next, they are sorted by the distance from the target city (as the crow flies). This can lead to some wildly expensive results. For example, the next city may be close to the target city, but the distance to get there is overly expensive.

A* Search

A-star searches combine the two searches from above; that is, the cost is the distance between the current city and next, plus the distance from the target city (again, as the crow flies). Of these three search algorithms, A* is widely considered the fastest and most efficient. This is because the search is "guided" by the distance to the target, so it doesn't start searching in the opposite direction of the target city.


Comments

Popular updates

Half Moon Project Part 2 - More Accuracy

NumberVision – Machine Learning Application

Machine Learning & Half Moon Project