20 package org.matsim.core.mobsim.qsim;
22 import java.util.Comparator;
24 import java.util.Queue;
25 import java.util.concurrent.PriorityBlockingQueue;
27 import jakarta.inject.Inject;
29 import org.apache.logging.log4j.LogManager;
30 import org.apache.logging.log4j.Logger;
47 private final Queue<AgentEntry>
wakeUpList =
new PriorityBlockingQueue<>(500,
48 Comparator.comparingDouble((AgentEntry o) -> o.time).thenComparing(o -> o.agent.getId()));
53 this.delegate =
new ActivityEngineDefaultImpl(eventsManager);
60 log.warn(
"running onPrepareSim");
66 while (!wakeUpList.isEmpty() && wakeUpList.peek().time <= now) {
67 final AgentEntry entry = wakeUpList.poll();
69 entry.agentWakeup.executeOnWakeup(entry.agent, now );
100 if (!act.
getType().contains(
"interaction")) {
101 wakeUpList.addAll(preplanningEngine.generateWakeups(agent, now));
134 static class AgentEntry {
141 this.agentWakeup = agentWakeup;
154 this.personId = personId;
159 return "agentWakeup";
169 Map<String, String> attr = super.getAttributes();
void setInternalInterface(InternalInterface internalInterface)
void rescheduleActivityEnd(final MobsimAgent agent)
final Id< Person > personId
Id< Person > getPersonId()
static final String COMPONENT_NAME
boolean handleActivity(MobsimAgent agent)
boolean handleActivity(MobsimAgent agent)
final EventsManager eventsManager
void setInternalInterface(InternalInterface internalInterface)
MobsimTimer getSimTimer()
final Queue< AgentEntry > wakeUpList
void processEvent(final Event event)
InternalInterface internalInterface
void rescheduleActivityEnd(MobsimAgent agent)
void doSimStep(double time)
final ActivityEngine delegate
final PreplanningEngine preplanningEngine
void doSimStep(double now)
void executeOnWakeup(MobsimAgent agent, double now)
Map< String, String > getAttributes()