title: Time Independent Discrete Event Simulation
body: <p>I am trying to design a discrete event simulation where the execution of an event is independent of time. Choosing what event comes next is dependent only on the conditions of the model (in my case, a person), and they're executed one at a time.</p>
  
  <p>I have found a couple of designs out there:</p>
  
  <ul>
  <li><p>Event Scheduling - A queue of events is kept and during each event execution, new events are scheduled or old ones cancelled.</p></li>
  <li><p>Activity Scanning - During each cycle, all the events are iterated through, and if the current state of the person satisfies the event's conditions for execution, that event is executed.</p></li>
  <li><p>Graph of Events - Have a graph of events, and have each edge represent the conditions of the transition.</p></li>
  </ul>
  
  <p>The considerations I have for each of the methods are the following:</p>
  
  <ul>
  <li><p>Event Scheduling - The logic of what event should be added is distributed across the events, making it hard to keep track of. Moreover, the queue would get changed a lot, and because it's not time based, you'd have to iterate through the entire queue each time you want to make changes to find the event(s) to remove (for example, if you wanted to remove event B when preceded by two event A's). </p></li>
  <li><p>Activity Scanning - The performance of it could be bad, especially if it has to iterate through many events to find the next one to execute during each cycle.</p></li>
  <li><p>Graph of Events - If the graph is extremely large, initializing it and setting up all the edges could become cumbersome.</p></li>
  </ul>
  
  <p>I wanted your opinions on which method might be the most suitable, and if so, in what ways I could address the considerations stated. Maybe a completely different design might be appropriate.</p>