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

Feed herbivores in random order #37

Open
wtraylor opened this issue May 11, 2021 · 0 comments
Open

Feed herbivores in random order #37

wtraylor opened this issue May 11, 2021 · 0 comments
Labels
performance Performance improvement

Comments

@wtraylor
Copy link
Owner

One of the most time-consuming parts of the model is calculating the equal forage distribution in Fauna::DistributeForageEqually::operator(). It takes several loops over all herbivores to query their forage demands and feed them.

An alternative to distributing the forage equally is to distribute it randomly:
Successively, herbivores are drawn randomly and receive their full demand—until either all herbivores are fed (times of plenty) or until there’s no more forage (times of scarcity).

Since the model runs on a daily schedule, the randomization should lead reliably to an equal distribution.
Say that there are 20 cohorts (lifespan=20 years). In times of extreme forage scarcity, it will take on average 20 days for every herbivore cohort to get its share.

@wtraylor wtraylor added the performance Performance improvement label May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance improvement
Projects
None yet
Development

No branches or pull requests

1 participant