Banner
Lab 3


Aggregation and Coordination Lab

Winter 2016

Psychology 120


The goal of this lab is to develop a model in which agents can aggregate and coordinate their behavior probabilistically. A classical model of coordination is the flocking model found here. This model uses three rules (scroll down the linked page): separation, alignment, and cohesion. We have built a model of coordination that only uses alignment but passively uses the other two rules. This is how it does it. An agent attempts to align its orientation with all the other agents in its neighborhood. If there are no agents, it just keeps on moving randomly. Separation in our model is already implicitly included when we do not allow agents to occupy the same location. Cohesion is more difficult to see, but consider that whether or not the space is bounded, it is only finite, which implies that agents will, sometimes randomly, come close to each other. As more and more agents begin to move in a coordinated way, they sweep other agents.  Thus, you will notice that for a variety of parameters, large clusters of “flocking” agents emerge over time.

The model we built in class is below:

Aggregate and Coordinate Lab.zip

How to Build the Model

Step 1

Start by making double variables, probabilityOfAggregating and probabilityOfCoordinating  that will control the probability of aggregating or wandering when only aggregate is checked; coordinating or wandering when only coordinate is checked; and aggregating, coordinating, or wandering when both aggregate and coordinated are checked. Put them in the Particles and Environment classes. Make the appropriate get and set methods and pass the value on to each agent as it is created.

Step 2

Next, modify the step method so that, for example, a particle might randomly switch between aggregate and wander. Hint: if(state.random.nextBoolean(probabilityOfAggregating)) {aggregate(state); } else{wander(state);}

	public void step(SimState state) {
		if(aggregate && !coordinate){
			aggregate(state);
		}
		else if(coordinate && !aggregate){
			coordinate(state);
		}
		else if(coordinate && aggregate){
			coordinate(state);
			aggregate(state);
		}
		else {
			wander(state);
		}
	}

Step 3

Debug the program, get it running, then show it to one of us.

Analyze Aggregation and Coordination

In this part of the lab, you will analyze the behavior of the model for different values of parameters for aggregation and coordination.  Write up a brief lab report (due by next Thursday) and answer the following questions with the help of simulation snapshots.

1. How does the size of the search radius affect aggregation? (investigate different sizes and n‘s)

2.  How does the search radius affect Coordination? (investigate different sizes and n‘s)

3. How does the number of agents affect aggregation and coordination? (investigate different sizes and n‘s)

4. What are the effects of boundaries vs. toroidal spaces on aggregation and coordination? (investigate different n‘s)

5. How does varying the probability of aggregation and wandering; coordination and wandering; and aggregation, coordination, and wandering compare across simulations?

Turn in your reports by Thursday by email.