Netlogo:海龟执行动作后停止动作循环

Netlogo: Stop loop of actions after turtles carry out action

我之前描述的模型的延续,这是我的论文,基于信任博弈文献。 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),这在以后很重要。

我的问题是:我希望被性侵的性工作者跳出圈套,停止执行合作的决定或者在他们做出选择时避免。我无法弄清楚如何更改我的代码以将那些避免或合作的性工作者从被殴打性工作者的整体备案程序中删除。

提交报告的流程 cooperating/avoiding 以及官员 protecting/arresting 的流程运作良好。我只需要一种方法让选择退出选项的被殴打性工作者这样只有新被殴打的性工作者面临选择。

非常感谢!

这是我的代码:

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

如果他们在一个滴答中被攻击,你希望在接下来的滴答中发生什么?他们在过去的某个阶段遭到殴打这一事实是否会以任何方式影响他们未来的行为?

你让他们永远记住,因为你将 assault 变量设置为 true 并且没有机会将其更改回来。如果您需要他们永远记住这一点,那么您需要一个额外的属性来跟踪他们尚未做出决定的攻击这一事实。然后,一旦他们做出决定,您就可以更改该属性的状态。你不能用同一个变量保存两条不同的信息(曾经被攻击过,并且有未定的攻击)。