Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me in this task. Task : Nearest Neighbor Search: Datasets: There are three datasets: Restaurant, Shop, and Parking Datasets. Each dataset consists of
Please help me in this task.
Task : Nearest Neighbor Search:
Datasets: There are three datasets: Restaurant, Shop, and Parking Datasets. Each dataset
consists of D points, stored in a text file with the following format:
dots
Each line includes a unique ID for a point and its geographical coordinates, longitude and
latitude. For example, an entry in the Shop dataset, such as id x
y precisely indicates the location of a shop, with representing longitude and
y representing latitude.
Queries: We have users interested in finding the nearest facilities. Their locations are
provided in a text file formatted identically to the datasets:
id x y
id x y
id x y
For example, id x y indicates a users location.
Program Design:
Select ONE dataset Restaurant Shop, or Parking
Find the nearest facility restaurant shop, or parking lot for each query using the
following algorithms:
Sequential Scan Based Method: Calculate the distance between a query point
to every point in the selected dataset to find the nearest neighbor.
Best First BF Algorithm: Construct an Rtree for the selected dataset. Then, apply the BF algorithm using the Rtree to find the nearest neighbor for each query point.
BF with DivideandConquer: Firstly, divide the dataset into two subspaces based on X dimension or Y dimension then construct an Rtree for each subspace. Use the BF algorithm to find the nearest point to the query in each subspace. Finally, compare the distance between the nearest points delivered from each subspace to determine the final nearest neighbor in the entire dataset.
Output: For each algorithm Sequential Scan Based, BF Algorithm, and BF with Divide andConquer display and output the following information in a single txt file:
The ID x and y coordinates of the nearest neighbor identified for each query point egid x y for query
The total running time for processing all queries and the average time per query ie divide the total running time by
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started