HHildenbrandt / evesim

MIT License
0 stars 0 forks source link

probability may become 0 after an event #4

Open EvoLandEco opened 1 month ago

EvoLandEco commented 1 month ago

On cluster, with randomized parameters, there is small chance of hitting the extreme case after an event:

Error in while (t <= age) { : missing value where TRUE/FALSE needed
Calls: <Anonymous> ... resolve.list -> signalConditionsASAP -> signalConditions
In addition: Warning message:
In stats::rexp(1, lamu$prob) : NAs produced
Execution halted

This should be because lamu$prob == 0 .

I think we should add an additional probability-equals-zero check here:

    lamu <- lamu_fn(sim, t)
    ###################################### =>
    if (lamu$prob == 0.0) {
      return("Simulation got stuck (after event happens)")
    }
    ###################################### <=
    t <- t + stats::rexp(1, lamu$prob)
EvoLandEco commented 1 month ago

Fixed in commit e847d5433a3a480a3c94317aadccaf61971572f0 in my branch