[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on partitioning a set of agents.
From: |
Theodore C. Belding |
Subject: |
Re: Question on partitioning a set of agents. |
Date: |
Sun, 8 Aug 1999 13:20:33 -0400 (EDT) |
Sorry --- I misunderstood what you were trying to do and misread
equiprobable partitions to be "equal-sized partitions". If you're trying
to do that (divide the agents into N equal-sized partitions), you can
still use the Shuffler, as in my earlier message. If you're just trying to
divide up the agents into N partitions, with an equal probability for each
partition, and you don't care about keeping partition sizes equal, then
just go through the list and roll an N-sided die (pick a random int from 1
to N) for each object to pick its partition; there's still no need to make
multiple passes through the list.
-Ted
--
Ted Belding address@hidden
University of Michigan Center for the Study of Complex Systems
Homepage: http://www-personal.umich.edu/~streak/
PGP key: http://www-personal.umich.edu/~streak/pgp-key.html
On Fri, 6 Aug 1999, Jason Alexander wrote:
> For one of my models I need to randomly partition a set of agents
> (stored as a list) into N disjoint classes, where each class is
> equiprobable.
>
> Are there any implicit biases in the following procedure that I'm
> unaware of? (It seems okay to me.)
>
> Let L denote the list of agents.
> Assume RandomFloat() return a number between 0 and 1.
>
> for i=1 upto N-1 {
> loop over L {
> if RandomFloat < 1/N {
> remove current agent from L
> insert current agent into class i
> }
> }
> }
> Copy remaining agents from L into class N.
>
>
> Cheers,
>
> Jason
>
>
> ==================================
> Swarm-Modelling is for discussion of Simulation and Modelling techniques
> esp. using Swarm. For list administration needs (esp. [un]subscribing),
> please send a message to <address@hidden> with "help" in the
> body of the message.
> ==================================
>
==================================
Swarm-Modelling is for discussion of Simulation and Modelling techniques
esp. using Swarm. For list administration needs (esp. [un]subscribing),
please send a message to <address@hidden> with "help" in the
body of the message.
==================================