资源描述
课内实验报告
课 程 名: 系统工程
任课教师: 朱卫未
专 业: 市场营销
学 号: B09110513
姓 名: 李梦佳
二○ 一一 至二○ 一二 年度 第 1 学期
南京邮电大学 经济与管理学院
《 系统工程》课程实验报告
实验内容及基本要求:
实验项目名称: biology——fur
实验类型:设计
每组人数: 1
实验内容及要求:
1) 了解Netlogo编程语言的特点和基本语法。
2) 完成Netlogo基本Model的语句解析和仿真流程分析.
实验过程与结果:
1) 语句解析:
patches—own
[ new-color ;; 目前,只可能是白色或黑色
inner-neighbors ;; 在圆中围绕着这个细胞的其他细胞
outer-neighbors ;; 在环中围绕着这个细胞的其他细胞(通常是不直接接触这个细胞的)]
to setup
clear—all
;; 计算出每个细胞周围呈椭圆形的内部或外部的近邻
ask patches
[set inner-neighbors ellipse-in inner-radius—x inner-radius—y
;; outer-neighbors needs more computation because we want only the cells in the circular ring
设置内部近邻的椭圆内部半径,外部近邻要更多的计算,因为我们只想要这个细胞在环里 set outer—neighbors ellipse-ring outer—radius-x outer—radius—y inner—radius-x inner—radius-y ]
设置外部近邻椭圆环的外半径和内半径
ifelse any? patches with [ count outer-neighbors = 0 ]如果外部近邻为0
[ user-message word "It doesn’t make sense that ’outer' is equal to or smaller than ’inner.' "
显示”外部等于或小于内部是没有意义的”
” Please reset the sliders and press Setup again."”请重新设置然后按下创建”
stop]
[restart]
end
;; this procedure sets approximately initial—density percent of the cells white and the rest black; if initial—density is set at 50% then about half the cells will be white and the rest black
这个步骤是设置了白色细胞和黑色细胞的原始值,如果原始密度设置的为50%,则白色和黑色细胞一样多
to restart
reset—ticks还原时针
ask patches
[ ifelse random-float 100.0 〈 initial-density
[ set pcolor white ]设置为白色
[ set pcolor black ] ]设置为黑色
end
to go
ask patches [ pick-new—color ]选取新的颜色
ask patches [ set pcolor new—color ]设置为新的颜色
tick
end
to pick-new-color ;; 斑点化步骤
let activator count inner—neighbors with [pcolor = white]让催化剂使得内部近邻变为白色
let inhibitor count outer-neighbors with [pcolor = white]让抑制剂使得外部近邻变为白色
;; we don’t need to multiply 'activator' by a coefficient because
;; the ratio variable keeps the proportion intact我们不需要把催化剂乘以一个系数因为这个比例变量保持了比例的完整
let difference activator - ratio * inhibito让不同的催化剂比例乘以抑制剂r
ifelse difference > 0如果这个比例大于0
[ set new—color white ]设置新颜色为白色
[ if difference < 0如果小于0
[ set new—color black ] ]设置为黑色
;; 注意,我们没有处理比例等于0的时候
;; 因为我们在这种情况下希望细胞不改变颜色
end
;;; procedures for defining elliptical neighborhoods定义椭圆近邻的步骤
to-report ellipse-in [x-radius y-radius] ;; patch procedure说明椭圆内部的半径
report patches in—radius (max list x—radius y—radius)斑点的内部半径(列出最大的半径)
with [1.0 〉= ((xdistance myself ^ 2) / (x-radius ^ 2)) +
((ydistance myself ^ 2) / (y—radius ^ 2))]
end
to—report ellipse—ring [outx—radius outy—radius inx—radius iny-radius] ;; patch procedure
report patches in—radius (max list outx-radius outy-radius)
with [1。0 >= ((xdistance myself ^ 2) / (outx-radius ^ 2)) +
((ydistance myself ^ 2) / (outy—radius ^ 2))
and 1.0 〈 ((xdistance myself ^ 2) / (inx-radius ^ 2)) +
((ydistance myself ^ 2) / (iny—radius ^ 2))
]
end
;; The following two reporter give us the x and y distance magnitude。接下来的两个报告给出了x和y的距离大小
;; you can think of a point at the tip of a triangle determining how much你可以想出三角形的端点决定了另一个点到这个点的距离
;; ”to the left" it is from another point and how far "over" it is from
;; that same point。 These two numbers are important for computing total distances
;; in elliptical "neighborhoods。”这两个数对于计算椭圆近邻的距离是很重要的
Note that it is important to use the DISTANCEXY primitive and not
;; just take the absolute value of the difference in coordinates,注意使用原始的xy距离是很重要的,不要仅仅注意到坐标系中明显的不同,因为xy正确的处理了环绕世界边缘的ly,
;; if wrapping is enabled (which it is by default in this model)如果环绕是有效的(被系统默认的)
to—report xdistance [other—patch] ;; patch procedure
report distancexy [pxcor] of other—patch
pycor
end
to—report ydistance [other-patch] ;; patch procedure
report distancexy pxcor
[pycor] of other—patch
end
2) 基本算法流程分析:
我们将动物皮肤构建成一个由很多色素细胞组成的方格模型。细胞分为D细胞和U细胞.每个细胞都能在这两种状态下转换.D细胞隐藏了两种属性:催化剂(使中心细胞变成D)和抑制剂(阻止中心细胞变成D)
每个细胞是他近邻的中心细胞。假设近邻是个圆,半径为6个细胞.每个细胞的内部半径是3个细胞.
在内环的D细胞都对中心细胞起催化作用,在外环的D细胞对中心细胞起抑制作用。每时每刻,中心细胞都被催化剂和抑制剂影响着,问题是最后会变成什么颜色。如果催化的力度大于抑制的力度,细胞就会变成有颜色的,反之亦然。力度的概念是,每个作用(催化或者抑制)都要乘以这个力度.催化的力度称为1,而抑制的力度称为w。所以w是抑制作用和催化作用的比例。如果w大于1,则抑制作用比较强,反之亦然。
注意,每个细胞都在收到这种作用.第一步之后,一旦细胞被设定了,下一步依旧按照这个规则进行。
成绩评定:
该生对待本次实验的态度 □认真 □良好 □一般 □比较差。
本次实验的过程情况 □很好 □较好 □一般 □比较差
对实验结果的分析 □很好 □良好 □一般 □比较差
文档书写符合规范程度 □很好 □良好 □一般 □比较差
综合意见:
成绩
指导教师签名
朱卫未
日期
2011/10/20
展开阅读全文