public async Task CheckNumberingChanges() { // initialize with a single region of uniformly distributed start coordinates and exponentially // distributed geographic distances // Coordinates of Davis, CA: 38.553889, -121.738056 int clusterSize = 100; double[][] startLocations = GenerateCluster(-121.738556, 38.553389, -121.737556, 38.554389, clusterSize); double[][] endLocations = new double[clusterSize][]; for (int i = 0; i < clusterSize; i++) { endLocations[i] = GenerateEndpoint(startLocations[i][0], startLocations[i][1], 0.0002); } // perform initial cluster analysis and check k LocationClusteringWithMocks clustering = CreateInstance(startLocations, endLocations); await clustering.LocationClustering.RenumberAsync(); int k1 = clustering.LocationClustering.NumberOfClusters; // add another region of legs // Coordinates of San Francisco, CA: 37.783333, -122.416667 int clusterSize2 = 50; double[][] startLocations2 = GenerateCluster(-122.417167, 37.782833, -122.416167, 37.783833, clusterSize2); double[][] endLocations2 = new double[clusterSize2][]; for (int i = 0; i < clusterSize2; i++) { endLocations2[i] = GenerateEndpoint(startLocations2[i][0], startLocations2[i][1], 0.0003); } Array.Resize(ref startLocations, startLocations.Length + startLocations2.Length); Array.Copy(startLocations2, 0, startLocations, startLocations.Length - startLocations2.Length, startLocations2.Length); Array.Resize(ref endLocations, endLocations.Length + endLocations2.Length); Array.Copy(endLocations2, 0, endLocations, endLocations.Length - endLocations2.Length, endLocations2.Length); SetupLegLocationMocks(startLocations, endLocations, clustering); await clustering.LocationClustering.RenumberAsync(); int k2 = clustering.LocationClustering.NumberOfClusters; Assert.NotEqual <int>(k2, k1); }
private static void SetupLegLocationMocks(double[][] startLocations, double[][] endLocations, LocationClusteringWithMocks locationClustering) { SetupLegLocationMocks(startLocations, endLocations, locationClustering.LegRepository, locationClustering.GeocodingDbSync); }