-
Notifications
You must be signed in to change notification settings - Fork 2
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
Animal - Feature/multi grid no community #538
Conversation
…adds default classes for territory and community.
…ure as well as updated related animal model tests.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #538 +/- ##
===========================================
- Coverage 95.16% 94.69% -0.48%
===========================================
Files 74 73 -1
Lines 4409 4541 +132
===========================================
+ Hits 4196 4300 +104
- Misses 213 241 +28 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stuff that interfaces with the soil and litter is all fine by me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR is massive, as we all know, and I've might have missed something, but it looks good overall.
I've left a couple of comments, but what really confuses me is the separation of concerns. What methods/information goes into the AnimalCohort
and what goes into the AnimalModel
(and before in the AnimalCommunity
. I'm sure there's a pattern, but I just cannot see it.
…ass and excrement pools
…ImperialCollegeLondon/virtual_rainforest into feature/multi_grid_no_community
Description
Where to even begin! This is scandalously oversized rework of the entire animal module that has taken me over two months. I would never have chosen to do it this way but it happened organically in a manner that has taught me many lessons.
Mea culpa.
This rework combines two major changes:
AnimalCommunity
classMulti-grid occupancy equips each animal cohort with a territory of grid cells (list(int)) that they occupy simultaneously. They forage and deposit wastes uniformly across these cells. Carcasses produced from predation are deposited at the intersection of predator and prey territories. Territories are produced using breadth-first search but this can be made more sophisticated later.
The removal of the
AnimalCommunity
class is a major structural change. This class had been storing per-grid information on animal cohorts, waste pools, and the like as well as running cohort-specific methods in aggregate for those grid cells. Almost all of this functionality is now located within theAnimalModel
class. Animal cohorts and waste pools are now stored as dictionaries inAnimalModel
, tying the occupying lists to specific grid cell ids. The aggregating methods fromAnimalCommunity
have been modified to run over these dictionaries. Removing these community objects has, I hope, made the module significantly easier to understand.I abandoned the
AnimalTerritory
class I had been exploring in an earlier implementation of multi-grid.There are some significant changes to the litter system here as well as it was designed while I was mid re-work. The version I have is a little structurally different than Jacob's original but works the same.
There were some concerns with an earlier version about the amount of indexing going on in the foraging system. This is valid but I simply do not have the time to optimize the foraging system, especially with how behind I am after the rework. Hopefully the structural simplifications made here will simplify making such optimizations in the future, after the remaining required functionality is implemented.
The important files here are animal_model and animal_cohort but unfortunately little tweaks had to be made just about everywhere.
Fixes # (issue)
Type of change
Key checklist
pre-commit
checks:$ pre-commit run -a
$ poetry run pytest
Further checks