How can I use breeds-own or turtles-own variables in BehaviorSpace. When I tried it I got an error that "Global variable does not exist".
I cannot use these variables as global variables as each breed/turtle needs to have its own unique value of the variable during each run.
You cannot use
breeds-ownorturtles-ownvariables in BehaviorSpace.You normally use
breeds-ownorturtles-ownvariable when you want a potentially unique value for each single individual. If that is what you want, trying to set that through BehaviorSpace is not going to work. (Though we may be able to suggest a workaround if you explain what you need in more detail.)If you just want a unique value for the whole breed, then it's easy. You can create a different global variable (normally with a slider widget or numeric input box) for each breed. Let's say you have the following breeds:
Then you can have a slider named
mice-varand another namedfrogs-var, and refer to those whenever you need to access that value in your code. For example:In BehaviorSpace, you can then vary both of your global variables:
and then you'll have a run where all the frogs are labeled
1and mice are labeledA, another run where it's1andB, then1andC,2andAand so on...