Finding positions of milestones given their pairwise distances
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Consider a scenario where you are given only the pairwise distances between several milestones along a route. This data might come from various measurements collected during surveying or acquired via sensors. The challenge is to ascertain the exact positions of these milestones, which can have practical applications in fields such as cartography, robotics (for localization), and even computational biology (e.g., protein structure determination).
Problem Definition
Suppose you have `n` milestones, labeled as . The distances between these milestones are given in a distance matrix , where represents the distance between and . The goal is to determine the positions of these milestones in a coordinate space.
Technical Background
This problem can be framed as the "Distance Geometry Problem" (DGP), which is typically solved using techniques from linear algebra and optimization. Given a complete distance matrix, the aim is to recover a set of points such that their pairwise Euclidean distances match those specified in the matrix.
Requirements and Assumptions
• Distance Matrix: The matrix must be symmetric, i.e., . • Triangle Inequality: To ensure distances are valid in a Euclidean space for three points , , and , it must hold that . • Feasibility: The problem must be feasible in the chosen dimensional space. For instance, in 2D, if points are needed to specify a space, you must ensure that independent distances cannot violate the condition of this space, i.e., they should form a 'rigid' configuration.
Algorithmic Solutions
Multidimensional Scaling (MDS)
A common approach to solve the positioning of milestones given pairwise distances is Multidimensional Scaling (MDS), particularly the metric classical MDS. It translates a matrix of distances into a set of coordinates in a lower-dimensional Euclidean space.
- Double Centring: Compute the matrix , where and denotes a vector of ones.
- Eigen Decomposition: Perform eigen decomposition on matrix to find its eigenvalues and eigenvectors.
- Scaling: Select the top `d` eigenvectors (where `d` is the dimension of the space you are reconstructing, e.g., 2 for a plane), scale them by the square roots of their corresponding eigenvalues to obtain coordinates in the desired dimensionality.
Example
Consider three milestones with matrix :
• Point is on the unit circle whose center is . • is on a circle centered at with radius 2 and at with radius .

