2011-10-28

Tortuga

The Tortuga DES provides three implementations of its EventManager interface.
  • A Calendar implementation in delegate-src/src/org/mitre/sim/event/calendar/CalendarImpl.java that's based on the original paper but has discouraging performance related comments.
  • A HashSet implementation in delegate-src/src/org/mitre/sim/event/hashSet/HashSetImpl.java that uses Java's built in hashset.

    The important part (dequeueing) is something like this (GPLv2 licensed, © MITRE corporation): Event result = null; double smallestTime = Double.POSITIVE_INFINITY; for (Iterator i = db.iterator(); i.hasNext(); ) { Event nextEvent = (Event)i.next(); if (nextEvent.getNextTime() < smallestTime) { smallestTime = nextEvent.getNextTime(); result = nextEvent; } } db.remove(result);

    Suffice it to say that evaluating every single event at every single step of the simulation will not get you good performance.

  • A TreeMap based implementation in delegate-src/src/org/mitre/sim/event/treeMap/TreeMapImpl.java. As you might have guessed, this uses the java.util.TreeMap<K,V>. I'm not sure what kind of tree it uses internally, but if it's not a binary heap, performance should be close.
The default event manager is the TreeMap one. Based on the source code I wouldn't call this the most mature of simulators.

I also just realised that I apparently switch from Dutch to English and back every a few posts, so eh, sorry about that. I honestly didn't notice.

Geen opmerkingen:

Een reactie posten