Open digitaldust opened 6 years ago
Thanks for reporting! I've managed to reproduce it, but it seems to be some sort of interaction between nw:load-graphml
and layout-spring
. On its, nw:load-graphml
affects the RNG as expected. Still diagnosing, but will hopefully have it fixed for the next version.
@qiemem I am not sure the layout is responsible, even if you comment it out and do like:
to setup3
ca
random-seed 1
nw:load-graphml "random-exact-50-4-106.graphml"
;repeat 10 [layout-spring turtles links 0.2 5 1]
nw:set-context turtles links
ask turtles [setxy random-xcor random-ycor]
end
you can clearly see that things are not fixed as per the seed, but changes every time you call setup3
. This does not happen if you import the data as a csv file for instance, so I really think load-graphml is wrong in some way...
@qiemem closed because solved?
Yup! It was importing the nodes in a non-deterministic order, so which agent id got matched up with which node was different each import. So, it wasn't actually messing with the RNG, but resulted in similar symptoms.
@qiemem that’s great! Is there any chance to access a fixed version of nw? Sorry for the newbie question, I really need to run some experiments but I am not really confident with the git workflow in these cases...
Sure. Here you go: https://www.dropbox.com/s/ugxxt7fhvqah3wm/nw.zip
@qiemem thanks a ton, I see the patch works if I just read the graphml file in... still if you call layout-radial after importing then the ordering is not preserved, so maybe also layout-radial is doing the same stuff? anyway thanks a ton for now, I can run my experiment and have reproducible results now... 👍
I fixed the problem of deterministic turtle creation, but apparently link creation order is still non-deterministic. Depending on your application, this may or may not affect results. I should be able to fix this additional problem in the next few days.
I think there is a problem with random seed if nw:load-graphml is invoked.
If you create a network like this, you can set the random seed and every time you call the procedure you have a network in the same exact position:
same applies if you create the network from scratch using the nw extension:
however, if you try to load from a graphml file, every time you have the network with a different layout - and this applies with a graphml that I have generated as well as the graphml file used in the nw guide:
See also the discussion here to find a netlogo model and graphml files that demonstrate the issue.