How to run the ../models/sandpile model.

First we import all necessary files.


In [ ]:
from indra.agent import Agent
from indra.composite import Composite
from indra.display_methods import CIRCLE
from indra.env import Env
from indra.space import DEF_HEIGHT, DEF_WIDTH
from indra.utils import get_props
from models.sandpile import set_up

We then initialize global variables.


In [ ]:
MODEL_NAME = "sandpile"
DEBUG = False  # Turns debugging code on or off

NUM_GROUPS = 4

sandpile_env = None
groups = None
group_indices = None

Next we call the set_up function to set up the environment, groups, and agents of the model.


In [ ]:
(sandpile_env, groups, group_indices) = set_up()

You can run the model N periods by typing the number you want in the following function and then running it.


In [ ]:
sandpile_env.runN()

You can view the position of all of the agents in space with the following command:


In [ ]:
sandpile_env.scatter_graph()

You can view the line graph through the following command:


In [ ]:
sandpile_env.line_graph()