Choosing the top 5 patches and changing their state

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Choosing the top 5 patches and changing their state

bilal_ahmad_21
Hi to everyone,

my problem is how to choose the top 5 patches and changing their state.
My patches are in a state defined by N = 0 and they are connected with
a variable P which changes through time according to some specific
rules. What i want to do is rank the patches according to the P values
at each time step and then select the top 5 in order to change their
state from N = 0 (undeveloped)  to N = 1 (developed).



Could anyone help me out?


Reply | Threaded
Open this post in threaded view
|

Re: Choosing the top 5 patches and changing their state

SethTisue
Administrator
>>>>> "auth1lag" == auth1lag  <[hidden email]> writes:

 auth1lag> Hi to everyone, my problem is how to choose the top 5 patches
 auth1lag> and changing their state.  My patches are in a state defined
 auth1lag> by N = 0 and they are connected with a variable P which
 auth1lag> changes through time according to some specific rules. What i
 auth1lag> want to do is rank the patches according to the P values at
 auth1lag> each time step and then select the top 5 in order to change
 auth1lag> their state from N = 0 (undeveloped) to N = 1 (developed).

ask max-n-of 5 patches [P] [ set N 1 ]

--
Seth Tisue / http://tisue.net
lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/