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

First we import all necessary files.


In [ ]:
import math
from operator import gt, lt
from models.fashion import set_up

We then initialize global variables.


In [ ]:
import numpy as np

from indra.agent import Agent, X_VEC, Y_VEC, NEUTRAL
from indra.agent import ratio_to_sin
from indra.composite import Composite
from indra.display_methods import NAVY, DARKRED, RED, BLUE
from indra.env import Env
from indra.registry import get_env, get_group, get_prop
from indra.space import in_hood
from indra.utils import init_props

MODEL_NAME = "fashion"
DEBUG = True  # turns debugging code on or off
DEBUG2 = False  # turns deeper debugging code on or off

NUM_TSETTERS = 5
NUM_FOLLOWERS = 55

ENV_WEIGHT = 0.6
weightings = [1.0, ENV_WEIGHT]

COLOR_PREF = "color_pref"
DISPLAY_COLOR = "display_color"

BLUE_SIN = 0.0
RED_SIN = 1.0

# for future use as we move to vector representation:
BLUE_VEC = X_VEC
RED_VEC = Y_VEC

NOT_ZERO = .001

TOO_SMALL = .01
BIG_ENOUGH = .03

HOOD_SIZE = 4

FOLLOWER_PRENM = "follower"
TSETTER_PRENM = "tsetter"

RED_FOLLOWERS = "Red Followers"
BLUE_FOLLOWERS = "Blue Followers"
RED_TSETTERS = "Red Trendsetters"
BLUE_TSETTERS = "Blue Trendsetters"

opp_group = None

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


In [ ]:
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("Society", members=groups)
.runN()

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


In [ ]:
Env("Society", members=groups)
.scatter_graph()

You can view the line graph through the following command:


In [ ]:
Env("Society", members=groups)
.line_graph()