-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure that results from repeated runs are deterministic #80
Conversation
One way to achieve this is to use ordered dictionaries - unfortunately, these were not available in Python 2.6. |
The attached code does the trick. @ChrisBeaumont - what do you think? |
Maybe make |
Done - I need to try and figure out if and how to add a test for this. |
I think a test is going to be hard, precisely because it's non-deterministic, so let's forget about a test for now. |
As an aside - ordered dictionaries are included in |
I tried that and there was a reason why it didn't work but I can't remember... |
@@ -191,7 +196,7 @@ def next_idx(): | |||
adjacent = [structures[a].ancestor for a in adjacent] | |||
|
|||
# Remove duplicates | |||
adjacent = list(set(adjacent)) | |||
adjacent = _sorted_by_idx(list(set(adjacent))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think list is needed
@ChrisBeaumont - fixed the unnecessary |
Ready to merge |
Ensure that results from repeated runs are deterministic
Here's the output of a simple script:
The output is not always the same which is going to cause issues if users try and reproduce bugs. Also, structure IDs may not always refer to the same structures, which would be an issue. There are several places where dictionaries are used, so this must be what is causing the differences: