7 thoughts on “How the Python Ate the Turtle”

  1. Dear Iza Romanowska,

    coming from a computing background I do appreciate your enthusiasm for Python, and I share your sentiments towards NetLogo. But you tell only half the story. Using a general purpose language like Python for a specialized task like writing an agent based model requires you to re-invent the wheel (or the whole cart for that matter ;-)) again and again. For instance, a timing loop, agents and inter agent communication, environments, etc. all have to be implemented. Or you can use libraries written by other people, and for this Python is indeed famous. But that has it’s own caveats.

    I would like to argue that Python and the associated functionality hidden in libraries with unknown features/bugs included is for hardcore programmers who have more than a PhD to spent on agent-based modelling. There is an intermediate step that offers (literally) the best of both worlds, and that is the agent-based modelling platform that goes under the name of Repast Simphony (http://repast.sourceforge.net/) and the likes.

    The main advantage of such a dedicated development environment is that most functionality that you will need (like the features mentioned above, or the ones you list including GIS support, output graphs and tables, input routines for widely varying data formats, etc.) is already implemented. And also used by probably many hundreds of programmers/modellers around the world, reducing the number of unwanted features (bugs) present in the modules. An active mailing list community will answer most questions you can come up with.
    Programming the agents (which is where you will want to spent your computing time) can be done in Java or …. Logo.

    Kind regards,


  2. Hi Fulco,
    The other half of the story was given by Ben, in his fantastic post on the Turtle Power, you can find it here: https://simulatingcomplexity.wordpress.com/2014/05/21/turtle-power-an-ode-to-netlogo/

    I learnt Python in two weeks, build my first simulation in another two, the only libraries I use are math (so that I don’t need to code sin or pi) and matplotlib for plotting so you it is definitely possible to avoid any ‘hard core computer science’. And, yes sure there is an overhead of coding the grid, the agents, the time etc but it’s really not such a big deal. My whole world + agents inside it is built in one line:
    world = [[[1, 2, 3, 4, 5, 6, 7, 8, 9] for x in xrange(X_MAX)] for x in xrange(Y_MAX)]

    So, yeah, coding will take more time but in general I seem to recuperate that time on not fighting with the GIS software and having all my stats + plotting built in the model rather than being exported to R as well as using standard testing tools.

    Choosing the right tool is always a tradeoff and this series is designed to give people an overview of what’s out there and what are the pros and cons of using different platforms so they can choose for themselves.
    The truth is, as always, there is no one answer, but I’m glad we got people discussing it, here and on Twitter. Next week Stef will talk about her experience of using Java (+ the Eclipse environment) and R.

  3. Coding an Agent Based Model in Netlogo literally takes minutes. So, one may invest most of one’s time in thinking about a problem, analyzing the situation and planning one’s model. You turn to Netlogo when a conceptual model is clear in your hear, and you are done in minutes, mostly thanks to a wide array of very high level commands that accomplish in one keyword what would take loops of code to program. Very hard to beat by any programming language, in my humble opinion.

    Best regards from sunny Greece,
    John A. Paravantis
    University of Piraeus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s