Skip to content

Add tie breaking mechanism for simultaneous events

Simultaneous events, events with the same timestamp, are executed in an order defined by the scheduler. Running the simulator with the same scheduler and inputs will execute the simultaneous events in the same order every time. It is possible that executing the simultaneous events in a different order may produce a different outcome.

EventSet

This MR adds a new abstract class (EventSet), which represents a set of events with the same timestamp, and provides two implementations of the EventSet interface.

FifoEventSet

This implementation of EventSet reproduces the current behavior of the simulator. It returns events in the same order they were inserted.

RandomEventSet

This implementation (RandomEventSet) uses a RandomVariableStream to randomize the order that events are returned from the event set. The RandomEventSet allows users to run the same simulation with different permutations of simultaneous events to see if the order of events with the same timestamp has an affect on the outcome of the simulation.

Scheduler

The Scheduler base class has been modified so that it is no longer a pure abstract class. The Scheduler base class holds the current EventSet implementation and is responsible for filling the event set with events from the underlying scheduler implementation. This was done to avoid duplicating logic in each Scheduler implementation.

Edited by Peter Barnes

Merge request reports