Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: in RETURN-KIDS, nlogo.nvm.RuntimePrimitiveException: That person is dead. #168

Open
mariopaolucci opened this issue May 7, 2020 · 2 comments · Fixed by #165
Open
Assignees
Labels
bug Something isn't working

Comments

@mariopaolucci
Copy link
Contributor

Here, pretty self-explanatory. The bug comes out in the runs of the 0.9.3 series

Run #3, RUNTIME ERROR: That person is dead.
error while observer running OF
  called by (anonymous command: [ a -> let last but-last a if any? turtle-set father [ if [ age ] of last a >= 18 [ if random-float 1 < 6 / first a [ ask last a [ create-offspring-link-from father ] set removed-fatherships remove a removed-fatherships ] ] ] ])
  called by procedure RETURN-KIDS
  called by procedure GO
  called by procedure __EVALUATOR
org.nlogo.nvm.RuntimePrimitiveException: That person is dead.
        at org.nlogo.nvm.AnonymousCommand.perform(AnonymousProcedure.scala:181)
        at org.nlogo.nvm.AnonymousCommand.perform(AnonymousProcedure.scala:158)
        at org.nlogo.prim.etc._foreach.perform(_foreach.scala:33)
        at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
        at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
        at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
        at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at scala.util.control.Exception$Catch.apply(Exception.scala:228)
        at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
        at org.nlogo.job.JobThread.run(JobThread.scala:66)
@mariopaolucci mariopaolucci added the bug Something isn't working label May 7, 2020
@mariopaolucci mariopaolucci self-assigned this May 7, 2020
@mariopaolucci
Copy link
Contributor Author

mariopaolucci commented May 7, 2020

To reproduce the issue, I have set

set num-persons 1000
set num-oc-persons 1000
set number-crimes-yearly-per10k 10000

and I have changed a line of code to pump up arrests: set arrest-rate number-arrests-per-year / ticks-per-year / number-crimes-yearly-per10k / 1000 * count persons instead of set arrest-rate number-arrests-per-year / ticks-per-year / number-crimes-yearly-per10k / 10000 * count persons.

I run with while [length removed-fatherships < 3] [go] print "finito" and I kill all the prisoners with observer> ask turtle-set map [a -> last but-last a] removed-fatherships [ if my-job != nobody [ ask my-job [ set my-worker nobody ] ] if my-school != nobody [ ask my-school [ set my-students other my-students ] ] die] (bit long, ok).

Under those conditions, I get removed-fatherships to length 8 at step 14. This means that even if the kids are very small, I'll get a re-add before long - that is, if the kids are 12, they will get to 18 in 72 steps.. how old are they? And then there's just a chance they get re-added- should have tweaked that too.

Indeed, it uncooly arrived to 230 steps without anything happening. I'm starting to think it's the turtle-set that solved it for dead fathers - maybe it's a dead offspring?

And yes, it was a dead OFFSPRING - exactly same error obtained - something that points to family reunitions happening too rarely. Let's review that:

       if (random-float 1) < 6 / (first a) [
         ask last a [ create-offspring-link-from father ]
         set removed-fatherships remove a removed-fatherships
       ]

Can't find a way to explain that - 6 / the number of ticks? That variable contains ((18 * ticks-per-year + birth-tick) - ticks). Well it's ok, it amounts to just the number of ticks spent in separation, and makes them slower to return. However, in two years they should all be back.

@mariopaolucci
Copy link
Contributor Author

Ok, it should be solved when interface goes up.. in the end I clean up the list during the death routine.

@mariopaolucci mariopaolucci linked a pull request May 7, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant