|
|
我想把在每一个patch上的turtles经过一定标准选择选出一个,然后把这一个turtle的一个属性变量传递给patch,写了下面的代码。
1 U# b; M9 R% z. V. ^3 p8 R9 l7 D
8 o7 }/ M( J! ^# X+ f( V主要有两个疑问:
4 {1 N! j) ?6 ^! ?" b. d; K) P& q: c8 T4 r F* r$ m' E, k
第一,我是用of引用turtle的属性的,可是通不过编译。应该用什么办法?& K" @! c- H, l5 {* y* N
第二,set expectation那一句里的para-a和para-b也应该是被选出来的turtle包含的参数,可是目前这个写法似乎不能体现出来这个意思。5 T+ {5 A* ?$ [! r4 S
3 c& P3 ^7 ~' Z5 T7 h c% n; o+ {, f* m' k& j; {8 X' q$ u6 Z
各位高手能不能帮忙看看啊?提前谢过!
# k% G2 l- H5 ?3 j
5 a: Q% p$ K: Q9 h# xto form-expectation
% q, r& u* A1 h8 E5 X. I ask patches [# g( l# [, B9 M( M" U' h' ^
let active-strategy min-one-of ( turtles-here with [ length ( remove true (map [?1 = ?2] predictor descriptor) ) = length ( remove "#" predictor )]) [ strategy-error ] `; h2 V# U* x3 e% f$ M1 x2 K
set expectation para-a * ( pre-price + pre-dividend ) + para-b9 N9 T9 u2 O( a$ Z0 h2 U1 |: Z: W
set trader-error strategy-error of active-strategy6 z: x) ^, [+ \$ _' B
set trader-type strategy-type of active-strategy ]
0 E+ S6 g5 E, U4 D5 s) z6 U+ `end |
|