eggy 311 days ago [-]
I used NetLogo and a example file that I modified to demonstrate to non-techie designers why the doors they were proposing for a theater were too few and too narrow. The scrambling arrows representing people colliding and changing directions and the traffic made it very apparent. Simply telling them code requires X and you have Y wasn't as poignant. We wound up using NetLogo for other types of presentations.
lettergram 311 days ago [-]
Years ago I wrote an application which was essentially a neural circuit of a sea slug (they only eat and forage) with my now wife.

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.

vanderZwan 311 days ago [-]
> Honestly, idk if you can make any “claims”

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.

rootoor 311 days ago [-]
I worked with a grad student in college who was building models in NetLogo for modeling drug overdoses. It was pretty janky and slow.

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

frankling_ 311 days ago [-]
As for the performance aspect, these kinds of simulations (typically using fixed time steps and with per-agent decision-making) are a natural fit for many-core devices. We recently did a survey on that subject [1]. There is a lot of work being done along these lines right now.

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.


veddox 311 days ago [-]
This is interesting. We've been thinking quite a bit about parallelising our model, but haven't managed it yet. The problem is that although our agents are mostly independent of each other, they all depend on the shared state of the world (and modify this, too).

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.

frankling_ 311 days ago [-]
Yeah, for some models, especially small-scale ones, it can be hard to get a performance gain. There are actually ways of avoiding the locking, e.g., by staging the desired actions and then carrying them out afterwards, resolving conflicts as needed. We actually have a paper on this as well, but I'm going to stop pushing my research at this point ;)
flatline 311 days ago [-]
I did a couple projects in undergrad using it. I had to implement my own trig functions from scratch! I think they had sin and cos and that was it? It’s a really a neat little environment for throwing together a proof of concept quickly, not a system in which to do computationally intensive work.
mujoco 311 days ago [-]
For anyone who'd like to try out NetLogo without installing it, you can run example models and play with the code online in NetLogo Web:
vanderZwan 311 days ago [-]
Ironically, if I click that link on mobile it downloads a file
jbottoms 311 days ago [-]
Oh, well beyond "very interesting". This type of modeling can yield results that are otherwise intractable. It is one of the primary reasons Thomas Schelling received a Nobel prize in economics. It should be in the toolkit of every applied mathematician or computer scientist.
xrd 311 days ago [-]
I liked the tutorial #1, linked from here:

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?

xrd 311 days ago [-]
Agent script looks like an amazing port:

Not in love with coffee script anymore but oh well.

The demos are great:

311 days ago [-]
nasir 311 days ago [-]
During our graduation period we used Netlogo for projects of distributed networks. It was lots of fun to do different simulations. I remember writing Ant Colongy Optimization and Firefly Synchronization with it and being able to visually see and tweak parameters.
xrd 311 days ago [-]
What other languages provide this kind of model output? It's very interesting.
falls-to-bits 311 days ago [-]
There are more and more these days. If you want Java/scala-based, the two biggest ones are: - MASON: - Repast:

For Python, someone else has already mentioned Mesa:

You can find some more lists at -- sadly 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: 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: ...and here's a nice from scratch Schelling model in Python:

xrd 311 days ago [-]
Terrific summary, thanks so much.
maxbond 311 days ago [-]
There's a similar language called StarLogo (, but the latest iteration (StarLogo TNG is focused on education and accessibility, and is a graphical block style language. There's a JavaScript framework based on NetLogo called AgentScript ( I've also seen people use Processing ( for agent-based modeling.

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.

mcphage 311 days ago [-]
To add to your comment: StarLogo is talked about in the book "Turtles, Termites, and Traffic Jams", which is a great book talking about understanding decentralized phenomenon, and how we learn to understand them. But the language seems to have vastly diverged from what's used in the book, which is disappointing.
xtracto 311 days ago [-]
You can use the RePast Suite ( ).

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 (

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.

nickmancol 311 days ago [-]
I have used Mesa (python 3) in one of my master's classes.
gambler 311 days ago [-]
There is a GPU accelerated particle simulator from Yoshiki Oshima and a few other people. It can run in browsers.

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.

311 days ago [-]
zeptomu 311 days ago [-]
> NetLogo is a multi-agent programmable modeling environment.

What does that even mean? That description fits nearly every commonly used programming language and runtime.

reuven 311 days ago [-]
Most programming languages don't use the multi-agent paradigm. It's a different way of thinking about problems, in which you describe how each type of agent should interact with others, and then you let them run and play out the scenario.

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.

veddox 311 days ago [-]
I am in a research group that does ecological modelling, so I've heard a fair bit about NetLogo, though I haven't used it myself.

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.

TuringTest 311 days ago [-]
Is there a language you would recommend as the next step for someone who has learned NetLogo? One with better syntax and performance? Maybe a Julia library?
veddox 310 days ago [-]
We use Julia in our group and I really like it: the language design is pretty neat and it offers a very good performance. I don't know of any libraries targeted specifically at agent-based modelling, though. (But in the end, as an experienced programmer you don't really need that - plain object-orientation is enough.)
reuven 310 days ago [-]
I would argue that for certain kinds of problems, agent-based modeling is easier to think about and work with than object-oriented programming. It's not a matter of your programming experience, but rather what you're trying to model and how.

I've heard great things about Julia, but haven't ever used it. Yet another thing that's on my list...

sashaafm 311 days ago [-]
Would you mind explaining the difference and comparing with the Actor Model paradigm?
reuven 310 days ago [-]
I don't know much about the actor model. One of these days, I should look into it more. It's possible that there's a large overlap.

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 ( ) 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.

Jtsummers 311 days ago [-]
It's about the environment. Everything in NetLogo could be done in straight assembly, that doesn't mean it's accessible to a wider audience. A large chunk of the motivation for NetLogo is pedagogical: make simulations and modeling accessible to students so they can explore (dynamically, not just statically) different concepts.
xtracto 311 days ago [-]
Exactly... for non-developer students (social sciences), even doing a model in NetLogo is a big challenge. Still, with the right tools, they can do amazing things.