Conversation
- we now identify Location using their LocationID - LocationID is now serializable - added a (naively implemented) get_location
also needed to reformat tests to use IDs instead of references
provide global interact/migrate functions, independent of world World::m_persons no longer uses pointers adjust tests and other files accordingly
(according to clangd)
completely rework caching of exposure rates, change interface of mio::abm::interact
renamed to PersonalRandomNumber. make PersonId a TypeSafe, move it to its own header.
add a few consts
avoid creating Location objects, do not rebuild exposure caches
DavidKerkmann
left a comment
There was a problem hiding this comment.
Thanks for the changes! One idea:
We could omit the parameter LocationType in a lot of places where it is only necessary to identify the location, as the Id is unique for a location. Of course, this needs to stay for functions like get/set_assigned_location.
khoanguyen-dev
left a comment
There was a problem hiding this comment.
There are some comments that need to be updated. Otherwise, except for David's comments, it all looks good to me.
My IDE usually complaints if there are unused variables, so I don't think that happens too often in our code. But we probably could rework e.g. the testing strategy, so that it stores two vectors, one for location id and one for type. This way we could also remove all the find-ifs and use constant time lookup instead. |
|
Quick remark: In the benchmark get_subpopulation_combined is very slow, this maybe needs to be investigated. |
This is partially intentional, as get_subpopulation needs to iterate over all persons instead of all persons at the given location, which we currently do not cache. Although get_subpopulation_combined is in fact a lot slower than it has to be right now, instead of calling get_subpopulation it should iterate over all persons exactly once. Something like: size_t World::get_subpopulation_combined(TimePoint t, InfectionState s) const
{
return std::count_if(m_persons.begin(), m_persons.end(), [&](const auto& p) {
return p.get_infection_state(t) == s;
});
} |
|
Thank you! I mean i don't think its high priority, but as it is in the benchmark debuggging, it becomes unusable. Maybe we just think about a better way to debug the benchmark or implement this. but again, very low priority just something i noticed |
Changes and Information
Please briefly list the changes made, additional Information and what the Reviewer should look out for:
Merge Request - Guideline Checklist
Please check our git workflow. Use the draft feature if the Pull Request is not yet ready to review.
Checks by code author
Checks by code reviewer(s)