Knowledge spread
Agents
- class scicom.knowledgespread.agents.ScientistAgent(unique_id, model, pos: tuple, topicledger: list, geopos: tuple, birthtime: int, productivity: tuple, opposition: bool = False)
A scientist with an idea.
Each scientist has a geographic position, is related to other agents by a social network, and is intialized with a starttime, that describes the year at which the agent becomes active.
- attendConference()
- moveEpiSpace()
Change epistemic position based on distance in epistemic space.
- moveGeoSpace()
- moveSocSpace(maxDist=1)
Change epistemic position based on social network.
- step()
Agents activity starts after having reached the birthtime.
After initial start, at each step the agents age is increased by one. Each agent has a randomly generated age-dependent activation probability. Moveing happens first due to social connections. If no move due to social connections was possible, a move due to epistemic space search is attempted.
Once the possible activation weight drops below a threshold, the agent is removed from the schedule.
- updateSocialNetwork()
Create new links in agents social network.
Utils
Utility functions for initial condition generation.
- class scicom.knowledgespread.utils.GenerateInitalPopulation(numScientists, timesteps)
Generate sets of initial conditions,
- epistemicFunc(fc, x, y, beta=8)
Epistemic space initial sampling.
- sample(fcE='complex', fcT='saturate', beta=8, slope=5, base=5)
Generate the sample population and add activation time.
- timeFunc(dataframe, step, fcT='saturate', slope=5, base=5)
Population growth function.
- class scicom.knowledgespread.utils.GenerateSocNet(dataframe: DataFrame, minDist: float = 0.0001)
- growEdges(time, density, densityGrowth)
Add edges with weighted preferential attachement.
For a given time, select the current social network, including newly added nodes. Add weights by current degree and distances. Sample a suffiecient number of edges to keep density at a given level.
- growNodes(time, nEdges)
Add nodes with weighted preferential attachment.
For a time step select all new agents. For each agent query all potential edges to previously active agents. Weight these edges with the degree of the previous social network and the distances. From this select N edges for each new agent. Return the concatenated new edges
- initSocNet()
Generates initial social network sample from population.
The dataframe input should contain the colum names: id, x, y, z, t Returns social network sample with from_id, to_id, dist, time
- run(nEdges=4, density=0.2, densityGrowth=0)
- scicom.knowledgespread.utils.ageFunction(agent, a, b, c, radius)
Returns an age dependent radius.
Bell-shaped function with center at c, slop and width of plateau defined by a, b.
Can be used to show age-dependent activity of agents.
- scicom.knowledgespread.utils.epistemicRange(baseRange, age)
Returns the age dependent search radius for epistemic discovery.
Model
- class scicom.knowledgespread.model.KnowledgeSpread(*args: Any, **kwargs: Any)
A model for knowledge spread.
Agents have an initial topic vector and are positioned in epistemic space.
- run(n)
Run model for n steps.
- step()
Run one simulation step.
- scicom.knowledgespread.model.getActiveAgents(model)
Get all agents active at time t.
- scicom.knowledgespread.model.getNetworkStructure(model)
Server
- scicom.knowledgespread.server.agent_draw(agent)
- scicom.knowledgespread.server.agent_draw_altair(agent)
- scicom.knowledgespread.server.chart_draw_altair_agents(model)
- scicom.knowledgespread.server.chart_draw_altair_communities(model)
- scicom.knowledgespread.server.epiSpace_draw_altair(model, agent_portrayal)
- scicom.knowledgespread.server.socialNetwork_draw_altair(model)