MASON-INTEREST-L Archives

June 2005

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Proportional Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Sat, 11 Jun 2005 00:31:15 -0400
MIME-version:
1.0 (Apple Message framework v622)
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Content-type:
text/plain; charset=US-ASCII; format=flowed
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Content-transfer-encoding:
7bit
Comments:
To: MASON Multiagent Simulation Toolkit <[log in to unmask]>
Parts/Attachments:
text/plain (224 lines)
Candy, I modified your example code as follows, and cannot reproduce
the effect you're describing.  the parents and children are randomized
with respect to one another.  Keep in mind that for three children and
three parents, there are 6! = 720 possible shufflings, and of those 72
of them have all the parents and children grouped together.

Sean

---[uses]--------
public class Agent implements sim.engine.Steppable
        {
        public String str;
        public Agent(String s) { str = s; }
        public void step(sim.engine.SimState state)
         {
         System.out.println(str);
         }
        }
----------------

Using BeanShell I dumped in this:


import sim.engine.*;
Schedule schedule = new Schedule(2);
SimState state = new sim.app.heatbugs.HeatBugs(100);  // an arbitrary
SimState

for (int i=0;i<3;i++)
        schedule.scheduleRepeating(schedule.EPOCH,0,
                new Agent("parent " + i), 1);

Steppable reproduction = new Steppable()
        {
        public void step(SimState state)
                {
                for (int i=0;i<3;i++)
                        schedule.scheduleRepeating(schedule.time()+1,0,
                                new Agent("child " + i), 1);
                }
        };

schedule.scheduleRepeating(5,1,reproduction,5);


Here's what I got

bsh % bsh % schedule.step(state);
parent 1
parent 0
parent 2
<true>
bsh % schedule.step(state);
parent 0
parent 2
parent 1
<true>
bsh % schedule.step(state);
parent 1
parent 2
parent 0
<true>
bsh % schedule.step(state);
parent 0
parent 2
parent 1
<true>
bsh % schedule.step(state);
parent 1
parent 0
parent 2
<true>
bsh % schedule.step(state);
parent 0
parent 1
child 1
child 0
parent 2
child 2
<true>
bsh % schedule.step(state);
child 0
child 2
child 1
parent 1
parent 2
parent 0
<true>
bsh % schedule.step(state);
parent 2
child 1
parent 0
child 2
parent 1
child 0
<true>
bsh % schedule.step(state);
parent 1
child 2
parent 2
child 0
child 1
parent 0
<true>
bsh % schedule.step(state);
child 0
child 1
parent 0
child 2
parent 2
parent 1
<true>
bsh % schedule.step(state);
child 0
parent 0
parent 2
parent 1
child 0
child 1
child 2
child 1
child 2
<true>
bsh % schedule.step(state);
parent 0
child 0
child 0
parent 1
child 1
child 2
child 2
child 1
parent 2
<true>
bsh % schedule.step(state);
child 1
parent 1
child 0
parent 0
parent 2
child 2
child 2
child 1
child 0
<true>
bsh % schedule.step(state);
child 2
parent 0
child 1
child 0
parent 2
child 0
parent 1
child 2
child 1
<true>
bsh % schedule.step(state);
child 0
child 1
child 2
parent 0
child 2
parent 1
parent 2
child 1
child 0
<true>
bsh % schedule.step(state);
child 1
child 2
child 0
child 0
parent 2
child 1
child 2
parent 1
child 1
child 0
child 2
parent 0
<true>
bsh % schedule.step(state);
child 1
child 0
parent 2
child 2
child 1
child 2
child 0
child 2
child 1
parent 1
child 0
parent 0
<true>
bsh % schedule.step(state);
child 0
parent 0
child 0
child 1
parent 2
child 0
parent 1
child 2
child 1
child 1
child 2
child 2
<true>
bsh % schedule.step(state);
child 1
child 1
parent 0
parent 1
child 2
parent 2
child 1
child 2
child 0
child 0
child 2
child 0
<true>

ATOM RSS1 RSS2