-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
six times faster: bserver> reset-timer repeat 1000 [ set people-jailed n-of 5 persons set co-offender-group-histo find-facilitator people-jailed] show timer observer: 2.512 observer> reset-timer repeat 1000 [ set people-jailed n-of 5 persons set co-offender-group-histo find-facilitator-1 people-jailed] show timer observer: 13.886
- Loading branch information
1 parent
6646a60
commit b46d4cd
Showing
1 changed file
with
10 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1127,7 +1127,7 @@ to make-people-die | |
ask all-persons [ | ||
if random-float 1 < p-mortality or age > 119 [ | ||
if facilitator? [ | ||
let new-facilitator one-of other persons with [ not facilitator? and age > 18 ] | ||
let new-facilitator one-of other persons with [ not facilitator? and not oc-member? and age > 18 ] | ||
ask new-facilitator [ set facilitator? true ] | ||
] | ||
set number-deceased number-deceased + 1 | ||
|
@@ -1157,24 +1157,19 @@ to-report p-fertility | |
end | ||
|
||
to-report find-facilitator [ co-offending-group ] | ||
let the-facilitator nobody | ||
let the-facilitator no-turtles | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
; first, test if there is a facilitator into co-offender-groups | ||
let available-facilitators co-offending-group with [ facilitator? ] | ||
ifelse any? available-facilitators [ | ||
set the-facilitator one-of (available-facilitators with [ facilitator? ]) | ||
set the-facilitator one-of available-facilitators | ||
] [ | ||
; second, search a facilitator into my networks | ||
while [ the-facilitator = nobody and any? co-offending-group ] [ | ||
let pool nobody | ||
ask one-of co-offending-group [ | ||
nw:with-context persons person-links [ | ||
set pool (turtle-set nw:turtles-in-radius max-accomplice-radius nw:turtles-in-reverse-radius max-accomplice-radius) | ||
set pool other pool with [ facilitator? ] | ||
] | ||
if any? pool [ set the-facilitator one-of pool ] | ||
set co-offending-group other co-offending-group | ||
set available-facilitators turtle-set [ | ||
(turtle-set nw:turtles-in-radius max-accomplice-radius nw:turtles-in-reverse-radius max-accomplice-radius) with [ | ||
facilitator? | ||
] | ||
] | ||
] of co-offending-group | ||
if any? available-facilitators [ set the-facilitator one-of available-facilitators ] | ||
] | ||
report the-facilitator | ||
end | ||
|
@@ -1220,6 +1215,8 @@ to commit-crimes | |
set number-crimes number-crimes + 1 | ||
ask rnd:weighted-one-of people-in-cell [ criminal-tendency + criminal-tendency-addme-for-weighted-extraction ] [ | ||
let accomplices find-accomplices number-of-accomplices | ||
|
||
; here we should change it. The facilitator must be one of them, not an added member: see https://github.com/LABSS/PROTON-OC/issues/60#issuecomment-472075050 | ||
This comment has been minimized.
Sorry, something went wrong.
digitaldust
Contributor
|
||
set co-offender-groups lput (turtle-set self accomplices) co-offender-groups | ||
if oc-member? [ set co-offenders-started-by-OC lput (turtle-set self accomplices) co-offenders-started-by-OC ] | ||
; check for big crimes started from a normal guy | ||
|
I don't get this, why putting there an empty agentset? after this you put
set the-facilitator one-of…
so you revert it to a single turtle