MATSIM
Public Member Functions | Private Member Functions | Private Attributes | List of all members
org.matsim.pt.UmlaufInterpolator Class Reference

Public Member Functions

 UmlaufInterpolator (Network network, final ScoringConfigGroup config)
 
void addUmlaufStueckToUmlauf (UmlaufStueckI umlaufStueck, Umlauf umlauf)
 

Private Member Functions

void insertWenden (Id< Link > fromLinkId, Id< Link > toLinkId, Umlauf umlauf)
 

Private Attributes

final Network network
 
final LeastCostPathCalculator routingAlgo
 

Detailed Description

Definition at line 39 of file UmlaufInterpolator.java.

Constructor & Destructor Documentation

◆ UmlaufInterpolator()

org.matsim.pt.UmlaufInterpolator.UmlaufInterpolator ( Network  network,
final ScoringConfigGroup  config 
)

Definition at line 44 of file UmlaufInterpolator.java.

References org.matsim.core.router.DijkstraFactory.createPathCalculator(), and org.matsim.pt.UmlaufInterpolator.network.

44  {
45  super();
46  this.network = network;
47  FreespeedTravelTimeAndDisutility travelTimes = new FreespeedTravelTimeAndDisutility(config);
48  this.routingAlgo = new DijkstraFactory().createPathCalculator(network, travelTimes, travelTimes);
49  }
final LeastCostPathCalculator routingAlgo
Here is the call graph for this function:

Member Function Documentation

◆ addUmlaufStueckToUmlauf()

void org.matsim.pt.UmlaufInterpolator.addUmlaufStueckToUmlauf ( UmlaufStueckI  umlaufStueck,
Umlauf  umlauf 
)

(also make sure that they are physically connected on the network)

Definition at line 54 of file UmlaufInterpolator.java.

References org.matsim.api.core.v01.Id< T >.equals(), org.matsim.pt.UmlaufStueckI.getCarRoute(), org.matsim.api.core.v01.population.Route.getEndLinkId(), org.matsim.api.core.v01.population.Route.getStartLinkId(), org.matsim.pt.Umlauf.getUmlaufStuecke(), and org.matsim.pt.UmlaufInterpolator.insertWenden().

54  {
55  List<UmlaufStueckI> existingUmlaufStuecke = umlauf.getUmlaufStuecke();
56 
57  // check if final link of last umlaufStueck and first link of new umlaufStueck are connected; otherwise compute and insert connecting route:
58  if (! existingUmlaufStuecke.isEmpty()) {
59  UmlaufStueckI previousUmlaufStueck = existingUmlaufStuecke.get(existingUmlaufStuecke.size() - 1);
60  NetworkRoute previousCarRoute = previousUmlaufStueck.getCarRoute();
61  Id<Link> fromLinkId = previousCarRoute.getEndLinkId();
62  Id<Link> toLinkId = umlaufStueck.getCarRoute().getStartLinkId();
63  if (!fromLinkId.equals(toLinkId)) {
64  insertWenden(fromLinkId, toLinkId, umlauf);
65  }
66  }
67 
68  existingUmlaufStuecke.add(umlaufStueck);
69  }
void insertWenden(Id< Link > fromLinkId, Id< Link > toLinkId, Umlauf umlauf)
Here is the call graph for this function:

◆ insertWenden()

void org.matsim.pt.UmlaufInterpolator.insertWenden ( Id< Link fromLinkId,
Id< Link toLinkId,
Umlauf  umlauf 
)
private

Definition at line 71 of file UmlaufInterpolator.java.

References org.matsim.core.router.util.LeastCostPathCalculator.calcLeastCostPath(), and org.matsim.api.core.v01.network.Network.getLinks().

Referenced by org.matsim.pt.UmlaufInterpolator.addUmlaufStueckToUmlauf().

71  {
72  Node startNode = this.network.getLinks().get(fromLinkId).getToNode();
73  Node endNode = this.network.getLinks().get(toLinkId).getFromNode();
74  double depTime = 0.0;
75  Path wendenPath = routingAlgo.calcLeastCostPath(startNode, endNode, depTime, null, null);
76  if (wendenPath == null) {
77  throw new RuntimeException("No route found from node "
78  + startNode.getId() + " to node " + endNode.getId() + ".");
79  }
80  NetworkRoute route = RouteUtils.createLinkNetworkRouteImpl(fromLinkId, toLinkId);
81  route.setLinkIds(fromLinkId, NetworkUtils.getLinkIds(wendenPath.links), toLinkId);
82  umlauf.getUmlaufStuecke().add(new Wenden(route));
83  }
Path calcLeastCostPath(Node fromNode, Node toNode, double starttime, final Person person, final Vehicle vehicle)
final LeastCostPathCalculator routingAlgo
Map< Id< Link >, ? extends Link > getLinks()
Here is the call graph for this function:

Member Data Documentation

◆ network

final Network org.matsim.pt.UmlaufInterpolator.network
private

◆ routingAlgo

final LeastCostPathCalculator org.matsim.pt.UmlaufInterpolator.routingAlgo
private

Definition at line 42 of file UmlaufInterpolator.java.


The documentation for this class was generated from the following file: