| |
- add_switch(agent, old_group, new_group)
- Switch an agent between groups.
- create_agent(name, i, action=None, **kwargs)
- Create an agent that does almost nothing.
- create_exec_env(save_on_register=True, create_for_test=False, exec_key=None)
- Create a new execution environment and return its key.
- def_action(agent, **kwargs)
- A simple default agent action.
- exists_neighbor(agent, pred=None, exclude_self=True, size=1, region_type=None, **kwargs)
- Does a neighbor exists within `size` matching `pred`?
Returns True or False.
- get_agent(agt_nm, exec_key)
- Fetch an agent from the registry based on agent name.
Return: The agent object, or None if not found.
- get_agent_at(self, x, y)
- Return agent at cell x,y
If cell is empty return None.
Always make location a str for serialization.
- get_distance(a1, a2)
- Find the distance of a1 and a2. If one of them are out of space,
FAR_AWAY will be return.
- get_even(exec_key=None, **kwargs)
- Get the even.
- get_group(agent, grp_nm)
- Groups *are* agents, so:
It's a separate func for clarity and in case one day things change.
- get_model(agent)
- Get the model which is a special singleton member of the registry.
- get_neighbor(agent, pred=None, exclude_self=True, size=1, region_type=None, **kwargs)
- Get one neighbor who passes pred
- get_neighbors(agent, pred=None, exclude_self=True, size=1, region_type='Moore', model_name=None)
- Get the Moore neighbors for an agent.
We might expand this in the future to allow von Neumann hoods!
- get_num_of_neighbors(agent, exclude_self=False, pred=None, size=1, region_type=None, **kwargs)
- Gen number of neighbors filtered by pred
- get_periods(agent)
- Get the pophist (timeline) period from the model's env
- get_prop(exec_key, prop_nm, default=None)
- Have a way to get a prop through the model to hide props structure.
- get_user_type(user_api=None)
- Retrieve user type from env
- in_hood(agent, other, hood_sz)
- Check whether agent and other are within a certain distance
of each other.
- init_props(module, props=None, model_dir=None, skip_user_questions=False)
- initilize props
- join(agent1, agent2)
- Create connection between agent1 and agent2.
agent1 should be a group.
- neighbor_ratio(agent, pred_one, pred_two=None, size=1, region_type=None, **kwargs)
- Returns the ratio of neighbors of one type (specified by pred_one)
to all neighbors.
If pred_two is passed, it will return ratio of pred_one to pred_two.
- prob_state_trans(curr_state, states)
- Do a probabilistic state transition.
- ratio_to_sin(ratio)
- Take a ratio of y to x and turn it into a sine.
- reg_model(model, exec_key)
- The model is a special singleton member of the registry.
- switch(agent_nm, old_group, new_group, exec_key)
- Move agent from grp1 to grp2.
We first must recover agent objects from the registry.
|