First we import all necessary files.
In [ ]:
import random
from models.used_cars import set_up
We then initialize global variables.
In [ ]:
from indra.utils import get_props
from indra.agent import Agent
from indra.composite import Composite
from indra.space import DEF_HEIGHT, DEF_WIDTH
from indra.env import Env
from indra.display_methods import RED, BLUE
MODEL_NAME = "used cars"
DEBUG = True # turns debugging code on or off
DEBUG2 = False # turns deeper debugging code on or off
DEF_NUM_BLUE = 10
DEF_NUM_RED = 10
MAX_CAR_LIFE = 5
DEALERS = "Dealers"
buyer_grp = None
dealer_grp = None
env = None
Next we call the set_up function to set up the environment, groups, and agents of the model.
In [ ]:
(env, dealer_grp, buyer_grp) = set_up()
You can run the model N periods by typing the number you want in the following function and then running it.
In [ ]:
env.runN()
You can view the position of all of the agents in space with the following command:
In [ ]:
env.scatter_graph()
You can view the line graph through the following command:
In [ ]:
env.line_graph()