Skip to content

fix: compare precomputed Solution objects - #453

Merged
barrosyan merged 1 commit into
PINNeAPPle-Labs:mainfrom
jay23606:codex/issue-450-compare-solution
Oct 11, 2026
Merged

barrosyan merged 1 commit into
PINNeAPPle-Labs:mainfrom
jay23606:codex/issue-450-compare-solution

Conversation

@jay23606

Copy link
Copy Markdown
Contributor

What changed

Allow pp.compare to reuse an already-computed Solution in methods, alongside method names and callables. This avoids retraining existing models, validates that the solution has matching coordinates and fields, and disambiguates repeated method names in output rows.

Closes #450.

Validation

  • python -m pytest tests/test_compare_precomputed_solution.py tests/test_solve_compare_experiment.py -k compare -q (17 passed)
  • ruff check tests/test_compare_precomputed_solution.py
  • ruff format --check tests/test_compare_precomputed_solution.py
  • git diff --check

The new regression tests fail on clean main and pass with this change.

@barrosyan

Copy link
Copy Markdown
Collaborator

Thanks @jay23606, this is clean and matches #450 exactly: reusing the Solution as is, the coordinate/field check with a clear error, and the de-duplicated row names. I ran the new tests and the existing compare tests locally and they pass. I've approved the CI run and will merge once it's green.
One optional follow-up from the issue, if you'd like to take it: the first pinneapple_physics example in scripts/reference/content.py still wraps the trained solution in a function (trained_pinn). It can now pass the solution directly. After editing it, run python scripts/reference/run_examples.py pinneapple_physics and python scripts/reference/build.py. Happy to do it myself in a follow-up otherwise.

@barrosyan
barrosyan merged commit 6282f70 into PINNeAPPle-Labs:main Oct 11, 2026
2 checks passed
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.

pp.compare: accept already-solved Solution objects in methods (now fails with "unhashable type: 'Solution'")

2 participants