Skip to content
Stewart Thomson edited this page Jun 27, 2018 · 4 revisions

Vector<double> LCSS(Matrix<double> trajectory1, Matrix<double> trajectory2, int pointSpacing = -1, double pointDistance = 20, double errorMargin = 2)

Calculates the longest common subsequence for two given trajectories

Returns the current best LCSS value and the translations that created this as a vector

Parameters

Matrix<double> trajectory1 | The first trajectory

Matrix<double> trajectory2 | The second trajectory

The two trajectories must have the same dimensions, but can have a different number of points

int pointSpacing | Integer value of the max index difference between the two trajectories allowed. Negative values set the spacing to unlimited

int pointDistance | A number representing the max distance in each dimension allowed for points to be equivalent

double errorMargin | A number used to scale the accuracy and speed of the calculation

Example

double[,] arr1 = {{0,1,2,3},{0,1,2,3}};
path1 = Matrix.Build.DenseOfColumns(arr1);
double[,] arr2 = {{0,1,2,3},{4,5,6,7}};
path2 = Matrix.Build.DenseOfColumns(arr2);
Vector<double> lcss = LCSS(path1, path2, 2, 2, 0.5);