|
|
我想把在每一个patch上的turtles经过一定标准选择选出一个,然后把这一个turtle的一个属性变量传递给patch,写了下面的代码。
0 |" Q. j" c+ c0 _( ]9 [" w
$ h! X7 \2 \ o9 [5 B8 a主要有两个疑问:& O9 v) p5 m. q3 h n
. E1 v5 a$ s& P$ T) a
第一,我是用of引用turtle的属性的,可是通不过编译。应该用什么办法?0 B+ f2 A: r5 m- j
第二,set expectation那一句里的para-a和para-b也应该是被选出来的turtle包含的参数,可是目前这个写法似乎不能体现出来这个意思。
% f; W0 T& d' s* D% N& ?% j
6 D& Z) e% e2 `8 I4 T/ v
/ h( b, c U5 G1 ~+ b0 D各位高手能不能帮忙看看啊?提前谢过!1 y6 j) O; J9 X- U+ |: G
! \* c) x7 R; W. G1 n+ e3 w
to form-expectation% P' V$ M. _8 {- D8 L
ask patches [- l5 W% @5 q- T. n0 I) i
let active-strategy min-one-of ( turtles-here with [ length ( remove true (map [?1 = ?2] predictor descriptor) ) = length ( remove "#" predictor )]) [ strategy-error ]8 M( d# a, q- Z( s
set expectation para-a * ( pre-price + pre-dividend ) + para-b
1 t2 T& H! I5 u5 N, j" ^3 q9 x( L set trader-error strategy-error of active-strategy
0 d% ]: D9 v9 F+ M& E% e2 O5 }+ S set trader-type strategy-type of active-strategy ]7 V3 T2 p3 w" Y
end |
|