AgentSheets Tutorial

AgentSheets Tutorial:
Modeling Epidemic Spread
Introduction to Agent-Based Modeling
Agent-based modeling is a "bottom-up" approach to the study of phenomena of interest. An agent-based
model simulates autonomous individual components, called agents, that each follow a set rules governing
their behavior and interaction. Simulation of many such agents allows the scientist to study phenomena that
emerge from the functioning of collections of individuals. These simulations can be used in the classroom
as a dynamic representation of concepts, to help students to make the connection from qualitative
description to functional representation.
AgentSheets implements are particular type of agent-based modeling, known as cellular automata, in which
space is represented as consisting of discrete locations on a grid or lattice. The world is treated as twodimensional, with the result looking something like the image below.
Each location on the lattice may simply represent a position in the simulated environment, or they may take
on attributes or carry out actions according to the behaviors and properties they have been programmed
with, and events that occur while the simulation is running.
Agent-Based models provide a pedagogically effective means of introducing computational thinking and
modeling to students. The agents are representations of objects that they are studying in a functional
context, for example, chemical compounds in a reaction, or predators and prey in an ecosystem. The
behaviors of these agents can be represented as simple conditional operators (if-then statements): If:
enzyme is bound to substrate; then: convert substrate to product.
The AgentSheets tool enables students to gain exposure to the notion that, while their computer
understands nothing about the way the world works, they can provide instructions that can make the
computer behave like the phenomenon they are studying. Through the process of observing and thinking
about the underlying cause and effect of the phenomenon students come up with an explanation of how the
process works. AgentSheets makes it very easy to turn this explanation into a functioning model. This
paradigm forces students to confront assumptions that they may have made without knowing it, and to
check that those assumptions are realistic.
Using the controllable environment of the model, students can be guided through a contemporary version
of the scientific method that includes computational modeling as a key component. From the design of
experiments, visualization and analysis of data, interpretation of results, comparison between model
behavior and experimental data, interpretation, model revision, and design of another round of experiments
to repeat the cycle.
What is AgentSheets?
AgentSheets provides an intuitive graphical user interface for building simple agent-based models quickly.
The software and information can be obtained from the AgentSheets website, as well as the Wikipedia
entry. Among the resources available at the AgentSheets website are tutorial movies covering some of the
basic functionality, full software documentation, trial version download, and an online store where you can
purchase a license to unlock the full version of the software.
The intuitive interface and drag-and-drop behavior editing allow AgentSheets to be used by students with
no prior programming or modeling experience. Once a model is built, AgentSheets can render the model in
Java source code and embed it into HTML as a Java applet so that it can be run in any browser without
requiring the AgentSheets software. In addition the Java source code can be used in teaching students
traditional programming.
Building a model with AgentSheets will typically involve the following activities:
 Planning the model based on the functional components or states of the system of interest, as well
as there behaviors and interactions
 Creating agents and depictions
 Editing the agent behaviors
 Building worksheets
 Measuring and plotting data
 Comparing the model behavior to the real system
Planning the Model
Before doing any model building with the computer it is important to do some thinking and planning about
the components and behaviors of the system to be modeled. In order to build an AgentSheets model of
epidemic spread in a population think about how many distinct types of individuals are important to model
this phenomenon, and how those individuals interact and change.
Agents
Ones own personal experience with an infectious disease, like influenza, is an appropriate place to start.
Typically the illness is contracted through contact with somebody that is infected. After an individual is
sick for some number of days they recover. However, exposure to an illness often results in the acquisition
of immunity to the infectious agent so that subsequent exposures don’t lead to full blown infection and
illness. Therefore, a simple model of disease spread in AgentSheets will need to include at least three
different types of individuals: healthy, sick, recovered.
In AgentSheets a couple of other agents are usually needed that serve similar roles in any model. These are
the background and the counter agents. The background agent is the tile floor for the virtual world of the
model. It defines the extent of this virtual world and provides the substrate for functional agents actions.
The counter agent keeps track of how many of the other types of agents are in the model, as well as other
similar tracking and control type functions.
Behaviors
Agents in the model are only able to follow simple rules of the form: If something is true, then do
something else. For the purposes of modeling disease spread, our agents will need to move around and
interact, but not all of the interactions will be important. Consistent with the description above, the agents
can be given the following rules:
1. When a healthy person interacts with a sick person, sometimes the healthy person gets sick
2. After being sick for a while, sick people recover
Having thought a bit about the functionally important agents and behaviors that our model should include,
now we can open AgentSheets and begin modeling.
Building the Model
The first step in creating a model in AgentSheets is to create a new project by selecting "New Project ..."
from the File menu, or clicking on the new project icon;
, which is on the toolbar at the top left corner
of the screen. Use the dialog box that opens to navigate to a directory where you want to place your project.
The default location for this dialog is in the directory that contains the projects that installed with the
AgentSheets software. In many cases you, or your students will not have write privileges for this directory,
so you should navigate to a location where you are sure that you have write privileges, and where you will
be able to easily find your project. Enter a name for your project that will be easy to interpret later, for
example "epidemic", then click "OK". The "Define Agent Size" dialog will open (as shown below), which
allows you to specify the dimensions of the agents in your model in units of pixels.
To change the size click the drop-down arrows and select a size from the list. Try changing the size to 16 x
16 then click "OK". A window will open at the top left of your screen that is titled "Gallery: (name of your
project)", that includes the name you gave your project. The Gallery is where you create and edit agents
and their depictions, as we will see in the next section.
Once you have created your project folder in the desired location you should allow AgentSheets to place
the worksheets that you create for the project in the default location that the software suggests. For details
about the components and organization of an AgentSheets project look at the "Anatomy of a Project"
document for Windows, or Mac OS.
Creating Agents and Depictions
Let's go ahead and create an agent. You can do this by clicking on the "New Agent" button at the bottom of
the Gallery window, or by selecting "New Agent ..." from the Gallery menu. A dialog window will open in
which you should type the name that you want to give to the agent, for this example name this agent
"background". Type the name and hit enter or click "OK". You should now see your newly created agent in
the gallery, which should resemble the image below.
The default graphic for newly created agents is a pixel portrait of the developer of the AgentSheets
software. To change this graphic click the "Edit Depiction" button at the bottom of the gallery. This will
open the depiction editor window shown below.
Click on the "Clear" button at the bottom of the window to clear the image. Then select a color from the
color palette at the top of the window, (a neutral color that can be easily distinguished from the other, active
agents is a good idea). Select the fill tool from the toolbar along the left side of the window, it's the one that
looks like a paint can spilling out red paint. Now click within the image area, where the face image had
been. Your image should be filled with the color you selected.
Now add a border around the edge of this agent's depiction. To do this select a new color that stands out
from your first color. Select the draw rectangle tool, which looks like a white rectangle. Now you will need
to click in one corner of the drawing area and drag across to the opposite corner diagonally and then
release. You should end up with a border around the edge of the drawing area. If it's not right at the edge,
you may need to adjust it so that it won't look odd later. When you are done, click the "Done" button at the
bottom of the window.
An agent can have multiple depictions. Clicking on the "New Depiction" button with an agent selected will
create another depiction for that agent. You should change the graphic for the new depiction so that it will
be easy to tell them apart as you are editing behaviors and when the model is running. Multiple depictions
can be used to represent multiple functional states for a particular type of agent. For example, for a model
of disease spread, an agent representing the people in the population can be created that has healthy, sick
and recovered depictions. Distinct behaviors can be assigned to these depictions so that they behave
differently when the model is running.
Go ahead and create another agent (make sure you click "New Agent" and not "New Depiction") called
"Healthy". In this case the default depiction of a face is appropriate for this agent. In order to make the
person look at home against the background, you can fill the areas around the face with the background
color, and don't forget to include the background border. Images created using graphics software, or
obtained from other sources can also be used by selecting "Import Image ..." from the File menu in the
depiction editor. The gallery window now looks like the image below.
At the bottom of the gallery window is a button that says “New Depiction”. Make sure that the “Healthy”
agent is selected in the gallery (there will be a light blue border around the selected agent) and click the
“New Depiction” button. Give this new depiction the name “Sick”. By default, the new depiction uses the
same depiction as the agent it was created from. This depiction should be changed so that it is easy to
distinguish healthy and sick agents when the model is running. Now that there are two depictions for the
“Healthy” agent, you can select the depictions individually. Select the “Sick” depiction and either click the
“Edit Depiction” button or double click on the depiction to change the it’s appearance with the depiction
editor.
In the depiction editing window you might select green to give the sick depiction an appropriate pallor. The
default green color is not a sickly green, so you can use the "Color Chooser" from the Color menu in the
depiction editor window to customize the color. The color chooser provides multiple ways to select and
adjust the selected color. Once you have a achieved an appropriately sick looking green, select “OK” at the
bottom of the color chooser dialog box. Use the fill tool (paint can) to apply the sickly green to the face of
this depiction. Once you are satisfied with this agents depiction, select “Done”.
In the Gallery window, select “New Depiction” again, and name this depiction “Recovered”. The new
depiction will look the same as the healthy depiction, so it should be adjusted to be easily distinguishable at
actual size (there is a small preview of the actual depiction in the upper right corner area of the depiction
editor window).
Having created the background and three depictions of people we can proceed with adding our rules for
governing the behavior of our agents. We will put off the creation of the counter agent, mentioned above,
until later.
Editing Agent Behaviors
The next step in the modeling process is to input the rules that will govern the behaviors of the agents. In
general this is the component of model building that will require the most thought and planning, most of
which should be done prior to beginning to build the model on the computer. A good practice to establish is
to use pseudo-code, a natural language shorthand for describing the conditions and actions to be carried out
by the computer, to create a complete step-by-step outline of the things that will happen in the model. We
did this for our example in the planning section above. So now we need to implement the rules and
behaviors mentioned there.
The "Background" agents simply serve to demarcate the extent of our simulated world, so they won't need
to do anything, however the people agents will need to move around, with encounters between sick and
healthy people sometimes causing the healthy person to become sick, and sick people eventually
recovering.
In the Gallery window click on the "Healthy" agent to select it, you should see a light blue border around
the selected item. Click the "Edit Behavior" button at the bottom of the Gallery to open the Behavior
window, shown below.
Near the top of the window is a gray method tab that says "While running" this tab denotes a method
which is a collection of rules that are evaluated when some triggering event occurs. In this case "While
running" means that on each interval this block of rules will be evaluated. The fact that this behavior
window belongs to the “Healthy” agent means that this block of rules will be evaluated on each interval for
each person agent that we place in the worksheet that is running (more on worksheets below). To see a list
of triggering events, double-click on the "While running" text.
Below the method tab is an area where you can include a description of what is happening in this method.
As will be described below, methods allow you to assemble a collection of rules to accomplish something
that can't be accomplished in one rule, and to control when those rules are evaluated based on a trigger.
Thorough documentation of what is happening within a method and how it is controlled is good
programming practice. The white triangle to the left of the description box allows you to collapse all of the
rules within a method so that you can just see the methods that comprise an agent’s behavior, along with
their descriptions.
Beneath the description we see a rule. In the red area along the left is the word "If", then an empty white
box called the Conditions box, in the next red area is the word "Then" and then an empty white box called
the Actions box. So each rule could be said as a sentence by saying, "If these conditions are true, then take
these actions." If the conditions for a rule evaluate to false, then AgentSheets proceeds to the next rule. You
can add another rule to the method within which something is selected (the method itself, or a rule,
condition or action), by clicking the "New Rule" button at the bottom of the behavior window.
The other controls in this window include the "New Method" button, which adds a new method to the
behavior window. The "Duplicate" button will make a copy of the selected rule, condition or action
immediately below the selected item. If you make a mistake and need to delete something, drag it to the
trash can icon at the bottom right of the window (or control-click or right-click the element and select
“Delete”). Clicking the "Apply" button will save any changes that you have made in the behavior window,
but leave the window open. Clicking the "OK" button will save changes and close the behavior window.
When you right-click (control-click) on various parts of this window you will get a pop-up menu with items
appropriate for where you clicked.
To see the conditions that can be evaluated, double-click in the Conditions box. This will open the
Conditions palette. Similarly, double-clicking in the Actions box will open the Actions palette. Both
palettes are shown below.
Within the Conditions palette click on the first condition under the word "basic",
, and then click
the "Explain" button at the bottom of the Conditions palette. If you have your sound turned on,
AgentSheets will state how this condition is evaluated as a sentence. If you click on the red dot in the
middle of this condition, you will see that this area is used to specify what agent position on the lattice is
being looked at. Either the position of the agent itself (the red dot), or any of the eight neighboring
positions can be evaluated. The last area that shows an agent depiction that, when clicked on, allows you to
specify what agent depiction is to be looked for. Change these settings and click "Explain" to see how the
condition changes.
First rule – People move around
The first thing to establish, when creating a rule, is, under what conditions do we want this action to
happen. If we always want people to move on each interval, then there should be no condition. Leaving the
condition box empty will ensure that a rule’s actions always occur. When we build our model we will
create a grid of background agents, and people will move on the background. Agents can move in a
particular direction, or they can be told to randomly pick a direction to move in.
In the actions palette click on the “Move random on” action,
, and drag this action into the
actions box of the rule (clicking on adjustable areas of conditions or actions will not allow you to drag
them, you need to click on areas that are not adjustable in order to drag one of these items).
Second rule - When a healthy person interacts with a sick person,
sometimes the healthy person gets sick
If there aren't two rules in the "While running" method go ahead and click the "New Rule" button. For this
rule we only want it to happen under certain conditions: When a healthy person interacts with a sick person.
The behavior that we want to enable with this rule rule is: "sometimes when particles collide they are
annihilated". Making this rule first probably seems counter-intuitive. After all, the particles have to be
moving first in order to collide. Furthermore, if a particle is annihilated that is the last thing it will ever do.
So why shouldn't this rule go last? The answer has to do with the sequential evaluation of rules in
AgentSheets, and the fact that only one rule (and any methods called by it) will be carried out for each
agent on a single time step.
In determining the ordering of rules in AgentSheets it is important to consider the conditions that will be
evaluated. In the case of our example we want particles to move randomly on every time step,
unconditionally. As along as a particle exists, it should move, unless it has collided with another particle
and is annihilated. If we put the rule that checks for a collision first, then any particles that aren't
annihilated will go on to evaluate the next rule which tells them to move. If we reversed the order of the
rules and placed the unconditional movement rule first then all particles would move on every turn and
none of them would ever check for collisions because once the movement action was carried out
AgentSheets would move on to evaluate the next agent.
In order to check for a collision we can use the "Next to" rule. It is the fifth condition in the Conditions
palette, and looks like this:
. Drag the condition into the Conditions box of the first
rule. Two adjustments are needed for this condition. In the default state, when it looks like the image
above, it will evaluate to true if a particle is next to zero "Background" agents. We want it to evaluate to
true if a particle is next to any "Particle" agents. First, click the drop-down next to the equal sign and select
greater than, ">". Next, click on the agent depiction and select the "Particle" depiction. Now this condition,
, will evaluate to true if a particle is next to greater than zero (any) "Particle"
agents.
Remember that the behavior that we want to reproduce with this rule is "sometimes when particles collide
...". AgentSheets has a condition that introduces randomness into the evaluation of a condition. It is the "%
chance" condition,
, and it is near the bottom of the first group of conditions in the
Conditions palette. Drag this condition into the Conditions box with the "Next to" condition. The only
adjustment possible on this condition is the percentage to be used. Enter a value that pleases you.
The only action to be carried out if the two conditions above evaluate to true is "particles are annihilated".
While this sounds exciting, for our purposes it amounts to erasing the particle. The erase action,
the fifth action down in the first grouping in the Actions palette.
, is
Second rule - Particles move randomly in a container
As mentioned above, movement should be unconditional. If a particle exists (i.e. hasn't been annihilated), it
should move. So we don't need to evaluate any conditions for the movement action to take place, we just
need a movement action.
Within the Actions palette click on the action that says "Move random on",
, drag it into the
Actions box of the second rule and release it. This action has only one possible adjustment that specifies
what type of agent can be moved onto. If the "Background" agent depiction isn't selected, go ahead and
select it.
At this point the Behavior window for "Particle" agents should appear as below. If it doesn't, now is the
time to fix it. Remember that clicking on "Apply" saves changes, clicking on "OK" saves changes and
closes the window.
Foundations for Programming
The conditions and actions contained in their respective palettes define the repertoire of what AgentSheets
knows how to do already, these are called primitives. AgentSheets also provides us with a way to enlarge
the repertoire of agents in our model using methods. A method is a collection of rules whose combined
action accomplishes something that can't be carried out in a single rule using the AgentSheets primitives. In
the parlance of computer programming, methods provide a mechanism for abstraction in AgentSheets,
allowing us to combine language primitives in ways to accomplish a variety of tasks and grouping them so
that they can be invoked any time that task is needed. Methods also provide control structures through the
triggering actions that cause them to be evaluated.
Building and Running a Worksheet
Having created our agents and given them behaviors, the next step is to create the simulation itself. That is
to put the agents that we have created together in a way that resembles the system we are trying to
represent, and then to set them in action and allow them to do what they have been instructed to do. In
AgentSheets the action all takes place in worksheets. From the File menu select "New Worksheet". You
can drag the bottom right corner of this window to resize it.
We will use the "Background" agent to define the extent of our simulation. For now we are going to model
a box of randomly moving particles, so the "Background" agents correspond to the box. To add
"Background" agents to the worksheet, first make sure that the "Background" agent is selected in the
Gallery window. In the worksheet window, select the filled rectangle tool,
, from the toolbar down the
left side of the worksheet. Within the drawing area on the worksheet, click-and-drag from just inside one
corner to the opposite corner. You worksheet should look like a tile floor of "Background" agents, as
shown below. If it doesn't, make sure that you have the correct tool and agent selected.
Now we need to add a few of the "Particle" agents to the worksheet. In the Gallery window, make sure that
the "Particle" agent is selected. Then select the pencil tool on the worksheet toolbar. With the pencil tool
you can place individual agents by clicking (and releasing) at a single position, or you can draw with an
agent by clicking and dragging. Use either approach to place a few "Particle" agents on the worksheet.
At this point we are ready to run the simulation, but before running it is important to save the worksheet so
that we can return to this starting state by simply clicking the "Reset" button at the bottom of the worksheet.
The "Reset" button returns you to the last saved state of the worksheet, so if we hit it now we would return
to an empty worksheet. To save the worksheet you can select "Save" from the File menu, or click the save
button,
, on the toolbar. Type a name for your worksheet and click "OK", or hit return. As mentioned
above, you should allow AgentSheets to save the worksheet in the location that it suggests, changing this
location will only cause problems. As an aside, AgentSheets saves changes to the Gallery automatically. It
saves changes to Behaviors when you click the "Apply" or "OK" buttons in that window, but AgentSheets
doesn't allow you to decide where to save those components.
The controls at the bottom left of the worksheet window allow us to run the simulation. The "Stop", "Run"
do what you would expect. The third button, to the right of the "Run" button which looks like this
is
the step button, which allows you to take a single time step in the simulation. To the right of the step button
is the speed slider which allows you to adjust the speed at which the simulation progresses. Next is the
"Reset" button, which as we mentioned above rests the worksheet to it's last saved state. And finally is the
"Clear" button. If you accidentally click this button, you will be glad you have a "Reset" button, unless you
forgot to save your worksheet.
To try different arrangements or starting conditions with your model you can either make changes to a
single worksheet, or you can create additional worksheets. For example, you could create multiple
worksheets with different numbers of particles in them, and see if the time it takes for all (but one) particles
to be annihilated depends on the initial number of particles.
Measuring and Plotting Data
While we have seen our model in action, in most cases we will not only want to observe the model, but to
make quantitative measurements that can be plotted, analyzed and compared to data from the system being
modeled to see how well our model matches the behavior of the real system. Accomplishing this also
provides an opportunity to introduce variables in AgentSheets. In AgentSheets, variables that belong to a
single agent, or local variables, are referred to as attributes. Global variables, which can be viewed and
modified by any agent are referred to as simulation properties.
In our example model we may want to measure and plot the number of particles on each time-step. An
effective way of doing this in AgentSheets is to add another agent that does the counting. This agent will
set a simulation property for counting particles to zero on each time step, and then broadcast a message that
will trigger a method in the "Particle" agent's behavior that causes each "Particle" agent to add itself to the
particle count.
To set up this solution, follow these steps:
 In the Gallery window click "New Agent" and give it a name like "Counter".
 Give this agent a depiction that you are happy with, the "#" symbol reflects this agents job.
 With the "Counter" agent selected click on "Edit Behavior".
 In the Actions palette scroll down to the group of actions under the heading "attributes", and drag








the "Set" action,
, into the Actions box of the rule.
In the first text box of the "Set" action, where it says "value", replace the text with
"@particle_count". The name of our variable is "particle_count", the "@" symbol tells
AgentSheets that this is a simulation property, or global variable.
In the second text box of the "Set" action, replace the expression with 0 (zero). On each time-step
we will first reset the counter to zero than have all the particles add themselves to the count.
In the Actions palette, scroll back up to the group under the heading "messages" and drag the
"Broadcast" action,
, into the Actions box of the rule.
Click the drop-down arrow in the "Broadcast" action (you will probably need to increase the width
of the Behavior window in order to see the drop-down arrows), and select "Particle" from the list.
Replace the text in the text box of the "Broadcast" action with a name that makes sense. This is the
message that you are sending to the "Particle" agents that will tell them to count themselves, so
something like "count" would be appropriate.
The Behavior window for your "Counter" agent should look like the image below. When it does,
click "OK"
In the Gallery window, select the "Particle" agent and click the "Edit Behavior" button.
In the "Particle" Behavior window, click the "New Method" button and resize the Behavior
window so that you can see the new method. Remember that you can also use the white triangle in
the "While running" method to collapse that method.












From the Actions palette under the "attributes" section, drag the "Set" action,
, into the Action box of the rule.
In the first text box of the "Set" action, where it says "value", replace the text with
"@particle_count". Make sure that it is type EXACTLY as you typed it in the "Counter" agent
Behavior window, otherwise AgentSheets will assume that you are referring to a different
variable. You may even want to go back to the other window and copy the name and paste it here,
just to be safe.
In the second text box of the "Set" action, replace the expression with "@particle_count + 1".
When each "Particle" agent executes this action it adds itself to the count.
The Behavior window for your "Particle" agent should look like the image below. Since we didn't
change the "While running" method it should look the same as it did earlier. Make sure the title on
the "New method" tab matches what you titled the Broadcast action for your "Counter" agent. In
this case it should be titled "count" as seen in the image below. Click "OK" to save changes.
In order for any agents behaviors to take occur, that agent must be present in the worksheet. Since
we only want the "Counter" agents behaviors to happen once each time-step, we only need one
copy of this agent in the worksheet. We probably don't want this agent to interfere with the
movement of the particles, so we should place it outside of the grid of "Background" agents.
In the Gallery window, make sure that the "Counter" agent is selected. Select the Pencil tool on
the worksheet toolbar, and place a single "Counter" agent somewhere outside of the grid of
"Background" agents on the worksheet.
Save the worksheet so that the "Reset" button will return to a state that includes the "Counter"
agent.
From the Tools menu, select "SimulationProperties". This will open the Simulation Properties
window. Initially you should see the message "Simulation has no properties" in this window.
On the worksheet, click the step button once. When the "Counter" agent behaviors are executed
the "particle_count" simulation property is created (with a value of 0), and each "Particle" agent
adds itself to the count. When all of the agents have had their behaviors executed once,
AgentSheets stops the simulation, and we should see the number of particles remaining on the
worksheet tallied in the "particle_count".
To plot the particle count, select it in the Simulation Properties window by clicking on it's name.
Then click on the "Plot" button at the bottom of the window.
In the Plot Simulation Property dialog box that opens, click the check box at the top where it says
"Plot property "particle_count"".
In the top text box, where it says "in Window", replace the property name with some thing like
"Particle Count". This doesn't have to resemble the name of the property being plotted, but it does
need to make sense. If you are going to add multiple properties to this plot, you may want to copy








the plot window name to paste it in elsewhere so that misspellings won't result in multiple plot
windows being opened.
The last row of text boxes allows you to specify the minimum and maximum of the Y-axis for the
plot (the X-axis is always the number of time-steps). You can change the maximum to be the
initial number of particles in your worksheet.
The last adjustment in this dialog allows you to specify the color of the line representing this
variable on the plot. You can change it as appropriate. Since I created a blue particle depiction, I
selected blue as my plot color.
The dialog box should resemble the one below. When you are happy with it, click "OK".
The Simulation Property window, like the Worksheet, returns to it's last saved state when the
"Reset" button on the worksheet is clicked. If you want the particle count to reflect the initial
number of particles in the worksheet when it is reset, you may have to type this number into the
"particle_count" value field. In order to save the Simulation Properties window close the window
(by clicking the red button at the upper left of the window on a Mac, or the X close button at the
upper right of the window on a PC). AgentSheets will ask you if you want to save changes, say
yes. If you clicked the "Reset" button before closing the window and saving changes, you may
have to go back and tell AgentSheets to plot your property again.
Re-open the simulation properties window, and click on the step button on the worksheet.
AgentSheets should open a plot window. Adjust your windows so that you can see the worksheet,
Simulation Properties and plot window.
Now click on "Run" and watch your simulation run until there is only a single particle left (this
particle will never disappear given the rules that we have entered). You may want to use the speed
slider to slow down the simulation if everything is happening too fast. Stop the simulation.
In the plot window you will see that this plot is behaving lie a chart recorder, it simply slides the
X-axis along and parameter values are plotted at each time point. If you want to look back at
earlier time points you can use the slider bar at the bottom of the window.
If you right-click (control-click) in the plot window you will see a pop-up menu that allows you to
scale the Y-axis, go to a particular time point on the plot, export data to Excel, or reset the plot
(clear the data). Unlike the Simulation Properties window, the plot window is not reset by the
button on the worksheet window. Given the functionality of the AgentSheets plot window, the
most useful item on this pop-up is the "Export to Excel..." item. Once the data are exported they
can be manipulated and imported into any of a number of data analysis tools.
In any AgentSheets model it is worth giving some consideration to the size of the agent depictions. In cases
where the details of the depiction are providing important information it may be desirable to use larger
depictions. However, in agent-based models, and especially when some of the agents behavior exhibits
randomness, simulating larger numbers of agents will produce measurements that reflect the average
behavior of the system, while smaller numbers of agents will produce measurements that are more strongly
influenced by the randomness in the model.
Saving Your Model as an Applet
If you would like to be able to run your model as a Java applet from within a browser use the "Ristretto"
button on the AgentSheets toolbar, or select "Ristretto..." from the File menu. This will open a dialog that
allows you to specify a title for your applet's web-page, which will appear in the browser title bar, a
destination directory for the applet, and a description that will appear on the page above the applet.
Go Forth and Model!
This tutorial has been intended to give you a brief introduction to agent-based modeling and the
AgentSheets modeling tool. For specific modeling applications you should proceed to a topic specific
AgentSheets model building guide.