Uh oh, AFTER my email you were wondering? :-)
Basically: the schedule works by advancing to the timestep of the
minimally-scheduled Steppable. It then removes all the Steppables
which are scheduled at that timestep. Then it sorts them by their
"ordering", and breaks ties by shuffling randomly. Then it goes
through all those Steppables, in the resultant order, and step()s them
one by one.
So what's the difference between having the Schedule shuffle elements
randomly and just using a RandomSequence? Simply this: in a
RandomSequence you submit all the Steppables at one time to the
Schedule, all in one array. But what if you provide Steppables at
various times as they show up, and then they all get stepped? That's
where shuffling is helpful -- it breaks the deterministic nature of
the heap submission algorithm. That's all.
On Oct 14, 2009, at 8:22 PM, Maíra Athanázio Gatti wrote:
> Hi Sean,
> I have never used setShuffling and after your email I was wondering
> what is the difference between it and a RamdonSequence.
> On Wed, Oct 14, 2009 at 2:48 PM, Sean Luke <[log in to unmask]> wrote:
> I added setShuffling because I was asked on this list to enable a
> way for elements entered for the same timestep to be removed from
> the Schedule in a predictable order (that is, no shuffling of those
> elements). However while the order is *predictable* it is by no
> means *expected* -- since the Schedule uses a binary heap
> underneath, it is *not* the case that elements will be stepped in
> the order in which they were inserted in the Schedule in the first
> place (though it is *sometimes* the case). Because of the high
> possibility for misunderstanding, and the very low value (I think)
> in having the feature, I'm thinking of deleting setShuffling
> entirely and requiring that objects be shuffled.
> Any opinions?
> Maíra Athanázio de C. Gatti
> PhD student, PUC-Rio, Brazil
> King's College London