public void ConnectWithRoadNetwork() { /* Set this to true if you want to use real waypoints instead of intermediate ptstops, remember to also change the use_waypoints value in the HTTPRequests.cs file */ bool use_waypoints = false; int i = 1; float delta = 0.1f; foreach (Carpooler P in CarPoolers) { log.Info(i + "/" + CarPoolers.Count + " Adding carpooling ride id:" + P.Id + " Name:\"" + P.Name + "\" Provider:" + P.Provider + " Departure:" + P.WayPointsOrig.First().Latitude + "," + P.WayPointsOrig.First().Longitude + " Destination:" + P.WayPointsOrig.Last().Latitude + "," + P.WayPointsOrig.Last().Longitude + " TripDate:" + P.TripDate + " TripStartTime:" + P.TripStartTime + " to the RoadNetwork"); /* Find the closest PTstop inside the map along the carpooling ride (but only if the Carpooling ride starting point is outside the map) */ //Commented because actually we are ONLY considering carpooling rides included into the map //setNewDeparturePoint(P, delta, i); /* Set the closest PT stops to the departure and to the destination points */ /* Route planner does not use waypoints, it uses the PT stops */ if (use_waypoints == false) { setTheClosestPTstops(P, i); } HiddenMarkovModelMapMatcher MapMatcher = new HiddenMarkovModelMapMatcher(ref RoadNetwork, P.WayPointsUsed); if (use_waypoints == true) { /* Route planner uses waypoints */ List <RNode> Nodes = MapMatcher.Match(); for (int j = 0; j < Nodes.Count; j++) { log.Info("Stops: " + (j + 1) + "/" + Nodes.Count + " - " + Nodes[j].Point.Latitude + "," + Nodes[j].Point.Longitude); } ConnectNodesWithRoadNetwork(P, Nodes); } else { /* Route planner does not use waypoints, it uses the PT stops */ List <TNodeCarpooling> Nodes = MapMatcher.MatchTNodeCarpooling(); for (int j = 0; j < Nodes.Count; j++) { log.Info("Stops: " + (j + 1) + "/" + Nodes.Count + " \"" + Nodes[j].StopName + "\" - " + Nodes[j].Point.Latitude + "," + Nodes[j].Point.Longitude); } ConnectNodesWithRoadNetworkTNode(P, Nodes); } RoadNetwork.AddCarpooler(P); i++; } if (use_waypoints == true) { RoadNetwork.ConnectCarpools(); } else { RoadNetwork.ConnectCarpoolsTNode(); } }
public List <RNode> BuildCarpoolRoutesFromPoints(List <Point> Points) { HiddenMarkovModelMapMatcher MapMatcher = new HiddenMarkovModelMapMatcher(ref RoadNetwork, Points); return(MapMatcher.Match()); }