设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 7339|回复: 2

[求助] netlogo编程关于随机数的求助

  [复制链接]
发表于 2015-1-7 11:27:22 | 显示全部楼层 |阅读模式
在netlogo模型库中有一个virus on a network,里面有一个代码to spread-virus
/ c3 k7 i) V; i& N7 t# C  ask turtles with [infected?]# M4 t9 Q+ q/ r
    [ ask link-neighbors with [not resistant?], K( @/ ^3 i0 P8 l$ b$ R2 \
     [ if random-float 100 < virus-spread-chance
, H/ K1 ^. F: e8 d& ~0 M, X& K: F            [ become-infected ] ] ]
4 l8 _8 \2 J: s6 V8 Q$ r
end( Y3 k" Q1 l0 z0 y; S( y; W
这里为什么virus-spread-chance大于random-float 100,就可以判断出become-infected呢?
* R. [: _, x1 Mto do-virus-checks
- L) }  ^/ Y* n: b! }  ask turtles with [infected? and virus-check-timer = 0]
) {- h3 w$ p8 k+ w3 q" W  [
0 d9 Z" ~' n6 a& V    if random 100 < recovery-chance( O. H# a3 ~# @; [3 o
    [7 B% u7 t9 {+ ]+ e& {) ?2 G
      ifelse random 100 < gain-resistance-chance
# `9 o( t  r0 I; E: a        [ become-resistant ]
9 r# N, ^1 e/ p6 q8 z3 h        [ become-susceptible ]1 ~" H" h. l7 ?/ X1 Q
    ]
) f8 t- D2 p: e+ @" x+ }  ]
% l- o& {* B, r! hend
  g# T9 H! y0 ~, W9 ?% |% J下面同样这个问题不明白
& g( C3 e- s; t  e小妹求大神帮忙!!
. v; |8 R, P! j; W' O, l
 楼主| 发表于 2015-1-7 11:28:08 | 显示全部楼层
自己顶一下,文科生,真心难写编程
发表于 2016-3-27 16:49:39 | 显示全部楼层
这是用于概率计算的一种表示方法,例如,若virus-spread-chance=5,那么在100以内随机生成一个数字,小于5的可能情况,只有4、3、2、1、0,塔门出现的概率只有5%,也就是海龟被感染的可能性为5%。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2024-5-23 22:21 , Processed in 0.013925 second(s), 17 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表