public void FastestTripTest() { // Use Gebweb to test https://gebweb.net/optimap/ // 31 Trương phước phan, 10.7756192, 106.6237788 // 435 hoàng văn thụ hồ chí minh, 10.7975076, 106.6558153 // 60 cộng hoà, 10.8011653, 106.657283 // 10 Tân kỳ tân quý hồ chí minh, 10.7922362, 106.605514 // 30 âu cơ hồ chí minh, 10.7877314, 106.64095250000003 // (10.7756192, 106.6237788) // (10.7975076, 106.6558153) // (10.8011653, 106.657283) // (10.7922362, 106.605514) // (10.7877314, 106.64095250000003) // Own Data // (106.6237788,10.7756192) // (106.6558153,10.7975076) // (106.657283,10.8011653) // (106.605514,10.7922362) // (106.64095250000003,10.7877314) var coordinates = new List <Coordinate.Models.Coordinate> { new Coordinate.Models.Coordinate(106.6237788, 10.7756192), new Coordinate.Models.Coordinate(106.6558153, 10.7975076), new Coordinate.Models.Coordinate(106.657283, 10.8011653), new Coordinate.Models.Coordinate(106.605514, 10.7922362), new Coordinate.Models.Coordinate(106.64095250000003, 10.7877314) }; // A to Z TRIP FastestAzTrip fastestAzTrip = new FastestAzTrip(coordinates); List <Coordinate.Models.Coordinate> azTripCoordinates = fastestAzTrip.GetTrip(); // ROUND TRIP FastestRoundTrip fastestRoundTrip = new FastestRoundTrip(coordinates); List <Coordinate.Models.Coordinate> roundTripCoordinates = fastestRoundTrip.GetTrip(); }
public static void FastestTest() { // 31 Trương phước phan, 10.7756192, 106.6237788 // 435 hoàng văn thụ hồ chí minh, 10.7975076, 106.6558153 // 60 cộng hoà, 10.8011653, 106.657283 // 10 Tân kỳ tân quý hồ chí minh, 10.7922362, 106.605514 // 30 âu cơ hồ chí minh, 10.7877314, 106.64095250000003 var coordinates = new List <Coordinate.Models.Coordinate> { new Coordinate.Models.Coordinate(106.6237788, 10.7756192), new Coordinate.Models.Coordinate(106.6558153, 10.7975076), new Coordinate.Models.Coordinate(106.657283, 10.8011653), new Coordinate.Models.Coordinate(106.605514, 10.7922362), new Coordinate.Models.Coordinate(106.64095250000003, 10.7877314) }; Console.WriteLine(); Console.WriteLine("-----------------------------------"); Console.WriteLine("AToZ TRIP"); Console.WriteLine("-----------------------------------"); Console.WriteLine(); FastestAzTrip fastestAzTrip = new FastestAzTrip(coordinates); List <Coordinate.Models.Coordinate> azTripCoordinates = fastestAzTrip.GetTrip(); foreach (var coordinate in azTripCoordinates) { Console.WriteLine($"{coordinates.FindIndex(x => Math.Abs(x.Longitude - coordinate.Longitude) <= 0) + 1} | {coordinate}"); } Console.WriteLine(); Console.WriteLine("-----------------------------------"); Console.WriteLine("ROUND TRIP"); Console.WriteLine("-----------------------------------"); Console.WriteLine(); FastestRoundTrip fastestRoundTrip = new FastestRoundTrip(coordinates); List <Coordinate.Models.Coordinate> roundTripCoordinates = fastestRoundTrip.GetTrip(); foreach (var coordinate in roundTripCoordinates) { Console.WriteLine($"{coordinates.FindIndex(x => Math.Abs(x.Longitude - coordinate.Longitude) <= 0) + 1} | {coordinate}"); } }