Beispiel #1
0
    def __init__(self,
                 name,
                 width,
                 height,
                 preact,
                 postact,
                 trans_str=None,
                 model_nm=None,
                 torus=False):

        super().__init__(name,
                         width,
                         height,
                         trans_str=trans_str,
                         torus=False,
                         matrix_dim=2,
                         model_nm=None,
                         preact=preact,
                         postact=postact)

        # sub-models will override these vague names with something
        # meaningful in those models
        # self.state = [X: "sO", Y: "s1"]
        self.line_graph_title = "StanceAgents in %s adopting stance %s"
        self.menu.view.add_menu_item(
            "v", menu.MenuLeaf("(v)iew populations", self.view_pop))
Beispiel #2
0
    def __init__(self,
                 name,
                 width,
                 height,
                 preact=True,
                 postact=False,
                 model_nm=None,
                 props=None):

        super().__init__(name,
                         preact=preact,
                         postact=postact,
                         model_nm=model_nm,
                         props=props)

        self.disp_census = True
        self.width = width
        self.height = height
        self.max_dist = self.width * self.height
        self.scatter_plot = None
        self.plot_title = "Agent Positions"
        # it only makes sense to plot agents in a spatial env, so add this here:
        self.menu.view.add_menu_item(
            "s", menu.MenuLeaf("(s)catter plot", self.plot))
        self.image_bytes = io.BytesIO()
Beispiel #3
0
 def __init__(self, name, length, height, model_nm=None):
     super().__init__("Menger environment",
                      length,
                      height,
                      model_nm=model_nm,
                      preact=True)
     self.menu.view.add_menu_item(
         "v", menu.MenuLeaf("(v)iew trades", self.view_trades))
     self.prod_amt = self.props.get("prop_amt", 1)
Beispiel #4
0
 def __init__(self, name, length, height, model_nm=None,
              preact=False):
     super().__init__(name, length, height,
                      model_nm=model_nm, preact=preact)
     self.market = Market("agora")
     self.graph.add_edge(self, self.market)
     self.menu.graph.add_menu_item("m",
                                   menu.MenuLeaf("(m)arket",
                                                 self.graph_market))
Beispiel #5
0
 def __init__(self, width, height, torus=False,
              model_nm="Big Box Model", props=None):
     super().__init__(width=width, name=model_nm,
                      height=height, torus=torus,
                      model_nm=model_nm, postact=True,
                      props=props)
     self.utils = 0.0
     self.menu.view.add_menu_item("v", menu.MenuLeaf("(v)iew utility",
                                  self.view_util))
     self.add_variety("BigBox")
     self.mom_pop_pop = []
     self.util_hist = []
Beispiel #6
0
    def __init__(self, name, length, height, model_nm=None):
        super().__init__(name, length, height,
                         preact=True, postact=False,
                         model_nm=model_nm)

        self.fshn_f_ratio = self.props.get("fshn_f_ratio",
                                           default=1.3)
        self.fshn_t_ratio = self.props.get("fshn_t_ratio",
                                           default=1.5)

        self.flwr_others = self.props.get("flwr_others",
                                          default=3)
        self.trnd_others = self.props.get("trnd_others",
                                          default=5)

        self.min_adv_periods = self.props.get("min_adv_periods",
                                              default=6)
        self.menu.view.add_menu_item("v",
                                     menu.MenuLeaf("(v)iew fashions",
                                                   self.display))
Beispiel #7
0
 def __init__(self,
              name,
              length,
              height,
              model_nm=None,
              torus=False,
              postact=True,
              props=None):
     super().__init__(name,
                      length,
                      height,
                      model_nm=model_nm,
                      torus=False,
                      postact=postact,
                      props=props)
     # sub-models will override these vague names with something
     # meaningful in those models
     self.stances = ["yes", "no"]
     self.line_graph_title = "StanceAgents in %s adopting stance %s"
     self.menu.view.add_menu_item(
         "v", menu.MenuLeaf("(v)iew populations", self.view_pop))
Beispiel #8
0
 def __init__(self,
              name,
              length,
              height,
              model_nm=None,
              torus=False,
              props=None):
     super().__init__(name,
                      length,
                      height,
                      model_nm=model_nm,
                      torus=False,
                      postact=True,
                      props=props)
     self.stances = ["blue", "red"]
     self.line_graph_title = \
         "A. Smith's fashion model: Populations adopting fashion {} in ".format(self.stances[tp.STANCE_TINDEX])
     self.set_var_color('Hipster', disp.GREEN)
     self.set_var_color('Follower', disp.MAGENTA)
     self.menu.view.add_menu_item(
         "v", menu.MenuLeaf("(v)iew fashions", self.view_pop))
Beispiel #9
0
 def __init__(self,
              name,
              length,
              height,
              model_nm=None,
              torus=False,
              props=None):
     super().__init__(name,
                      length,
                      height,
                      model_nm=model_nm,
                      torus=False,
                      postact=True,
                      props=props)
     self.total_pop = 0  # to be set once we add agents
     self.asset_price = INIT_PRICE  # an arbitrary starting point
     self.price_hist = []
     self.max_abs_pmove = .5
     self.stances = ["buy", "sell"]
     self.menu.view.add_menu_item(
         "v", menu.MenuLeaf("(v)iew asset price", self.view_price))
     self.follower_profit = 0.0
     self.value_profit = 0.0