How to access other agent’s information?¶
Once again this breaks multiprocessing. But you can return an agent’s self and give it as a parameter to other agents.
How to make abcEconomics fast?¶
There is several ways:
- Use pypy3 instead of CPython, it can be downloaded here: https://pypy.org/download.html. With pypy3 you can run the same code as with CPython, but about 30 times faster.
- If you use scipy pypy3 might not work. Use numba instead. http://numba.pydata.org
- Run the simulation with a different number of processes. With very simple agents and many messages one is optimal, with compute intensive agents number of physical processors minus one is usually most efficient. But experimenting even with more processes than physical processors might be worth it.
- Use kernprof to find which agent’s method is slowest. https://github.com/rkern/line_profiler
How to load agent-parameters from a csv / excel / sql file?¶
The list of parameters can be passed as agent_parameters and is passed to init, as keyword arguments:
with open('emirati.csv', 'r') as f:
emirati_file = csv.DictReader(f)
emiratis_data = list(emirati_file)
emiratis = sim.build_agents(Emirati, 'emirati', agent_parameters=emiratis_data)
Note that list(file) is necessary.