Replacing Solution struct with Solution Interface#17
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17 +/- ##
==========================================
+ Coverage 86.76% 87.33% +0.56%
==========================================
Files 27 35 +8
Lines 3687 4136 +449
==========================================
+ Hits 3199 3612 +413
- Misses 440 470 +30
- Partials 48 54 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the solution handling by replacing the concrete Solution struct with a Solution interface, moving solution-related code from the problem package to a new solution package. This enables more flexible implementations of solutions while maintaining backward compatibility through helper functions.
Key changes:
- Replaced concrete
Solutionstruct withSolutioninterface to allow custom implementations - Created new
solutionpackage with interface definition and helper functions - Moved and simplified status constants from
OptimizationStatus_*to shorter names likeNODE_LIMIT
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/solution/solution_test.go | Updated tests to use new solution interface and helper functions |
| solution/status/status.go | New file defining SolutionStatus type with shortened constant names |
| solution/solution.go | New interface definition with helper functions for value extraction |
| solution/dummy_solution.go | Implementation of Solution interface for testing purposes |
| problem/solution.go | Removed old Solution struct and status definitions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Solutionstruct with theSolutioninterface. This should allow anyone to define their own form ofSolutioninterface.SolutionandSolutionStatusout of theproblempackage.Notes
Also, we renamed the
SolutionStatusvalues to be a bit shorter.