I read in the excellent Improving Execution Speed of Models Implemented in NetLogo <http://jasss.soc.surrey.ac.uk/20/1/3.html> that
the statements turtles with [(distance myself < 20) and (color = red)] and turtles with [(color = red) and (distance myself < 20)] produce exactly the same subset, but one may be faster than the other, depending on how many turtles there are, where they are, and how many are red. The differences between these statements in execution time are because they change whether NetLogo (a) first excludes turtles beyond a radius of 20 and then checks the color of the remaining ones, or (b) first excludes all the non-red turtles and then checks the distance of the red ones. I find this explanation surprising. I would have thought the differences in speed are just the basic fact about conjunctions that when the first conjunct is false the second need not be computed. So depending upon the cost of executing each conjunct and the probability that the first conjunct will be false there is an optimal order. But the paper's explanation sounds like 'with' looks to see if the predicate is a conjunction and computes the first example as if it were written turtles with [distance myself < 20] with [color = red]. Is this really the case? -- You received this message because you are subscribed to the Google Groups "netlogo-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
