diff --git a/README.md b/README.md index 0b59ce4..209cc6f 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,13 @@ If there is a researcher for whom, if given sufficient time for her belief to co When the network is a de facto complete network, scientists might be able to utilize a more performant sharing procedure (the second condition is that they have to be converged): `share-fast`. This variable signals whether or not such a de-facto complete network is present in the current run. +#### g-exit-condition? + +* format: boolean +* example: false + +If the `exit-condition` reporter is evaluated the variable will be set to `true` in case the the exit-condition is met, `false` otherwise. Positive evaluation of the exit-condition marks the end of a run. + ### Turtles-own diff --git a/SocNetABM.nlogo b/SocNetABM.nlogo index 2080804..bc7d826 100644 --- a/SocNetABM.nlogo +++ b/SocNetABM.nlogo @@ -7,7 +7,7 @@ globals [th-i-signal indiff-count crit-interactions-th1 crit-interactions-th2 converge-reporters converge-reporters-values run-start-scientists-save rndseed g-confidence g-depressed-confidence g-fast-sharing-enabled g-last-convlight-th g-conv-dur-th1 g-conv-dur-th2 - g-conv-start-th1 g-conv-start-th2] + g-conv-start-th1 g-conv-start-th2 g-exit-condition?] __includes ["protocol.nls"] @@ -59,6 +59,7 @@ to setup [rs] set g-conv-dur-th2 [] set g-conv-start-th1 [] set g-conv-start-th2 [] + set g-exit-condition? false reset-ticks end @@ -66,17 +67,38 @@ end +; advances the model one round with- or without evaluating the exit-condition +; depending on the argument: +; exit? = exit-condition evaluated?, type: boolean +to go [exit?] + let fast-sharing? 0 + with-local-randomness [ + set fast-sharing? (g-fast-sharing-enabled and converged-light) + if exit? and not g-exit-condition? [ + set g-exit-condition? exit-condition + ] + ] + ifelse g-exit-condition? and exit? [ + stop + ][ + go-core fast-sharing? + ] +end + + + + + ; one go = one round -to go +to go-core [fast-sharing?] ask turtles [ pull ] - let fast-sharing (g-fast-sharing-enabled and converged-light) - if fast-sharing [ + if fast-sharing? [ share-fast ] ask turtles [ - if not fast-sharing [ + if not fast-sharing? [ share ] calc-posterior @@ -103,20 +125,6 @@ end -; runs until the exit-condition is met -to go-stop - let stop? 0 - with-local-randomness [set stop? exit-condition] - while [not stop?][ - go - with-local-randomness [set stop? exit-condition] - ] -end - - - - - ; some basic sanity checks, which ensure that the chosen model parameters are ; sensible to check-sanity @@ -573,8 +581,8 @@ BUTTON 15 164 48 -NIL go +go false T 1 T @@ -660,9 +668,9 @@ BUTTON 64 124 97 -NIL go-stop -NIL +go true +T 1 T OBSERVER @@ -870,6 +878,12 @@ If there is a researcher for whom, if given sufficient time for her belief to co When the network is a de facto complete network, scientists might be able to utilize a more performant sharing procedure (the second condition is that they have to be converged): `share-fast`. This variable signals whether or not such a de-facto complete network is present in the current run. +#### g-exit-condition? + +* format: boolean +* example: false + +If the `exit-condition` reporter is evaluated the variable will be set to `true` in case the the exit-condition is met, `false` otherwise. Positive evaluation of the exit-condition marks the end of a run. ### Turtles-own @@ -1278,15 +1292,14 @@ false Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ -NetLogo 6.0.2 +NetLogo 6.0.4 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup new-seed - go - exit-condition + go true successful-run average-jumps avg-indiff-time diff --git a/protocol.nls b/protocol.nls index 4d08ef3..b8ab0d9 100644 --- a/protocol.nls +++ b/protocol.nls @@ -329,7 +329,7 @@ end ; reports the average signal for th# at the time of final convergence ; arguments: ; - th# = theory, type: string -; - rec = recording?, type: boolean +; - rec? = recording?, type: boolean to-report average-signal [th# rec?] let identifier "avgsignal" ifelse rec? [ @@ -362,7 +362,7 @@ end ; reports the average beliefs among the researchers ; arguments: ; - th# = theory, type: string -; - rec = recording?, type: boolean +; - rec? = recording?, type: boolean to-report average-belief [th# rec?] let identifier "avgbelief" ifelse rec? [