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

894 Implement dynamic optimization #895

Merged
merged 398 commits into from
May 17, 2024
Merged

Conversation

hannemann-tamas
Copy link
Contributor

@hannemann-tamas hannemann-tamas commented Jan 15, 2024

Changes and Information

Please briefly list the changes made, additional Information and what the Reviewer should look out for:

  • Implemented ODE-SEAIR model to reproduce optimization results from literature.
  • Integrating automatic differentiation (AD) for ODE-SEAIR model.
  • Extending template structure for AD data type.
  • Implemented dynamic optimization example using IPopt.

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
  • 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.)

Closes #894

@hannemann-tamas hannemann-tamas marked this pull request as draft January 15, 2024 13:12
cpp/tests/test_ad.cpp Outdated Show resolved Hide resolved
cpp/models/ode_seir/model.h 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.

cpp/benchmarks/flow_simulation_ode_seir.cpp Outdated Show resolved Hide resolved
cpp/benchmarks/flow_simulation_ode_seir.cpp Outdated Show resolved Hide resolved
cpp/benchmarks/flow_simulation_ode_seir.cpp Outdated Show resolved Hide resolved
cpp/benchmarks/flow_simulation_ode_seir.cpp Outdated Show resolved Hide resolved
cpp/benchmarks/flow_simulation_ode_seir.cpp Outdated Show resolved Hide resolved
cpp/tests/test_ad.cpp Outdated Show resolved Hide resolved
@reneSchm
Copy link
Member

All right, all tests passed, no open conversations. But there are some things missing from test coverage, most not originating from this PR. Here is a list of the missed lines:

  • cpp/models/ode_secirvvs/parameter_space.h
    • 64f: untested log_error and assert
    • 182: unused value for delta_fac
  • cpp/memilio/utils/logging.h
    • 136f: The struct fmt::formatter<ad::gt1s<double>::type> is not covered by tests, the other struct appears unused. We should cover this, probably only using some fmt function or the structs directly.
  • cpp/memilio/epidemiology/uncertain_matrix.h
    • 82f: operator=, maybe should be covered.
  • cpp/models/ode_secir/parameters_io.h
    • 156f: A warning in set_confirmed_cases_data; Reading the warning suggests that we may want to return a failure there instead, which then should definitely be covered.
    • 249: Another warning; similar to above.
  • cpp/models/ide_seir/model.h
    • 85f: log_warning
  • cpp/memilio/math/integrator.h
    • 142 & 145: log_warnings on step sizing. I think they don't have to be covered.
  • cpp/memilio/compartments/compartmentalmodel.h
    • 98f: get_derivatives: If someone knows how to test a virtual undefined function, have at it.
  • cpp/memilio/epidemiology/populations.h
    • 257: log_error
  • cpp/models/ode_secirvvs/parameters_io.h
    • 451: log_warning; should maybe return a failure?
  • cpp/models/sde_sirs/simulation.h
    • 78f: simulate function, in my opinion should not be covered.
  • cpp/models/sde_sir/simulation.h
    • 78f: simulate function, in my opinion should not be covered.
  • cpp/memilio/utils/uncertain_value.h
    • 233f: PrintTo function used for testing. Maybe we should move it into the test directory?

Other than maybe changes for the tests, I think we are done here @HenrZu @jubicker @lenaploetzke @mknaranja ?

@lenaploetzke
Copy link
Member

I think we are done here @HenrZu @jubicker @lenaploetzke @mknaranja ?

Yes, I think so too, the things you mentioned are probably something for a new issue.

@mknaranja
Copy link
Member

I hope to have a brief look at this tomorrow. Is there only someone who could resolve the last merge conflicts?

Thank you all for this tremendous work!

@reneSchm
Copy link
Member

Is there only someone who could resolve the last merge conflicts?

Hey, those weren't there before! Anyways, I'm on it...

@reneSchm
Copy link
Member

Merge is done, thanks @MaxBetzDLR for your help

@mknaranja mknaranja dismissed reneSchm’s stale review May 17, 2024 09:14

Worked on it

@mknaranja mknaranja merged commit bcfa8d3 into SciCompMod:main May 17, 2024
69 checks passed
@mknaranja
Copy link
Member

Fantastic! Thanks again for the tremendous work to finally merge this @hannemann-tamas @reneSchm @HenrZu @lenaploetzke @jubicker @MaxBetzDLR

reneSchm added a commit that referenced this pull request May 24, 2024
…ples (#895)

- Implemented ODE-SEAIR model to reproduce optimization results from literature.
- Integrating automatic differentiation (AD) for ODE-SEAIR model.
- Extending template structure for AD data type.
- Implemented dynamic optimization example using IPopt.

Co-authored-by: Ralf Hannemann-Tamas <[email protected]>
Co-authored-by: Martin J. Kühn <[email protected]>
Co-authored-by: reneSchm <[email protected]>
Co-authored-by: lenaploetzke <[email protected]>
Co-authored-by: HenrZu <[email protected]>
Co-authored-by: Julia Bicker <[email protected]>
Co-authored-by: Maximilian Betz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement dynamic optimization using algorithmic differentiation
8 participants