Skip to content
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

Returned shortest path not properly randomized in case of many equally short paths #1

Open
nicolaspayette opened this issue Jul 11, 2013 · 0 comments

Comments

@nicolaspayette
Copy link
Member

The doc for link-path and link-path-turtles states:

Follows links at the same depth in random order. If there are multiple shortest paths, a different path may be returned on subsequent calls, depending on the random choices made during search.

This is, however, not the case:

extensions [ network ]
to test
  ca
  cro 4 [ create-link-with turtle ((who + 1) mod 4) ]
  show length remove-duplicates n-values 100 [
    [ network:link-path turtle 2 links ] of turtle 0
  ]
end

...shows 1, as the same path is always taken. If the behavior was as expected, it would show 2, because each of the two possible paths would almost certainly be returned at least once.

Also, the linkPathTurtles and linkPath methods in:

https://github.com/NetLogo/Network-Extension/blob/d4a079bfb2b6d1db1287bf031542ddd4735fd43d/src/Metrics.scala

...don't actually use the random number generator that's passed to them.

It is unclear if this will ever be fixed in the network extension, but the newer nw extension suffers from the same problem (NetLogo/NW-Extension#82) and it will at least be fixed there.

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

No branches or pull requests

1 participant