First we import all necessary files.
In [ ]:
import random
from models.bigbox import set_up
We then initialize global variables.
In [ ]:
from indra.agent import Agent
from indra.composite import Composite
from indra.display_methods import BLACK, BLUE, GRAY, GREEN, RED, TAN, YELLOW
from indra.env import Env
from indra.space import DEF_HEIGHT, DEF_WIDTH
from indra.utils import get_props
MODEL_NAME = "bigbox"
NUM_OF_CONSUMERS = 50
NUM_OF_MP = 8
DEBUG = False
CONSUMER_INDX = 0
BB_INDX = 1
HOOD_SIZE = 2
MP_PREF = 0.1
PERIOD = 7
STANDARD = 200
MULTIPLIER = 10
EXPENSE_INDX = 0
CAPITAL_INDX = 1
COLOR_INDX = 2
town = None
groups = None
mp_pref = None
hood_size = None
bb_capital = 2000
period = None
store_census = None
# The data below creates store types with default values.
# "Store type":
# [expense, capital, color]
mp_stores = {"Bookshop": [65, 90, TAN],
"Coffeeshop": [63, 100, BLACK],
"Grocery store": [67, 100, GREEN],
"Hardware": [60, 110, RED],
"Restaurant": [60, 100, YELLOW]}
Next we call the set_up function to set up the environment, groups, and agents of the model.
In [ ]:
(town, groups) = set_up()
You can run the model N periods by typing the number you want in the following function and then running it.
In [ ]:
town.runN()
You can view the position of all of the agents in space with the following command:
In [ ]:
town.scatter_graph()
You can view the line graph through the following command:
In [ ]:
town.line_graph()