What is the best way for me to code something that I already have in Mathematica (though only in a mass action kind of way, an average of something that a NetLogo model would be doing)? Is the GUI part of the coding the way to go? Is it flexible enough for adding stochasticity, conditionals, loops, rewards and punishments to agents for specific actions? Or do I need to learn the coding language (Python?)
I just read the tutorial part of the pdf and I have a question: how can I make the rate at which agents consume resource, variable dependent on a certain random property? One way (but I don’t like it) is to make them move faster, or give them the variable ability to move towards resource instead of randomly (as the tutorial had). Is there a more direct way? I don’t like it because I want to control the effort needed to find resource, the benefit gotten from consuming it and the rate at which it is consumed separately.
Hi Iuval,
If you already have the behavior you want in Mathematica and just want to use NetLogo for visualizations, I would recommend checking out Mathematica Link, a tool that is shipped with NetLogo Desktop. You will still need to be at least somewhat familiar with the NetLogo programming language in order to create the visualizations, but it won’t be nearly as difficult as reimplementing the functionality of your Mathematica model. Also, just to clarify, NetLogo is its own programming language; although you can also run Python code from a NetLogo model, the language built into the application is not Python. Let us know if you have any questions or if Mathematica Link doesn’t solve your problem!
Isaac B.
Thanks Isaac. I want LetLogo for more than visualization. I want it for a finer-grained model than I can get from differential in time (or difference) equations. I might want later to superimpose the results from the Mathematica differential equations and the NetLogo, but that’s for later (I had trouble with jar files not being where they’re supposed to be, maybe because I have an old MacOS, but let’s not worry about that now). So how do I have agents consume resource at different, controlable rates? Do you have an example code snippet for that?
Ok, that makes sense. When you want to have a group of turtles do the same thing at different rates, what you most likely need is a turtles-own variable. You can find details in the docs and in the interactive dictionary. If I’m understanding your request correctly, you might want to do something like the following:
turtles-own [
collection-effort
resource-benefit
resource-rate
]
You can then assign these values in setup, and reference them in go when you’re updating your turtles. For example, you could implement randomized benefits like this:
turtles-own [
resource-benefit
resource-amount
]
to setup
create-turtles 100 [
set resource-benefit random-float 1
set resource-amount 0
]
end
to go
ask turtles [
set resource-amount resource-amount + resource-benefit
]
end
Each turtle will keep track of its own current resource amount as well as the benefit that it gains from acquiring resources each tick. Hopefully either what I said here or what’s in the docs helps, but let us know if you’re still unsure of how to implement something.
Isaac B.