Skip to content

Add MultiFittingProblem class and example#364

Merged
BradyPlanden merged 150 commits into
developfrom
238b-multi-fitting
Aug 12, 2024
Merged

Add MultiFittingProblem class and example#364
BradyPlanden merged 150 commits into
developfrom
238b-multi-fitting

Conversation

@NicolaCourtier

Copy link
Copy Markdown
Member

Description

Add a new Problem class that accepts multiple fitting problems and returns one combined problem for passing to a cost function. This PR builds on and should be merged after #359.

Issue reference

Fixes part of #238.

Review

Before you mark your PR as ready for review, please ensure that you've considered the following:

  • Updated the CHANGELOG.md in reverse chronological order (newest at the top) with a concise description of the changes, including the PR number.
  • Noted any breaking changes, including details on how it might impact existing functionality.

Type of change

  • New Feature: A non-breaking change that adds new functionality.
  • Optimization: A code change that improves performance.
  • Examples: A change to existing or additional examples.
  • Bug Fix: A non-breaking change that addresses an issue.
  • Documentation: Updates to documentation or new documentation for new features.
  • Refactoring: Non-functional changes that improve the codebase.
  • Style: Non-functional changes related to code style (formatting, naming, etc).
  • Testing: Additional tests to improve coverage or confirm functionality.
  • Other: (Insert description of change)

Key checklist:

  • No style issues: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All unit tests pass: $ nox -s tests
  • The documentation builds: $ nox -s doctest

You can run integration tests, unit tests, and doctests together at once, using $ nox -s quick.

Further checks:

  • Code is well-commented, especially in complex or unclear areas.
  • Added tests that prove my fix is effective or that my feature works.
  • Checked that coverage remains or improves, and added tests if necessary to maintain or increase coverage.

Thank you for contributing to our project! Your efforts help us to deliver great software.

@codecov

codecov Bot commented Jun 14, 2024

Copy link
Copy Markdown

Codecov Report

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

Project coverage is 98.67%. Comparing base (a921c8f) to head (7eeeb00).
Report is 488 commits behind head on develop.

Files with missing lines Patch % Lines
pybop/models/base_model.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #364      +/-   ##
===========================================
- Coverage    98.68%   98.67%   -0.02%     
===========================================
  Files           46       47       +1     
  Lines         2971     3015      +44     
===========================================
+ Hits          2932     2975      +43     
- Misses          39       40       +1     

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

@brosaplanella brosaplanella left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good, nice work! See my comment on the parameters.

Comment thread examples/scripts/multi_fitting.py Outdated
Base automatically changed from 358-passing-inputs to develop July 4, 2024 14:19
@NicolaCourtier NicolaCourtier marked this pull request as ready for review July 4, 2024 15:13

@BradyPlanden BradyPlanden left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this @NicolaCourtier. I think it's coming along well, I've made a few comments for you to look at. As a more general thought, do you see any reason this couldn't be a MultiProblem class that composes multiple instances ofFittingProblem or DesignProblem? Perhaps even combined instances of both (with an update to BaseOptimiser for minimising logic. This seems to be the logical next step, but we could do it now instead of refactoring this class later.

Comment thread pybop/problems/fitting_problem.py Outdated
Comment thread pybop/problems/fitting_problem.py Outdated
Comment thread pybop/problems/fitting_problem.py Outdated
Comment thread pybop/problems/fitting_problem.py Outdated
Comment thread examples/scripts/multi_fitting.py
Comment thread pybop/problems/fitting_problem.py Outdated
Comment thread examples/scripts/multi_fitting.py Outdated
Comment thread tests/integration/test_model_experiment_changes.py
Comment thread pybop/problems/fitting_problem.py Outdated
Comment thread pybop/problems/fitting_problem.py Outdated
@NicolaCourtier NicolaCourtier marked this pull request as draft August 8, 2024 12:14
@NicolaCourtier NicolaCourtier marked this pull request as ready for review August 8, 2024 18:07
@NicolaCourtier

Copy link
Copy Markdown
Member Author

Merge after #451

@BradyPlanden BradyPlanden left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - thanks for the addition @NicolaCourtier!

@BradyPlanden BradyPlanden merged commit 778a72f into develop Aug 12, 2024
@BradyPlanden BradyPlanden deleted the 238b-multi-fitting branch August 12, 2024 10:36
@NicolaCourtier NicolaCourtier self-assigned this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants