2012-05-17

Fix for latest bug

The issue I mentioned last week, with the simulation not ending when all of the entities were finished was fixed. Originally I thought I could fix this by simply setting the simulationBound to some incredibly high numer (Long.MAX_VALUE-1 or something like that) and the simulation would spontaneously stop after the last event was processed, but for some reason that didn't work.

The solution I'm using now is slightly cludgy, with each of the entities reporting back to the model when they're finished and the model doing something like this:

 @Override
 public synchronized void done() {
  runningNodes--;
  
  if(runningNodes == 0) {
   ParallelEventSystem.mayFinish();
  }
 }
. This seems to work pretty well. If I wanted to I could even put the print of the time it took in this function, it would probably be more accurate. I'll try that next.

Geen opmerkingen:

Een reactie posten