Netlogo, selecting a value from the combination of lists and single value -
Netlogo, selecting a value from the combination of lists and single value -
i have 2 lists , single value (in each patch). combine single value list , set specific weights value each interaction. illustration
let single random 3; represent center patch allow list1 [ 0 1 2 2 1 0 0 2 ]; represent moore neighbors values allow weights [0.2 0.3 0.5 0.1 0.8 0.1 0.6 0.2 0.2 ]; combination of centerpatch , neighb.
i create new list (list2) , in each combination of single , list1 specific weight values. illustration if single=0 , list1 =0 , list2 have 0.2 if single=1 , list1 =1 , list2 have 0.8 , on..
i tried utilize “ifelse-value” without success.
let single_and_list sentence single list1 allow condition1 map [ifelse-value (? = 0 , list1 = 0 ) [0.2][?]] single_and_list allow condition2 map [ifelse-value (? = 1 , list1 = 1 ) [0.8][?]] single_and_list allow list2 [condition1, condition2,….]
i appreciate insights thanks
i recommend writing explicit reporter procedure transform value list , single value weight. instance:
to-report weight [ single list-val ] if single = 0 , list-val = 0 [ study 0.2 ] if single = 1 , list-val = 1 [ study 0.8 ] ... study <default-value> end
then, weights, can do
let weights map [ weight single ? ] list1
by dividing code this, becomes much clearer.
netlogo
Comments
Post a Comment