agentsociety.cityagent.initial

Module Contents

Functions

zipf_distribution

Generates employee counts for F companies following Zipf’s law, with total employees N.

bind_agent_info

Binds agent information including IDs for citizens, firms, government, banks and NBS.

Data

API

agentsociety.cityagent.initial.__all__

[‘bind_agent_info’]

agentsociety.cityagent.initial.zipf_distribution(N, F, s=1.0)

Generates employee counts for F companies following Zipf’s law, with total employees N.

  • Description:

    • Uses Zipf’s law to distribute N total employees across F companies

    • The distribution follows a power law where employee count is proportional to 1/rank^s

    • Normalizes the distribution to ensure total employees equals N

  • Parameters:

    • N: Total number of employees across all companies

    • F: Number of companies to distribute employees across

    • s: Power law exponent for Zipf’s law, typically close to 1

  • Returns:

    • List of integer employee counts for each company, summing to N

async agentsociety.cityagent.initial.bind_agent_info(simulation: agentsociety.simulation.AgentSociety)

Binds agent information including IDs for citizens, firms, government, banks and NBS.

  • Description:

    • Gathers all agent IDs and maps them between UUID and agent ID

    • Assigns employees to firms following Zipf’s law distribution

    • Links citizens to government and bank systems

  • Returns:

    • None