Dirk Hennsen
Dirk Hennsen

Reputation: 135

OMNeT++: Different results for simulation repetition using the same seed

Used Versions: OMNeT++ 5.0 with iNET 3.4.0


Using OMNeT++ I'm running some simulation with a big amount of repetitions. In some cases I don't understand the behaviour of my system, so I want to watch the procedure using Qt. Therefore I need the repeat some special cases of the previously simulated repetitions.

Even though I use the exact same configuration-file in combination with the corresponding seedset, I don't get the desired repetion, so I get completly different results. What can be the reason for that?

Analyzing the header of the generated log-files, there are only differences in the following lines:

run General-107342-20170331-15:42:22-5528
attr datetime 20170331-15:42:22
attr processid 5528

All other parameters are matching exactly. I don't understand why the results are different. Is the processid relevant for behavior like this?

Upvotes: 0

Views: 687

Answers (1)

Rudi
Rudi

Reputation: 6681

Some tips to nail down the problem:

  • Check if the difference is indeed caused by the Graphical/Non-graphical difference. Run your simulation with both:

$ mysim -r 154 -u Cmdenv

$ mysim -r 154 -u Qtenv

$ mysim -r 154 -u Tkenv

Check the results. Different results may be caused by several issues:

  • relying on undefined behavior in C++, like you have a (set) collection and you iterate over it. The order of the collection is undefined and it can throw the simulation to a different trajectory
  • Accessing uninitialized memory
  • Using data that is available only in graphical runtime, like using the positions of the nodes defined by the @displayString property. Node positions may change based on the layouting algorithm and layouting is not available in Cmdenv
  • Changing the model state while testing whether the model is running under a graphical runtine i.e. inside if (isGUI()) {} blocs.

First I would try to figure out whether this is related to GUI vs non-GUI or rather the use of undefined behavior. If Tkenv and Qtenv gives the same result while Cmdenv differes, then it is a GUI-nonGUI issue. If all of them is different I would suspect a memory issue or undefined behavior.

If everything else fails, run the simulation in both Cmdenv and Qtenv and turn on event logging. Compare the logs and see where the two trajctories start to diverge and debug both run around that point to see the cause of divergence.

Upvotes: 2

Related Questions