|
|
我想把在每一个patch上的turtles经过一定标准选择选出一个,然后把这一个turtle的一个属性变量传递给patch,写了下面的代码。
" ~$ D3 {$ ~8 q% k: { c" o4 Q5 q J+ `# C3 r; V3 v4 U
主要有两个疑问:0 ~. k7 c$ l5 v5 @
$ J5 d' _9 i4 ?! h( M5 W第一,我是用of引用turtle的属性的,可是通不过编译。应该用什么办法?* J; c e( ^6 i0 b% \& L
第二,set expectation那一句里的para-a和para-b也应该是被选出来的turtle包含的参数,可是目前这个写法似乎不能体现出来这个意思。
5 P( v9 l; f! i+ f* r) v5 Y$ `
% b+ C+ s: `! E4 ~: l8 c7 D8 \1 H# O. ]* [
各位高手能不能帮忙看看啊?提前谢过!
( @. k6 [; I# g& R: h. g% B9 G: ~5 S" ^
to form-expectation$ v; y# E! k/ W$ `8 ]$ J
ask patches [
/ P; `8 t, N9 O" b let active-strategy min-one-of ( turtles-here with [ length ( remove true (map [?1 = ?2] predictor descriptor) ) = length ( remove "#" predictor )]) [ strategy-error ]7 \2 C \( q/ @, C
set expectation para-a * ( pre-price + pre-dividend ) + para-b
( R/ e i7 s+ [5 S Q3 F set trader-error strategy-error of active-strategy
4 {/ k3 p; a5 f, j( g1 `* z set trader-type strategy-type of active-strategy ]
/ X2 z9 L, j) q6 h# u8 Q; R1 ^2 aend |
|