NetLogo – A multi-agent programmable modeling environment
ccl.northwestern.edu
ccl.northwestern.edu
https://austingwalters.com/modeling-and-building-robotic-sea...
We then showed how (using netlogo) how when another neural circuit for aggressive behavior was added (but the connections of the markov chain had yet to be trained) the sea slugs. After adding the aggressive circuit and letting generations live and die using a genetic algorithm - it appeared to observers like the animals became social. I.e. only the territorial sea slugs remained, and they wouldn’t attack ones of the same species, this proved to be the best for “survival”.
The goal of the work was to provide insight into what neural circuits can lead to social behavior. Specifically, what environmental conditions can lead to an evolutionary trait that triggers social like behaviors.
Honestly, idk if you can make any “claims”, but it was a fun undergraduate project. The best part is we exported the trained models from the Netlogo program, then imported them into a lego robot. At which point our robot had learned to be aggressive - I.e. would “chase” people away from the food source.
Well, the results are reproducible, and the constraints of the model are clearly defined in the code.
So you might not be able to generalize claims, but in some sense it is also better than many papers out there because you can be more precise about discussing flaws in the model than with empirical data.
They had to run the model millions of times so I had to build NetLogo on our HPC cluster running Rocks OS and write some magic config in slurm to run it and it took for ever because about 1/3 of the jobs would fail because they ran out of ram and would need to be run again.
I’m not sure how much of it was the grad students fault or NetLogos fault but either way, the experience was quite painful
Some groups are also trying to target sequential, parallel and, say, GPU execution from the same model specification language, which could actually help with the usability of running such simulations in practice.
Therefore, if we were to use a multiprocessing setup, we would have to be able to lock the world object when a process is writing to it; and furthermore, find a way to pass it around in memory so that all processes have read access to it. While we know that it should be technically doable, the latency overhead of the latter has proven prohibitively high.
https://ccl.northwestern.edu/netlogo/docs/
Is this only available for use within the GUI?
I can imagine how mathematicians would use it but what would be typical applications of a computer scientist?
Not in love with coffee script anymore but oh well.
The demos are great:
StarLogo and NetLogo were some of my first languages. Modeling real-world systems is an immensely powerful educational tool. It helps contextualize programming in a relatable way, and it helps you to learn about complexity and the way the world works at the same time.
For Python, someone else has already mentioned Mesa: https://github.com/projectmesa/mesa/
You can find some more lists at https://www.comses.net/ -- sadly https://en.wikipedia.org/wiki/Comparison_of_agent-based_mode... looks fairly sparse / a little outdated (though I have only passing familiarity with most of those).
Finally, I think a great technical source of theory about these models comes from Cosma Shalizi's notebook on ABM: http://bactra.org/notebooks/agent-based-modeling.html He's one of the single best sources I've seen for describing systems for formally estimating ABMs.
Netlogo is great for fast prototyping, but at least as of ...well a number of years ago now, there was a noticeable lack of scientific computing libraries. For example numerical optimization routines were extremely basic. I had to use a user-contributed package to solve a root finding problem.
Honestly for this type of work I typically write my own from scratch in Python. Here's a great set of lectures and code from Blake LeBaron, "from sratch" in Python, for finance ABMs: http://people.brandeis.edu/~blebaron/classes/agentfin/ ...and here's a nice from scratch Schelling model in Python: https://lectures.quantecon.org/py/schelling.html
http://tinlizzie.org/~ohshima/shadama2/live2017/
A bit tricky due to shader limitations, but very fast. You can use a million particles at a time. This is a product of HARC/VPRI cooperation, from what I understand.
I used both of them about 10 years ago when I was in academia in a PostDoc. I taught Agent Based Modelling and Simulation to Social Sciences PhD Students. I also had the opportunity to work with Klaus Troitzsch ( https://en.wikipedia.org/wiki/Klaus_G._Troitzsch).
These kind of models yield really interesting results. But people have to be VERY careful on how to interpret their outcomes, as some people make the mistake to try to take them as direct forecasting. Also, they suffer very much from the garbage-in/garbage-out problem.
What does that even mean? That description fits nearly every commonly used programming language and runtime.
It's true that you can implement multi-agent programming in other languages, but it's very natural and clear in NetLogo.
PS: I did my PhD in the group that produces NetLogo, and continue to be blown away from the language and what you can do with it, even though I don't use it on a daily basis any more.
I quite like its approach - like you say, it's a very natural way to do agent-based modelling. I also think its a good beginners' language for modellers who know their field (e.g. ecology) but haven't yet learnt how to program. Lastly, I like it's GUI integration.
However, I am somewhat put off by its verbose "toy language" syntax; and I really can't afford its performance. (We are currently working on a model in Julia, and even that can take up to several weeks to compute a single run on our HPC...) So I guess my opinion is that its a fantastic language to learn about modelling, but not well suited to constructing large, complex and resource-intensive models.
I've heard great things about Julia, but haven't ever used it. Yet another thing that's on my list...
The basic idea in agent-based modeling is that you have a bunch of different types of objects, which we'll call "agents." Each agent has its own independent state, which typically includes location and one or more other variables. So far, that sounds like regular ol' object-oriented programming.
However, there are some differences. First, you have all agents of one type act at the same time, at the tick of a clock. You can then say, "Hey! All doctors! Move in the direction of the closest sick patient." You can similarly say, "Hey! All patients! If there's a doctor next to you, then you have a 30% chance of being cured." Then you create a population of doctors and patients, randomly infect some proportion of the patients, and run the model.
The code for what I've just described is very short and very readable. And it does away with the need for loops. You basically describe the action that a class of agent will take at any given moment, and then tell the agents to perform one or more actions.
Again, it makes much of the programming simple and easy to understand. And yet, you can write pretty complex models in this way.
For example, I implemented the Autumn model ( http://ccl.northwestern.edu/netlogo/models/Autumn ) for NetLogo (because my eldest child was asking why leaves change color when we lived in Chicago). So I created a model in which each leaf has some randomly set values for each of the chemicals that affect color change. Then I let the user adjust the temperature and rainfall. The leaves changed colors as a result. It didn't take me much time to implement, and turned out to be a great learning tool.
Agent-based modeling isn't great for everything, but it's great for many things -- especially for modeling complex systems.