Pirated scripts for NetLogo?

NetLogo is great for agent-based modeling ... except for the language. I always distort my brain, trying to figure out how to do something that should be simple for the code (for example, implementing a simple case) in implementing the NetLogo logo. A logo is simply not the programmer’s language (apologies for being furious with this statement).

I saw the Abe Gong Tengolo project, which was supposed to do just that ( http://compsocsci.blogspot.com/2012/02/announcing-tengolo-python-alternative.html ), but the project seems to have been abandoned. Another stack overflow question ( agent-based: performance issue: Python vs NetLogo and Repast ) indicates that Python will be slower.

It seems that it would be entirely possible to use Jython to compile into modules that NetLogo could use, but I was wondering if anyone knew anything that would allow me to do NetLogo simulations in a reasonable language such as Python. Thoughts?

+5
source share
3 answers

A lot of projects like NetLogo-clone existed during the year, but they usually become founders and die as soon as the creators realize how much they work to create and maintain something like NetLogo for several years or even decades, (Work on NetLogo and its predecessors in the StarLogo line continued until the end of the 1980s.)

2015: Mesa looks like a promising member in the ABM-for-Python space.

For those who like the NetLogo feature set and agent semantics, but don’t like this language, I think that the most promising direction is the NetLogo Web project by NetLogo developers (including me, although I’m no longer involved since 2015). In addition to being backward compatible with the old NetLogo language, NLW also allows you to create models in JavaScript or in any JavaScript compilation language.

NLW has not yet reached full parity of performance with regular NetLogo, but it’s good on its way. Therefore, depending on your needs, this may just be a promising area, and not a solution that you can use today.

You can also take a look at AgentScript - also JavaScript-based with the CoffeeScript error (2015 update: I think they are switching to ES6?).

+4
source

NetLogo as a language has some disadvantages. the absence of a case , of course, secondary; the lack of modularity above the functional level is larger for very complex simulations.

But things that should be easy to code are usually simple for code, albeit in a way that you cannot use. All this is a matter of thinking: the logo language has its roots in the Lisp family, and the best way to approach the problem in it is almost always with functional programming . If you try to maintain an imperative (or even "pythonic") way of thinking, you probably have to constantly "narrow your brain."

I would suggest asking questions here when you come across obviously simple things. There is a very good chance that someone will want to show you the "NetLogo" path of this.

As said, there are two main ways that NetLogo interacts with other JVM languages, including Jython:

  • The extension API allows you to provide new primitives used internally by NetLogo. You could build the bulk of your model inside Jython, expose your code with extension primitives, and keep the stuff you have to code inside NetLogo to a minimum.

  • The management API allows you to control NetLogo from an external program. In this case, you would encode your model in Jython and use NetLogo as an external modeling engine / library.

But if your goal is simply to build simulations, I'm not sure that you will win much by going through these workarounds. You can also switch to another platform, such as MASON or Repast, or just, you know ... learn to love NetLogo.

+2
source

The gridworld.py module provides some features of NetLogo.

I really love Python, but I will put a word into NetLogo: it is more than suitable for most small-sized simulations, as soon as you get used to its set of functions, especially after adding tasks. (According to Nicholas, from the point of view of functional programming it helps.) For some projects, the lack of inheritance in NetLogo is really inconvenient (breeds are not an adequate replacement). However, one of my current projects is in NetLogo, and trying to teach agent-based programming using Python, I switched to NetLogo for the class.

One more thing: I look forward to, the Turtle looks quite exciting.

+1
source

Source: https://habr.com/ru/post/1201275/


All Articles