Reputation: 49
Continuation of a model I described before, it's for my dissertation and based on the trust game literature. Relatively new to Netlogo, and I am sure I am missing something essential here.
My world has two breeds of agents, sex workers and officers. Each have specific properties:
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?
At the beginning of the simulation, sex workers are randomly distributed in assault victims [assault? = true] or not with a probability of 0.1% (being victimized). Officers are randomly distributed as arresting sex workers [arrest? = true] with a probability of 90% arresting.
When the simulation is running, sex workers who have been assaulted are confronted with the option of filing a report. They either choose to cooperate or to avoid this, with a probability of 50%. If they choose to cooperate, their attribute [trust?] is true, if they avoid,it is false.
Once a sex worker chooses to cooperate, police officers then follow up on the report. Depending on [arrest?], they either arrest or provide protection. This then results in the sex worker attribute [protection?].
Each of these options lead to a difference overall probability to report (prob-report) that will be important later on.
My problem is: I want sex workers who have been assaulted to get out of the loop and stop executing the decision to cooperate or avoid when they made the choice once. I cannot figure out how to change my code to drop sex workers who have either avoided or cooperated from the overall filing procedure for assaulted sex workers.
The process of filing reports, cooperating/avoiding, and also of officers protecting/arresting works well. I just need a way to make assaulted sex workers who chose an option to drop out so only newly assaulted sex workers are confronted with the choice.
Thank you so much!
Here my code:
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
Upvotes: 0
Views: 83
Reputation: 17678
If they are assaulted in one tick, what do you want to happen in the following and later ticks? Does the fact that they have been assaulted at some stage in their past affect their future behaviour in any way?
You have them remembering forever because you set the assault variable to true and there's no chance to change it back. If you need them to remember that forever, then you need an extra attribute to keep track of the fact that they have an assault that they haven't made a decision about. Then once they've made the decision, you change the status of that attribute. You can't keep two different pieces of information (ever assaulted, and has an undecided assault) with the same variable.
Upvotes: 1