wengngai / NSSF_IBMs

Spatially explicit individual based models of tree species in the Nee Soon Freshwater Swamp Forest (NSSF) catchment in Singapore
1 stars 0 forks source link

Identify choke points #2

Closed hrlai closed 3 years ago

hrlai commented 3 years ago

Prioritise improvement on choke points that are time consuming.

hrlai commented 3 years ago

The most time-consuming step by far is # Extract competition measures

hrlai commented 3 years ago

spDists is probably the key culprit, especially with distance matrix growing exponentially with increasing number of individuals in later time steps.

hrlai commented 3 years ago

following from above, target inter.calc and inter.dist.calc to improve efficiency (both uses spDists)

hrlai commented 3 years ago

Several suggestions to improve the efficiency of calculating pairwise distances:

  1. keep the pairwise distances of surviving individuals, and only calculate new distances for new individuals
  2. loop the calculate per focal individuals, and remove grids that are too far away (using a pre-calculated grid-to-grid distance matrix) before calculating pairwise distances for that focal individual
hrlai commented 3 years ago

zz and big.mat are also extremely large and grow with number of individuals, but should be mitigated with parallerisation at the individual level with 24399f981a4458a4f1c04255d4e3851c104df191

hrlai commented 3 years ago

Parallerisation partially fix the memory issue when run on each individual and omit things outside of grid boundaries. Close for now.