Re: Randomness in Player/Stage simulation results
alex <[email protected]>
| Newsgroups | gmane.science.robotics.playerstage |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: > Hi. I've been running simulations (multiple robots > performing obstacle avoidance and exchanging messages) in > Player/Stage, and I notice that my code always gives > slightly different results each time I run it. > > Where does this randomness come from? Is there a random > seed generated somewhere deep within the code, or behind > the scenes? From a purely theoretical POV, I'd expect to > get identical results each time I run the experiment, and > that I would need to introduce some stochasticity into my > simulations in order to get a different result. > > Does anyone have any guidance? I guess that as long as we're not using hard real-time OSes, simply timing differences across runs will cause differences in the outcome. Different CPU loads will cause different thread scheduling; if message passing is via network there'll be also different delays in the message arrivals, and so on... In player/stage this is to be expected, with stage running its simulation threads and player its driver threads, and the client another looping thread still. In my experience, the opposite is true: to get exact repeatable results the easiest way is to use a single thread for everything to force a fixed sequencing, and even then take care of any I/O with anything out of your thread memory. Another source of discrepancies could be floating precision... unless you're using fixed point. ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first