Skip to content

reduce unwanted randomness#371

Merged
kainagel merged 6 commits intomasterfrom
kn/reduceUnwantedRandomness
Apr 21, 2026
Merged

reduce unwanted randomness#371
kainagel merged 6 commits intomasterfrom
kn/reduceUnwantedRandomness

Conversation

@kainagel
Copy link
Copy Markdown
Collaborator

@kainagel kainagel commented Apr 21, 2026

I had repaired the tests in RunFabilandTest so that they deterministically passed on my local machine. However, on the build server they failed. Inspection of the output revealed that, in the matsim plans that came from silo and entered in the year one matsim simulation, some of the persons had other home location coordinates. Presumably, the Moves model was not deterministic in the sense that it produced different results on different machines. I did the following:

  1. change all HashMap to LinkedHashMap to make iterations over the containers independent from hardware. This did not fix my issue, but I think that it is in general useful.
  2. remove the multi-threading in MovesModelImpl. THIS ACTUALLY FIXED THE PROBLEM, i.e. the Moves model now returns the same result on the build server as on my local machine. The multi-threading in that method was not dependent on some separate config parameter, but was programmed as a side-effect of TransportModelPropertiesModule.TravelTimeImplIdentifier.MATSIM. I thus switched off the multi-threading completely in that class; if someone wants to be able to switch it on by a separate parameter, please go ahead and add the corresponding code.
  3. I am also trying to reduce non-final static variables, since they are known to cause such problems. Either make them non-static (i.e. instance variables) if possible, or try to make them final.

@kainagel kainagel changed the title replace all HashMap by LinkedHashMap. With the former, the sequence … reduce unwanted randomness Apr 21, 2026
@kainagel kainagel added this pull request to the merge queue Apr 21, 2026
Merged via the queue into master with commit 26e4f95 Apr 21, 2026
17 checks passed
@kainagel kainagel deleted the kn/reduceUnwantedRandomness branch April 21, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant