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

1039 Add functions for the Person to choose whether to comply to mask,test and isolation #1040

Merged

Conversation

khoanguyen-dev
Copy link
Member

@khoanguyen-dev khoanguyen-dev commented May 24, 2024

Changes and Information

Please briefly list the changes (main added features, changed items, or corrected bugs) made:

  • Add a file for different NPI types
  • The compliance levels are presented as a member vector in the Person class.
  • Add functions to set and get compliance levels in the Person class.
  • Add different functions to check wether a Person is complying to these NPIs.

If need be, add additional information and what the reviewer should look out for in particular:

  • See World::migration for apply_mask_intervention()
  • See TestingStrategy::run_strategy for apply_test_intervention()
  • See Person::get_tested for apply_isolation_intervention()

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

  • Every addressed issue is linked (use the "Closes #ISSUE" keyword below)
  • New code adheres to coding guidelines
  • No large data files have been added (files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
  • Tests are added for new functionality and a local test run was successful (with and without OpenMP)
  • Appropriate documentation for new functionality has been added (Doxygen in the code and Markdown files if necessary)
  • Proper attention to licenses, especially no new third-party software with conflicting license has been added
  • (For ABM development) Checked benchmark results and ran and posted a local test above from before and after development to ensure performance is monitored.

Run on (8 X 24.121 MHz CPU s)
CPU Caches:
L1 Data 64 KiB (x8)
L1 Instruction 128 KiB (x8)
L2 Unified 4096 KiB (x2)
Load Average: 2.98, 4.30, 4.88

  • Main branch

Benchmark Time CPU Iterations

abm_benchmark/abm_benchmark_50k 2247 ms 2242 ms 1
abm_benchmark/abm_benchmark_100k 4691 ms 4619 ms 1
abm_benchmark/abm_benchmark_200k 8577 ms 8299 ms 1

  • 1039 branch

Benchmark Time CPU Iterations

abm_benchmark/abm_benchmark_50k 2044 ms 2040 ms 1
abm_benchmark/abm_benchmark_100k 4169 ms 4098 ms 1
abm_benchmark/abm_benchmark_200k 8243 ms 8168 ms 1

Checks by code reviewer(s)

  • Corresponding issue(s) is/are linked and addressed
  • Code is clean of development artifacts (no deactivated or commented code lines, no debugging printouts, etc.)
  • Appropriate unit tests have been added, CI passes, code coverage and performance is acceptable (did not decrease)
  • No large data files added in the whole history of commits(files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
  • On merge, add 2-5 lines with the changes (main added features, changed items, or corrected bugs) to the merge-commit-message. This can be taken from the briefly-list-the-changes above (best case) or the separate commit messages (worst case).

Closes #1039
Closes #503

@khoanguyen-dev khoanguyen-dev linked an issue May 24, 2024 that may be closed by this pull request
2 tasks
@khoanguyen-dev khoanguyen-dev changed the title Add functions for the Person to choose whether to comply to mask,test and isolation 1039 Add functions for the Person to choose whether to comply to mask,test and isolation May 24, 2024
Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 98.59155% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.54%. Comparing base (cb5affd) to head (990fe6b).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
cpp/models/abm/model.cpp 96.96% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1040      +/-   ##
==========================================
+ Coverage   96.42%   96.54%   +0.11%     
==========================================
  Files         132      135       +3     
  Lines       11061    10906     -155     
==========================================
- Hits        10666    10529     -137     
+ Misses        395      377      -18     
Flag Coverage Δ
96.54% <98.59%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@reneSchm reneSchm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not yet looked at the tests, but here is most of the review,

cpp/models/abm/intervention_type.h Outdated Show resolved Hide resolved
cpp/models/abm/location.h Outdated Show resolved Hide resolved
cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/models/abm/person.cpp Outdated Show resolved Hide resolved
cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/models/abm/world.cpp Outdated Show resolved Hide resolved
cpp/models/abm/location.h Outdated Show resolved Hide resolved
cpp/models/abm/location.h Outdated Show resolved Hide resolved
cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/models/abm/person.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_person.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_person.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_testing_strategy.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_testing_strategy.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_world.cpp Outdated Show resolved Hide resolved
@reneSchm
Copy link
Member

I just noticed that the compliance vector looks very much like a parameter, especially with the getter/setter. We could think about putting it into a Person specific ParameterSet, as well as probably m_age or the random-group/hour variables; but probably in another PR.

cpp/models/abm/person.h Outdated Show resolved Hide resolved
Copy link
Member

@DavidKerkmann DavidKerkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I have a lot of small comments and only one big one regarding the mask wearing logic. Perhaps you can give some comments.

Also, I can't remember exactly: What did we discuss in terms of checking/not checking from the location side? Right now the measures are enforced always when active. Didn't we think about an option to activate/deactivate the checks at the location?

cpp/models/abm/person.h Outdated Show resolved Hide resolved
cpp/benchmarks/abm.cpp Outdated Show resolved Hide resolved
cpp/models/abm/person.cpp Outdated Show resolved Hide resolved
cpp/models/abm/person.cpp Outdated Show resolved Hide resolved
cpp/models/abm/person.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_person.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_person.cpp Show resolved Hide resolved
cpp/tests/test_abm_world.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_world.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_world.cpp Outdated Show resolved Hide resolved
Copy link
Member

@DavidKerkmann DavidKerkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good for me. I only have one more small question that is still open.

cpp/tests/test_abm_testing_strategy.cpp Outdated Show resolved Hide resolved
@khoanguyen-dev
Copy link
Member Author

For your comment @DavidKerkmann (#1040 (comment)):
I realised that the testing_scheme_2 is not actually active so at one time the second person agrees to test but it's not performed. I have now added some more comments to clarify the number of draws.

cpp/models/abm/mask_type.h Outdated Show resolved Hide resolved
cpp/models/abm/person.cpp Outdated Show resolved Hide resolved
cpp/models/abm/person.cpp Outdated Show resolved Hide resolved
cpp/models/abm/world.cpp Outdated Show resolved Hide resolved
cpp/models/abm/world.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_testing_strategy.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_testing_strategy.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_world.cpp Outdated Show resolved Hide resolved
Copy link
Member

@DavidKerkmann DavidKerkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some renaming and the open issue about the compliance in combination with several tests is open until this can be merged. I suppose we wait until #866 is merged to use the TestResult feature.

cpp/models/abm/model.cpp Outdated Show resolved Hide resolved
cpp/models/abm/model.cpp Outdated Show resolved Hide resolved
cpp/models/abm/model.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_model.cpp Outdated Show resolved Hide resolved
Copy link
Member

@DavidKerkmann DavidKerkmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my side no new things, just the things left from Renes review that I didn't all check. Especially the bug in the compliance with isolation and repeated testing needs to be fixed now that the test certificates have been merged to main.

Copy link
Member

@reneSchm reneSchm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two changes two test comments and (maybe?) a reformat, other than that I think this looks good.

cpp/models/abm/model.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_testing_strategy.cpp Outdated Show resolved Hide resolved
cpp/tests/test_abm_testing_strategy.cpp Outdated Show resolved Hide resolved
Copy link
Member

@reneSchm reneSchm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new additions this looks good to me.

@reneSchm reneSchm merged commit 9020edf into main Sep 27, 2024
58 checks passed
@reneSchm reneSchm deleted the 1039-implement-agents-compliance-to-mask-test-and-isolation branch September 27, 2024 08:42
@mknaranja
Copy link
Member

mknaranja commented Sep 27, 2024

@reneSchm @DavidKerkmann pls always check (and "check") reviewer boxes above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants