bradduthie / resevol

BBSRC FAPESP Newton Funded Project to model how the spatial scale of heterogeneity in fungal isolate application and crop plant cultivation affects variation in the selection landscape for biopesticide resistance.
3 stars 0 forks source link

Diploid simulations taking too long #36

Open bradduthie opened 3 years ago

bradduthie commented 3 years ago

Diploid simulations are taking too long; there is no reason that I can see why they should be taking orders of magnitude longer than haploid simulations. I need to figure out why this is and fix it as best as possible. There's just no reason that I can tell why add_sexual, sire_genes, or assign_sire should be taking so long. The way that the traits are inserted, mutation occurs, or inbreeding coefficients are calculated also just shouldn't take that much time. Maybe calling is_in_range so many times is the problem?

bradduthie commented 3 years ago

Long hanging fruit is to not call is_in_range in any loop unless other criteria of opp_sex, age, min_age, and max_age are met. This might lower time a bit, though the need to loop through all individuals still remains. I don't think that there's a way to avoid this loop.

bradduthie commented 3 years ago

In the reproduction type, specifically, there is no need to even call mate_available if the sex, min_age, or max_age are not appropriate.

bradduthie commented 3 years ago

I've made some progress on this now with the above commits, but I'm going to leave this issue open just to keep it in mind. Even with the fixes, the diploid simulations are taking much more time, mainly to get the paternal genome integrated into the offspring; if there is a way to do this more quickly, then it would be good to find it!