【发布时间】:2019-03-15 12:40:21
【问题描述】:
我之前描述的模型的延续,它用于我的论文并基于信任游戏文献。对 Netlogo 来说相对较新,我敢肯定我在这里遗漏了一些重要的东西。
我的世界有两种类型的代理人,性工作者和官员。每个都有特定的属性:
sexworkers-own
[ assault? ;; is assaulted?
trust? ;; trusts/avoids police to report assault?
protection? ;; was protected/arrested by police after report?
prob-report ] ;; overall probability to report based on the
three factors before
officers-own
[ arrest? ] ;; arrests or protects assault victims?
在模拟开始时,性工作者随机分布在袭击受害者中[袭击? = true] 与否的概率为 0.1%(受害)。官员被随机分配为逮捕性工作者[逮捕? = true] 有 90% 的逮捕概率。
在模拟运行时,被殴打的性工作者面临着提交报告的选项。他们要么选择合作,要么避免这种情况,概率为 50%。如果他们选择合作,他们的属性[信任?]为真,如果他们避免,则为假。
一旦性工作者选择合作,警察就会跟进举报。根据[逮捕?],他们要么逮捕,要么提供保护。这会导致性工作者属性[保护?]。
这些选项中的每一个都会导致不同的总体报告概率(prob-report),这在以后很重要。
我的问题是:我希望被殴打的性工作者能够跳出圈子,在他们做出一次选择时停止执行合作或回避的决定.我不知道如何更改我的代码,以拒绝性工作者,这些性工作者要么回避了,要么配合了性工作者的整体备案程序。
提交报告、合作/避免以及官员保护/逮捕的过程运作良好。我只需要一种方法来让选择退出的被殴打的性工作者,这样只有新被殴打的性工作者才会面临选择。
非常感谢!
这是我的代码:
to go
;; asks sex workers to act depending on whether they have been assaulted
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;PROBLEM: THIS SHOULD NOT BE LOOPED;;;;;;;;;;;;;;;;;;
;IF ASSAULT? THE ACTION SHOULD BE CARRIED OUT ONLY ONCE;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ask sexworkers with [ not assault? ] [victimize ]
ask sexworkers with [ assault? ] [ file ]
end
; determines probability of sex workers being assaulted (1%)
; sets the probability value to file reports to 0.5
; if sex workers haven't previously been assaulted
to victimize
ifelse random-float 100 <= 0.1
[ set assault? true ]
[ set assault? false ]
if assault? = false [ set prob-report 0.5 ]
end
; determines probability of sex workers reporting violence (50%)
to file
ifelse random-float 1 <= 0.5
[ set trust? true ]
[ set trust? false ]
if assault? = true and trust? = false
[ avoid ]
if assault? = true and trust? = true
[ cooperate ]
end
; if assaulted sex workers report, the follow-up procedure is started
to cooperate
follow-up
end
; this sets the probability value to file reports to 0
; if sex workers have been assaulted, but didn't report
to avoid
if assault? = true and trust? = false
[ set prob-report 0 ]
end
; asks officers who arrest to arrest and the others to protect
to follow-up
ask officers with [ arrest? = false] [ protect ]
ask officers with [ arrest? = true ] [ arrest ]
end
; if officers protect, reporting sex workers' protection? attribute is true
; sets the probability value to file reports to 1
; if sex workers have been assaulted, reported, and protected
; and officers' arrest? attribute is false
to protect
ask sexworkers-here with [ trust? = true ] [ set protection? true ]
ask sexworkers [
if assault? = true and trust? = true and protection? = true
[ set prob-report 1 ]
]
end
; if officers arrest, reporting sex workers' protection? attribute is false
; sets the probability value to file reports to -1
; if sex workers have been assaulted, reported, and arrested
; and officers' arrest? attribute is true
to arrest
ask sexworkers-here with [ trust? = true ] [ set protection? false ]
ask sexworkers [
if assault? = true and trust? = true and protection? = false
[ set prob-report -1 ]
]
end
【问题讨论】:
-
攻击、举报等是一次性行动吗?所以它们发生在
tick期间,然后它们就结束了?如果是这样,您不需要一个属性来存储它们是否为真。您只需要从一个刻度到下一个刻度需要记住的变量的属性。 -
他们需要被记住到下一个刻度,这是整个想法,他们被记住了。现在,可以这么说,它们还没有被记住“足够”,而是随着循环而改变(除了攻击?基于我设置它的方式,这很好用)。
标签: loops netlogo probability repeat agent-based-modeling