Skip to content

Assorted fixes#2314

Merged
triceo merged 5 commits into
TimefoldAI:mainfrom
triceo:neighborhoods-bugs
May 27, 2026
Merged

Assorted fixes#2314
triceo merged 5 commits into
TimefoldAI:mainfrom
triceo:neighborhoods-bugs

Conversation

@triceo

@triceo triceo commented May 22, 2026

Copy link
Copy Markdown
Collaborator

See attached issue for a description of what was wrong.
Independent bugs, independent commits. Will not be squashed.

Copilot AI review requested due to automatic review settings May 22, 2026 11:17
@triceo triceo linked an issue May 22, 2026 that may be closed by this pull request
@triceo triceo self-assigned this May 22, 2026
@triceo triceo requested a review from zepfred May 22, 2026 11:22

Copilot AI 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.

Pull request overview

This PR addresses two independent defects by (1) fixing neighborhood stream iteration state handling to avoid persisting invalid iterators across solver steps, and (2) changing multiple config classes to store class references as class-name strings (resolved lazily) so config I/O remains stable and inheritance works on raw configured values.

Changes:

  • Removed tuple-store-based caching of right-side iterators and replaced it with iterator-local caching in BiRandomMoveIterator.
  • Simplified left dataset instantiation by removing the now-unused “right iterator store index” plumbing.
  • Introduced ConfigUtils.resolveClass(...) and updated many config classes to store class names (String) instead of Class<?>, resolving on demand in getters/visitors.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/stream/enumerating/uni/UniLeftDatasetInstance.java Updates constructor/signature to match removal of right-iterator store index.
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/stream/enumerating/uni/UniLeftDataset.java Updates dataset instantiation API to only reserve/pass entry store index.
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/stream/enumerating/uni/LeftTerminalUniEnumeratingStream.java Reserves a single tuple store index for left dataset instance creation.
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/stream/enumerating/common/AbstractLeftDatasetInstance.java Removes right-iterator store index field/accessor.
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/stream/enumerating/common/AbstractLeftDataset.java Updates abstract instantiate signature to reflect removed index.
core/src/main/java/ai/timefold/solver/core/impl/neighborhood/stream/BiRandomMoveIterator.java Fixes iterator caching scope by storing right iterators in a local map instead of tuple store.
core/src/main/java/ai/timefold/solver/core/config/util/ConfigUtils.java Adds resolveClass(...) helper for lazy class resolution from stored class-name strings.
core/src/main/java/ai/timefold/solver/core/config/solver/SolverManagerConfig.java Stores threadFactoryClass as string; resolves lazily in getter/visitor/inheritance.
core/src/main/java/ai/timefold/solver/core/config/solver/SolverConfig.java Stores threadFactoryClass, solutionClass, entityClassList, nearbyDistanceMeterClass as strings; resolves lazily and inherits raw values.
core/src/main/java/ai/timefold/solver/core/config/score/director/ScoreDirectorFactoryConfig.java Stores calculator/provider classes as strings; resolves lazily and inherits raw values.
core/src/main/java/ai/timefold/solver/core/config/phase/custom/CustomPhaseConfig.java Stores custom phase command classes as strings; resolves lazily and inherits raw values.
core/src/main/java/ai/timefold/solver/core/config/partitionedsearch/PartitionedSearchPhaseConfig.java Stores partitioner class as string; resolves lazily and inherits raw value.
core/src/main/java/ai/timefold/solver/core/config/localsearch/LocalSearchPhaseConfig.java Stores neighborhood provider class as string; resolves lazily and inherits raw value.
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/value/ValueSelectorConfig.java Stores several selector-related classes as strings; resolves lazily and inherits raw values.
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/move/generic/MultistageMoveSelectorConfig.java Stores stage provider/entity classes as strings; resolves lazily and inherits raw values.
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/move/generic/list/ListMultistageMoveSelectorConfig.java Stores stage provider class as string; resolves lazily and inherits raw value.
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/move/factory/MoveListFactoryConfig.java Stores move list factory class as string; resolves lazily and inherits raw value.
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/move/factory/MoveIteratorFactoryConfig.java Stores move iterator factory class as string; resolves lazily and inherits raw value.
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/move/composite/UnionMoveSelectorConfig.java Stores probability weight factory class as string; resolves lazily and inherits raw value.
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/entity/EntitySelectorConfig.java Stores selector-related classes as strings; resolves lazily (but toString() now resolves too).
core/src/main/java/ai/timefold/solver/core/config/heuristic/selector/common/nearby/NearbySelectionConfig.java Stores nearby distance meter class as string; resolves lazily and inherits raw value.
core/src/main/java/ai/timefold/solver/core/config/constructionheuristic/placer/QueuedValuePlacerConfig.java Stores entity class as string; resolves lazily and inherits raw value.

Comment thread core/src/main/java/ai/timefold/solver/core/config/util/ConfigUtils.java Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated no new comments.

@triceo triceo changed the title Fix two Neighborhoods bugs Assorted fixes May 23, 2026

@zepfred zepfred 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.

I have some questions regarding the variable type changes. If we want to proceed with the current approach, we should double-check all configuration classes and ensure that the same approach is used.

Comment thread quarkus-integration/quarkus/reflection-integration-test/pom.xml
Copilot AI review requested due to automatic review settings May 25, 2026 14:26
@triceo triceo force-pushed the neighborhoods-bugs branch from 80e6322 to 69cb942 Compare May 25, 2026 14:26
@triceo triceo requested a review from zepfred May 25, 2026 14:26

Copilot AI 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.

Pull request overview

Copilot reviewed 43 out of 43 changed files in this pull request and generated 3 comments.

@zepfred zepfred 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.

Do we know whether the type change affects the Quarkus or Spring modules?

For example, we are still using the type Class in SolverBuildTimeConfig#nearbyDistanceMeterClass.

Other than that, the change looks good to me.

@triceo

triceo commented May 27, 2026

Copy link
Copy Markdown
Collaborator Author

There is no indication that this change is backwards incompatible in any way. Quarkus tests pass, Quickstarts work without any changes.

This prevents things such as colors in terminal, or mvn version:set

Copilot AI 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.

Pull request overview

Copilot reviewed 44 out of 44 changed files in this pull request and generated no new comments.

@triceo triceo merged commit b701d2c into TimefoldAI:main May 27, 2026
19 of 20 checks passed
@triceo triceo deleted the neighborhoods-bugs branch May 27, 2026 14:25
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
64.5% Coverage on New Code (required ≥ 70%)
9.9% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube Cloud

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.

Improve error message: misconfigured neighborhood feature.

3 participants