episimmer.agent

class Agent(state, info_dict)[source]

Class for an agent of the simulation.

Parameters
  • state (Optional[str]) – The state of the agent.

  • info_dict (Dict[str, str]) – Information of each agent taken from the agents file.

initialize_state(state, schedule_time_left=None)[source]

Stores the state of the agent in the disease model. Also stores schedule time of agent if model is scheduled.

Parameters
  • state (str) – Current state of the agent in Disease Model

  • schedule_time_left (Optional[int]) – Number of remaining time steps for an agent to exist in the state.

Return type

None

initialize_policy_dict()[source]

Creates a policy dictionary with keys of all the possible policies an agent can experience.

Return type

None

get_policy_state(policy_type)[source]

Used to fetch the current state of agent under specified policy.

Parameters

policy_type (str) – Policy whose state is required.

Returns

State of agent under that policy.

Return type

object

get_policy_history(policy_type)[source]

Used to fetch the current history of agent under specified policy.

Parameters

policy_type (str) – Policy whose history is required.

Returns

History of agent under that policy.

Return type

List[object]

add_contact(contact_dict)[source]

Adds a contact (interaction) to the agents contact_list.

Parameters

contact_dict (Dict[str, str]) – Dictionary containing information for a single interaction.

Return type

None

add_event_result(p)[source]

Adds an event probability that agent has been part of to the event probabilities list.

Parameters

p (float) – Probability of infection for attending an event

Return type

None

new_time_step()[source]

Resets all attributes of agent at the beginning of a time step of the simulation.

Return type

None

update_state()[source]

Stores the next state of the agent if it exists.

Return type

None

set_next_state(state_info)[source]

Updates the next state and scheduled time left

Parameters

state_info (Tuple[str, int]) – Tuple storing next state and scheduled time left

Return type

None

update_receive_infection(p)[source]

Updates agent’s probability to receive infection.

Parameters

p (float) – Probability of receiving infection

Return type

None

update_contribute_infection(p)[source]

Updates agent’s probability to contribute infection.

Parameters

p (float) – Probability of contributing to infection

Return type

None

protect()[source]

Sets the under_protection flag to True. This flag indicates that the Agent is under the protection of a vaccine.

Return type

None