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

Simplify and optimize TestingScheme #755

Closed
2 tasks done
dabele opened this issue Aug 25, 2023 · 1 comment · Fixed by #752
Closed
2 tasks done

Simplify and optimize TestingScheme #755

dabele opened this issue Aug 25, 2023 · 1 comment · Fixed by #752
Assignees
Labels
class::performance Performance related issues model::abm This issue concerns any kind of agent-based model. prio::moderate The priority of this task is moderate.

Comments

@dabele
Copy link
Member

dabele commented Aug 25, 2023

Motivation / Current Behaviour

The TestingScheme is currently one of the most expensive parts of the main simulation loop. There is also a lot of dynamic data (vectors). There are significant performance gains possible.

Enhancement description

  • Use bitset (one bit per location type/infection state/age) instead of vector for TestingCriteria. There is a fixed number of location types, infection states, etc. No need for a dynamic container.
  • Only one TestingCriteria per TestingScheme. Removes more dynamic data.
  • We should also think about not running all TestingSchemes in all cases, check location first maybe?

Each of the first two changes is ~5% runtime. The first change is always good. the gain for the second change depends on how often there are testingschemes with multiple criterias. Right now there is always only one Criteria anyway. If this leads to many more TestingSchemes, it may not improve performance. But the code is still much simpler.

The third change needs to be discussed. But the potential gain is huge, not running the schemes or only running them conditionally potentially decreases runtime by 50%.

An almost finished implementation of the first two changes is here: 629-parallelize-abm-optimize-testing

Additional context

No response

Checklist

  • Attached labels, especially loc:: or model:: labels.
  • Linked to project
@dabele dabele added prio::moderate The priority of this task is moderate. model::abm This issue concerns any kind of agent-based model. class::performance Performance related issues labels Aug 25, 2023
@dabele dabele changed the title Simpler TestingScheme Simplify and optimize TestingScheme Aug 25, 2023
@khoanguyen-dev khoanguyen-dev self-assigned this Sep 4, 2023
@khoanguyen-dev khoanguyen-dev moved this from Product Backlog to Sprint Backlog in MEmilio: Agent-Based-Model Sep 6, 2023
@khoanguyen-dev khoanguyen-dev moved this from Sprint Backlog to Development in MEmilio: Agent-Based-Model Sep 8, 2023
@khoanguyen-dev
Copy link
Member

Also considered in issue #369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
class::performance Performance related issues model::abm This issue concerns any kind of agent-based model. prio::moderate The priority of this task is moderate.
Projects
Status: Done (Total) 💯
2 participants