22 package org.matsim.core.mobsim.qsim;
24 import java.util.Collection;
25 import java.util.Comparator;
26 import java.util.LinkedHashMap;
27 import java.util.PriorityQueue;
28 import java.util.Queue;
30 import jakarta.inject.Inject;
32 import org.apache.logging.log4j.LogManager;
33 import org.apache.logging.log4j.Logger;
57 30,
new Comparator<Tuple<Double, MobsimAgent>>() {
92 LogManager.getLogger(this.getClass()).info(
"mode: " + agent.
getMode());
93 throw new RuntimeException(
"teleportation does not work when travel time is undefined. There is also really no magic fix for this," 94 +
" since we cannot guess travel times for arbitrary modes and arbitrary landscapes. kai/mz, apr'15 & feb'16") ;
98 if ( withTravelTimeCheck ) {
105 double arrivalTime = now + travelTime ;
106 this.teleportationList.add(
new Tuple<>(arrivalTime, agent));
115 this.teleportationData.put(agentId, agentInfo);
124 teleportationVisData.updatePosition(time);
125 snapshotList.add(teleportationVisData);
136 while (!teleportationList.isEmpty()) {
139 teleportationList.poll();
146 this.teleportationData.remove(personAgent.
getId());
165 teleportationList.clear();
179 if ( dpfac == null || arfac == null ) {
180 log.warn(
"dpfac = " + dpfac ) ;
181 log.warn(
"arfac = " + arfac ) ;
182 throw new RuntimeException(
"have bushwhacking mode but nothing that leads to coordinates; don't know what to do ...") ;
197 double travelTimeTmp = dist / speed ;
199 if ( travelTimeTmp < travelTime ) {
203 return travelTimeTmp ;
boolean handleDeparture(double now, MobsimAgent agent, Id< Link > linkId)
final LinkedHashMap< Id< Person >, TeleportationVisData > teleportationData
OptionalTime getExpectedTravelTime()
Double getExpectedTravelDistance()
DefaultTeleportationEngine(Scenario scenario, EventsManager eventsManager)
InternalInterface internalInterface
void arrangeNextAgentState(MobsimAgent agent)
Collection< AgentSnapshotInfo > addAgentSnapshotInfo(Collection< AgentSnapshotInfo > snapshotList)
DefaultTeleportationEngine(Scenario scenario, EventsManager eventsManager, boolean withTravelTimeCheck)
Facility getDestinationFacility()
final boolean withTravelTimeCheck
MobsimTimer getSimTimer()
final Queue< Tuple< Double, MobsimAgent > > teleportationList
void processEvent(final Event event)
void endLegAndComputeNextState(final double now)
static Double travelTimeCheck(Double travelTime, Double speed, Facility dpfac, Facility arfac)
static double getEuclideanDistance(Coord origin, Coord destination)
void handleTeleportationArrivals(double now)
RoutingConfigGroup routing()
Map< Id< Link >, ? extends Link > getLinks()
void setInternalInterface(InternalInterface internalInterface)
void doSimStep(double time)
boolean isUsingTravelTimeCheckInTeleportation()
Facility getCurrentFacility()
Map< String, Double > getTeleportedModeSpeeds()
EventsManager eventsManager
Id< Link > getDestinationLinkId()
void notifyArrivalOnLinkByNonNetworkMode(final Id< Link > linkId)