Information Technology Reference
In-Depth Information
Algorithm 5
Multi-threaded event-driven simulation engine using a
node-level/per agent/dynamic
partitioning strategy.
Require:
Use partitioning strategy
s
partition = informed(
A
,T,s,∅
)
futureEvents = [
0 : StartEvent
]
now = timeOfFirstEvent(futureEvents)
while
futureEvents not empty AND now ¡ end
do
now = timeOfFirstEvent(futureEvents)
currentEvents = futureEvents.eventsAt(now)
for all
ActionEndEvent
e
in currentEvents
do
Action
x
of agent
A
corresponding to event
e
is executed
successfully
Use thread
t
= partition(
A
) for computing corresponding
state changes
end for
for all
EnvironmentalEvent
e
in currentEvents
do
Update environment and check constraints
end for
for all
AgentEvent
e
in currentEvents
do
Relay event
e
to agents
end for
for all
ActionStartEvent
e
in currentEvents
do
check constraints
(using additional information)
AND handle
violated constraints
end for
if
partitionUpdateNecessary()
then
partition = informed(
A
,T,s,
partition)
end if
end while