Skip to content

chore: improve mixed models#1645

Merged
triceo merged 13 commits into
TimefoldAI:mainfrom
zepfred:chore/mixed-improvement
Jun 16, 2025
Merged

chore: improve mixed models#1645
triceo merged 13 commits into
TimefoldAI:mainfrom
zepfred:chore/mixed-improvement

Conversation

@zepfred

@zepfred zepfred commented Jun 11, 2025

Copy link
Copy Markdown
Contributor

This PR includes improvements necessary for configuring the nearby features. All related tests were added to the enterprise repo.

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 improves the support for mixed models by enabling nearby features and updating the configuration, heuristic, and move selector components accordingly while re-enabling mixed model tests. Key changes include:

  • New documentation describing mixed modeling and construction heuristics.
  • Re-enabling and adjusting tests for mixed model scenarios.
  • Updating phase, heuristic, and move selector configuration to support mixed models (including nearby setting adjustments).

Reviewed Changes

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

Show a summary per file
File Description
docs/src/modules/ROOT/pages/optimization-algorithms/construction-heuristics.adoc Adds documentation for mixed modeling and construction heuristics.
core/src/test/java/ai/timefold/solver/core/impl/solver/DefaultSolverTest.java Re-enables and updates mixed model test cases.
core/src/test/java/ai/timefold/solver/core/impl/heuristic/selector/move/generic/list/SubListSwapMoveSelectorFactoryTest.java
core/src/test/java/ai/timefold/solver/core/impl/heuristic/selector/move/generic/list/SubListChangeMoveSelectorFactoryTest.java
core/src/test/java/ai/timefold/solver/core/impl/constructionheuristic/DefaultConstructionHeuristicPhaseTest.java
Removes previously disabled mixed model tests.
core/src/main/java/ai/timefold/solver/core/impl/phase/PhaseFactory.java Adds logic to disable nearby settings for mixed models and updates config policy accordingly.
core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/list/SubListSelectorFactory.java Ensures a variable name is set for mixed models when none is provided.
core/src/main/java/ai/timefold/solver/core/impl/heuristic/HeuristicConfigPolicy.java Adds a method to copy config policy without nearby settings.
Core configuration files for move selector configs (KOpt, ListSwap, ListChange, TailChainSwap, Swap, Change, Union) and NearbyAutoConfigurationEnabled.java Updates implementations of canEnableNearbyInMixedModels according to mixed model requirements.
Comments suppressed due to low confidence (3)

core/src/main/java/ai/timefold/solver/core/impl/heuristic/selector/list/SubListSelectorFactory.java:119

  • [nitpick] When automatically setting the variable name for mixed models, consider adding a validation or clarifying comment to ensure the correct list variable is selected if multiple exist.
if (configPolicy.getSolutionDescriptor().hasBothBasicAndListVariables() && valueSelectorConfig.getVariableName() == null) {

core/src/main/java/ai/timefold/solver/core/impl/phase/PhaseFactory.java:71

  • [nitpick] Consider adding a brief inline comment explaining why disabling the nearby setting is necessary for mixed models to improve future maintainability.
var disableNearbySetting = configPolicy.getNearbyDistanceMeterClass() != null && entityPlacerConfig != null && QueuedEntityPlacerConfig.class.isAssignableFrom(entityPlacerConfig.getClass()) && configPolicy.getSolutionDescriptor().hasBothBasicAndListVariables();

core/src/test/java/ai/timefold/solver/core/impl/solver/DefaultSolverTest.java:1657

  • With the re-enabling of mixed model tests, verify that sufficient tests exist for both success and failure scenarios to ensure stable behavior in edge cases.
void failMixedModel() {

@zepfred zepfred marked this pull request as ready for review June 12, 2025 18:09
@zepfred zepfred had a problem deploying to documentation (preview) June 12, 2025 18:09 — with GitHub Actions Failure
@zepfred

zepfred commented Jun 13, 2025

Copy link
Copy Markdown
Contributor Author

Quality Gate Failed Quality Gate failed

Failed conditions 59.7% Coverage on New Code (required ≥ 70%) 7.7% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube Cloud

The coverage is achieved through the new tests on the enterprise repository, and duplication does not seem important.

@triceo triceo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM when comments resolved.

Comment thread core/src/main/java/ai/timefold/solver/core/impl/phase/PhaseFactory.java Outdated
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
59.7% Coverage on New Code (required ≥ 70%)
7.9% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube Cloud

@triceo triceo merged commit 23ff23d into TimefoldAI:main Jun 16, 2025
39 of 43 checks passed
@zepfred zepfred deleted the chore/mixed-improvement branch March 10, 2026 16:47
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.

3 participants