Skip to content

Agentpy 0.0.7

Compare
Choose a tag to compare
@jofmi jofmi released this 11 Mar 09:06
· 226 commits to master since this release

Agentpy 0.0.7

Continuous space environments

A new environment type Space and method Model.add_space() for agent-based models with continuous space topologies has been added. There is a new demonstration model Flocking behavior in the model library, which shows how to simulate the flocking behavior of animals and demonstrates the use of the continuous space environment.

Random generators

Model has a new property Model.random, which returns the models’ random number generator of type numpy.random.Generator(). A custom seed can be set for Model.run() and animate() by either passing an argument or defining a parameter seed. All methods with stochastic elements like AgentList.shuffle() or AgentList.random() now take an optional argument generator, with the model’s main generator being used if none is passed. The function AgentList.random() now uses numpy.random.Generator.choice() and has three new arguments ‘replace’, ‘weights’, and ‘shuffle’. More information with examples can be found in the API reference and the new user guide Stochastic processes and reproducibility.

API changes

  • The function sensitivity_sobol() now has an argument calc_second_order (default False). If True, the function will add second-order indices to the output.
  • The default value of calc_second_order in sample_saltelli() has also been changed to False for consistency.
  • For consistency with Space, Grid no longer takes an integer as argument for ‘shape’. A tuple with the lengths of each spatial dimension has to be passed.
  • The argument ‘agents’ has been removed from Environment. Agents have to be added through Environment.add_agents().

Fixes

  • The step limit in animate() is now the same as in Model.run().
  • A false error message in DataDict.save() has been removed.