ui icon indicating copy to clipboard operation
ui copied to clipboard

RouterTSP does not work and throws exception when calculate TSP for trucks

Open FelixPetzold opened this issue 10 years ago • 0 comments

Versions: OsmSharp v4.2.0.723 .Net 4.5.1

When I calculate a TSP for a truck, I get an exception. Same code but Vehicle.Car and it works. tspSolver.CalculateTSP is the method that is crashing.

Points I requested: Addresses.Add(new PointLatLng(51.6882, 8.69939)); // Wewer, Wasserburg 29 Addresses.Add(new PointLatLng(51.9515971, 8.5717169)); // Aldi Bielefeld Sennestadt Addresses.Add(new PointLatLng(51.7795244, 8.7130426)); // Rewe Sennelager

My code: Vehicle oVehilce = Vehicle.SmallTruck; List<RouterPoint> lGeoCoordinates = new List<RouterPoint>();

foreach (PointLatLng oPoint in Addresses) { RouterPoint oGeoCoordinate = oRouter.Resolve(oVehilce, new GeoCoordinate(oPoint.Lat, oPoint.Lng)); if (oGeoCoordinate != null && oRouter.CheckConnectivity(oVehilce, oGeoCoordinate, 100)) lGeoCoordinates.Add(oGeoCoordinate); }

var tspSolver = new RouterTSPWrapper<RouterTSP>(new RouterTSPAEXGenetic(1000, 200), oRouter, oOsmRoutingInterpreter); Route oRoute = tspSolver.CalculateTSP(oVehilce, lGeoCoordinates.ToArray(), 0, false);

FelixPetzold avatar May 26 '15 06:05 FelixPetzold