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

Fix starting_solution issues #3177

Merged
merged 10 commits into from Sep 15, 2023
Merged

Conversation

brosaplanella
Copy link
Sponsor Member

@brosaplanella brosaplanella commented Jul 21, 2023

Description

This PR is to solve the issue with the starting_solution when the final cycle was not saved. As discussed in #3101, I think the most robust way forward is to always save the final cycle (even at the expense of consuming a bit more of memory), as it also fixes the last_state.

It also fixes another bug (described in the same issue) which caused the simulation to always take the initial_start_time from the experiment, but it should be taken from the starting_solution if it exists.

Fixes #3101

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

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

You can run unit and doctests together at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f4dfbe7) 99.71% compared to head (9efd58b) 99.71%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3177   +/-   ##
========================================
  Coverage    99.71%   99.71%           
========================================
  Files          248      248           
  Lines        18871    18900   +29     
========================================
+ Hits         18817    18846   +29     
  Misses          54       54           
Files Changed Coverage Δ
pybamm/simulation.py 100.00% <100.00%> (ø)
pybamm/solvers/solution.py 100.00% <100.00%> (ø)

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

@brosaplanella brosaplanella changed the title Always save final cycle (fix starting_solution issue) Fix starting_solution issues Jul 21, 2023
@brosaplanella brosaplanella marked this pull request as draft July 21, 2023 13:50
@brosaplanella brosaplanella marked this pull request as ready for review July 27, 2023 09:51
@rtimms rtimms merged commit 6622ec6 into develop Sep 15, 2023
21 of 22 checks passed
@rtimms rtimms deleted the issue-3101-experiment-starting-solution branch September 15, 2023 10:49
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.

[Bug]: starting_solution does not work if last cycle is not saved
2 participants