Skip to content

1101 Extend integrator classes and reimplement SDE models. #1296

Merged
HenrZu merged 23 commits intomainfrom
1101-negative-compartments-in-stochastic-models
Jul 18, 2025
Merged

1101 Extend integrator classes and reimplement SDE models. #1296
HenrZu merged 23 commits intomainfrom
1101-negative-compartments-in-stochastic-models

Conversation

@reneSchm
Copy link
Member

@reneSchm reneSchm commented Jun 10, 2025

Changes and Information

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

  • Extend IntegratorCore and OdeIntegrator to accept a fixed number of DerivFunctions (rather than only one).
  • Add classes SimulationBase and FlowSimulationBase to avoid code duplication between different Simulations.
  • Add class StochasticModel which is a Compartmental- or FlowModel with additional get_noise function.
  • Add class StochasticSimulation, which makes use of a second DerivFunction to evaluate get_noise.
  • Add class EulerMaruyamaIntegratorCore, implementing a (step of a) Euler-Maruyama scheme.

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

  • Check the naming of new classes, in particular the new Order template parameter, the get_noise function and the XdeIntegrator (maybe "DeIntegrator" or just "Integrator"?).
  • Are there Simulation classes that should be rebuild on the new *base classes now?
  • Should the rescaler used by Euler-Maruyama be modular?

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.

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 #1009
Closes #1101
Closes #1165
Closes #1218

@reneSchm reneSchm self-assigned this Jun 10, 2025
@codecov
Copy link

codecov bot commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 96.96970% with 5 lines in your changes missing coverage. Please review.

Project coverage is 97.35%. Comparing base (3a0d789) to head (57cbe8c).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cpp/memilio/compartments/compartmental_model.h 0.00% 2 Missing ⚠️
cpp/memilio/compartments/stochastic_model.h 75.00% 2 Missing ⚠️
cpp/memilio/compartments/stochastic_simulation.h 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1296      +/-   ##
==========================================
+ Coverage   97.27%   97.35%   +0.08%     
==========================================
  Files         171      174       +3     
  Lines       15117    15015     -102     
==========================================
- Hits        14705    14618      -87     
+ Misses        412      397      -15     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@reneSchm reneSchm requested a review from HenrZu June 16, 2025 08:19
@reneSchm
Copy link
Member Author

@nijawa Could you double check that this PR solves the NaN issues (mathematically) correctly?

Copy link
Contributor

@HenrZu HenrZu left a comment

Choose a reason for hiding this comment

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

code is great :) Some comments. Some functions are short in/missing documentation. Also consider the readthedocs doc. However, it would make sense to update this in the branch there.

@github-project-automation github-project-automation bot moved this from 🏗 Development to 👀 Review in MEmilio: Equation-Based-Models Development Jun 17, 2025
@reneSchm reneSchm requested a review from HenrZu July 15, 2025 13:58
@HenrZu HenrZu merged commit fdaa086 into main Jul 18, 2025
56 of 57 checks passed
@HenrZu HenrZu deleted the 1101-negative-compartments-in-stochastic-models branch July 18, 2025 10:01
@github-project-automation github-project-automation bot moved this from 👀 Review to ✅ Done (Sprint) in MEmilio: Equation-Based-Models Development Jul 18, 2025
@jubicker jubicker moved this from ✅ Done (Sprint) to Done (Total) in MEmilio: Equation-Based-Models Development Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

2 participants