refactor: clean up around problem changes#2121
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the solver's problem change handling and removes deprecated functionality. It modernizes the API by removing ProblemFactChange in favor of ProblemChange, converting BestSolutionChangedEvent from a class to an interface, and eliminating the unused NoChangePhase feature along with its associated configuration and implementation files.
Changes:
- Removed deprecated
NoChangePhasefunctionality (class, factory, config, tests, XSD definitions) - Removed deprecated
ProblemFactChangeAPI in favor ofProblemChange - Converted
BestSolutionChangedEventfrom a class to an interface withDefaultBestSolutionChangedEventas its implementation - Removed
ProblemChangeAdapterand updated problem change processing to work directly withProblemChange - Removed deprecated
addProblemFactChange*andisEveryProblemFactChangeProcessedmethods fromSolverinterface - Updated test code to use modern Java
varsyntax and simplified API - Fixed typo "occured" → "occurred" in SolveEventProducerId
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/resources/solver.xsd | Removed noChangePhase element and type definitions |
| tools/benchmark/src/main/resources/benchmark.xsd | Removed noChangePhase element and type definitions |
| spring-integration/.../reflect-config.json | Removed NoChangePhaseConfig reflection configuration |
| spring-integration/.../solver-full.xml | Removed noChangePhase test element |
| quarkus-integration/.../gizmoSupplierTestSolverConfig.xml | Removed noChangePhase test element |
| core/.../testSolverConfigWithoutNamespace.xml | Removed noChangePhase test element |
| core/.../NoChangePhase.java | Deleted deprecated phase implementation |
| core/.../NoChangePhaseFactory.java | Deleted deprecated phase factory |
| core/.../NoChangePhaseConfig.java | Deleted deprecated phase configuration |
| core/.../NoChangePhaseTest.java | Deleted test for deprecated functionality |
| core/.../ProblemFactChange.java | Deleted deprecated interface |
| core/.../ProblemChangeAdapter.java | Deleted adapter interface |
| core/.../BestSolutionChangedEvent.java | Converted from class to interface |
| core/.../DefaultBestSolutionChangedEvent.java | New implementation of BestSolutionChangedEvent interface |
| core/.../Solver.java | Removed deprecated methods and updated to use @NullMarked |
| core/.../DefaultSolver.java | Updated to use ProblemChange directly, removed deprecated methods |
| core/.../BasicPlumbingTermination.java | Changed to use ProblemChange instead of ProblemChangeAdapter |
| core/.../BasicPlumbingTerminationTest.java | Updated tests to use modern syntax and new API |
| core/.../EventProducerId.java | Removed deprecated unknown() method |
| core/.../SolveEventProducerId.java | Removed UNKNOWN enum value, fixed spelling |
| core/.../PhaseType.java | Removed NO_CHANGE enum value |
| core/.../PhaseFactory.java | Removed NoChangePhaseConfig handling |
| core/.../AbstractPhaseFactory.java | Removed NoChangePhaseFactory check |
| core/.../SolverConfig.java | Removed NoChangePhaseConfig from XML elements |
| core/.../PhaseConfig.java | Removed NoChangePhaseConfig from subclasses |
| core/.../PartitionedSearchPhaseConfig.java | Removed NoChangePhaseConfig from XML elements |
| core/.../CompositeMoveSelector.java | Reformatted long error message |
| core/.../AbstractSolver.java | Removed unused isTerminationSameAsSolverTermination method |
| docs/TODO.md | Added items for BestSolutionChangedEvent and ProblemChange changes |
core/src/main/java/ai/timefold/solver/core/api/solver/event/BestSolutionChangedEvent.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ai/timefold/solver/core/impl/solver/DefaultSolver.java
Show resolved
Hide resolved
Christopher-Chianelli
left a comment
There was a problem hiding this comment.
LGTM after Copilot suggestions are applied (in particular, if there are multiple ProblemChanges, a later ProblemChange may have to deal with a working solution with stale shadow variables since the adapter (that was removed) used to call updateShadowVariables). We probably should add a test for this case.
|



No description provided.