ELC
ELC

Reputation: 41

Netlogo BehaviourSpace: Recording only max value of a variable

I want to run simulation in which I am interested in the value of a variable participation-rate. Because of the stochastic nature of other variables in the model this variable often varies. So what I want to do is run the model X times and record the maximum value of participation-rate (at the end of each run) after comparing each run with one another. How should I do this?

Thanks!

Upvotes: 0

Views: 113

Answers (1)

JenB
JenB

Reputation: 17678

To record the max value of a variable over a run, you should create a global variable to store it. Initialise it in the setup step (or set it in the first timestep to the current value). Within each time step (eg during the go procedure) you simply compare the current value to the existing stored max value and replace it if the current value is higher.

If you want to compare a value across runs, you need to use the BehaviorSpace tool to run the model multiple times and store output. You can have it report the max value calculated as above, or if it is a variable that never decreases, you don't need to calculate the max, you can simply report the value it has at the end of the run (one of the BehaviorSpace settings - every tick or end of run). Then analyse in your data package of choice.

Upvotes: 2

Related Questions