Here's the output:

PARENT
PARENT
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
CHILD
PARENT
CHILD
PARENT

CHILD
PARENT
PARENT
PARENT
CHILD
PARENT
PARENT

CHILD
CHILD
PARENT
PARENT
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
CHILD
CHILD
PARENT
PARENT

CHILD
PARENT
PARENT
CHILD
CHILD
CHILD
PARENT
PARENT
PARENT

CHILD
PARENT
CHILD
PARENT
CHILD
CHILD
PARENT
PARENT
PARENT

PARENT
PARENT
PARENT
CHILD
CHILD
CHILD
PARENT
CHILD
PARENT

CHILD
CHILD
PARENT
CHILD
PARENT
PARENT
PARENT
CHILD
PARENT

CHILD
CHILD
CHILD
PARENT
PARENT
CHILD
CHILD
CHILD
PARENT
PARENT
PARENT

CHILD
CHILD
PARENT
CHILD
CHILD
PARENT
CHILD
PARENT
PARENT
CHILD
PARENT

CHILD
PARENT
CHILD
PARENT
CHILD
PARENT
CHILD
PARENT
CHILD
CHILD
PARENT

PARENT
CHILD
PARENT
PARENT
PARENT
PARENT
CHILD
CHILD
CHILD
CHILD
CHILD

PARENT
PARENT
PARENT
CHILD
CHILD
CHILD
PARENT
CHILD
CHILD
CHILD
PARENT
CHILD
CHILD

CHILD
PARENT
CHILD
CHILD
PARENT
PARENT
CHILD
CHILD
PARENT
CHILD
CHILD
CHILD
PARENT

As you see, the parents and children appear in randomized order, as 
expected.  I hope you can use this code to see why yours behaves 
differently.

Regards,

Liviu.

On Jun 9, 2005, at 7:45 PM, Candy E. Sansores wrote:

> Dear Glean, Sean:
>  
> Basically this is what I´m doing (see code below): schedule each 
> steppable parent, they are not in a sequence, but the are executed 
> randomly, the scheduler suppose to randomly execute the agents. In 
> step 600 I dinamically schedule the children (new agents of the same 
> type as parents) in the same order as parents. The ideal behaviour 
> would be all agents (parents and children) being randomly executed. 
> They are randomly executed by groups, that is: some times all parents 
> are executed first (randomly) and other times childred, that is:
> PARENT3
> PARENT1
> PARENT2
> CHILD3
> CHILD2
> CHILD1
> or
> CHILD2
> CHILD1
> CHILD3
> PARENT2
> PARENT3
> PARENT1
>  
> I would expect all agents scheduled in the same order be executed 
> randomly as a group, at least the data structure that keeps scheduled 
> agents is not dynamic. It seems my new agents (children) are put in 
> the same order but in another list (group). I know a way to solve 
> this, having a dynamic list of agents and scheduling an steppable 
> agent that iterate through the list, the steppable reprodution agent 
> will add children to the list of agents, but I think doing so is 
> against the purpose of Mason fundamentals.
>  
>
> public void start() {
>
>
> for(int i=0;i<initialAgents;i++) {   Agent parent = new Agent(); }
>
>
> schedule.scheduleRepeating(Schedule.EPOCH,0,parent,1);
>
>
> Steppable reproduction = new Steppable() {
>
>       public void step(SimState state) {
>
>
>           for(int i=0;i<numAdultParents;i++) {
>
>               Agent child = new Agent ();
>
>
>               schedule.scheduleRepeating(schedule.time()+1,0,child,1);
>
>            }
>
>      }
>
>
>  };
>
>
> schedule.scheduleRepeating(600, 1, reproduction, 300);
>
>
> }
>
>     
>
> "glen e. p. ropella" <[log in to unmask]> wrote:
>> Sean Luke wrote:
>> >> public Bag agents; // filled with parents and children
>> >> public void step() {
>> >> agents.shuffle(this.random);
>> >> for (int agentNdx=0 ; agentNdx>> 
>> schedule.scheduleOnce(agents.objs[agentNdx]);
>> >> }
>> >> }
>> >
>> >
>> > FWIW, there's a tool which does this already: RandomSequence.
>>
>> Does RandomSequence work for dynamic data structures? It appears from
>> the code:
>>
>> -------------------
>> public Steppable[] steps;
>> [...]
>> for(int x=steps.length-1; x>0 ; x--)
>> {
>> int i = (shouldSynchronize ?
>> nextInt(state,x+1) : state.random.nextInt(x+1));
>> temp = steps[i];
>> steps[i] = steps[x];
>> steps[x] = temp;
>> }
>> super.step(state);
>> --------------------
>>
>> that we're using a fixed size array. And if that's the case, I'd have
>> to recreate the RandomSequence at each cycle, thereby defeating the
>> purpose. But, perhaps I'm just not looking deep enough. To resize an
>> array, you'd have to replace the old Sequence instance variable with a
>> new array (with the new size), right?
>>
>> --
>> glen e. p. ropella =><= Hail Eris!
>> H: 503-630-4505 http://ropella.net/~gepr
>> M: 503-971-3846 http://tempusdictum.com
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com