-
Couldn't load subscription status.
- Fork 161
feat: enable sorting for CH with list variable #1833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zepfred
wants to merge
33
commits into
TimefoldAI:main
Choose a base branch
from
zepfred:feat/list-ch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
6a0f429
chore: update factory class for basic variables
zepfred b77045f
chore: update factory class for planning entities and planning values
zepfred a222d19
chore: update factory class for moves
zepfred f91745a
feat: enable sorting for CH and list variable
zepfred e2345dd
chore: improve tests
zepfred 64eead1
chore: add new tests
zepfred 18e5207
chore: formatting
zepfred 051bcc8
feat: sorting with entity-range
zepfred 9ed8ead
chore: migration recipe
zepfred 59ad835
chore: address comments
zepfred a18f31b
feat: adjust list variable sorting fields
zepfred c3c6208
chore: renaming
zepfred 6e95e67
chore: add CH tests
zepfred 07dc956
chore: add new basic var sorting setting
zepfred 669ba53
chore: update entity sorting settings
zepfred de069a6
chore: address sonar
zepfred 7a0469c
chore: add new factory class setting to entity config
zepfred db55b0d
chore: add new factory class setting to value config
zepfred 3bd71b9
chore: add new factory class setting to move config
zepfred 97a23a2
docs: update sorting documentation
zepfred 50c1664
chore: migration recipes
zepfred 477f4e7
chore: address comments
zepfred 01b5968
docs: minor changes
zepfred f1c8911
chore: address comments
zepfred 9c0b87a
chore: address comments
zepfred 38c183c
chore: address comments
zepfred b18c9e4
chore: address comments
zepfred 0c65111
chore: address comments
zepfred e09cb52
chore: address comments
zepfred c8ffe30
chore: address comments
zepfred 78d417c
chore: address sonar
zepfred bcb4e08
chore: address comments
zepfred 3aea98c
chore: address comments
zepfred File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
core/src/main/java/ai/timefold/solver/core/api/domain/common/ComparatorFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package ai.timefold.solver.core.api.domain.common; | ||
|
|
||
| import java.util.Comparator; | ||
|
|
||
| import ai.timefold.solver.core.api.domain.entity.PlanningEntity; | ||
| import ai.timefold.solver.core.api.domain.solution.PlanningSolution; | ||
| import ai.timefold.solver.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig; | ||
| import ai.timefold.solver.core.config.heuristic.selector.entity.EntitySelectorConfig; | ||
| import ai.timefold.solver.core.config.heuristic.selector.value.ValueSelectorConfig; | ||
| import ai.timefold.solver.core.impl.heuristic.move.Move; | ||
| import ai.timefold.solver.core.impl.heuristic.selector.Selector; | ||
|
|
||
| import org.jspecify.annotations.NullMarked; | ||
|
|
||
| /** | ||
| * Creates a {@link Comparable} to decide the order of a collection of selections | ||
| * (a selection is a {@link PlanningEntity}, a planningValue, a {@link Move} or a {@link Selector}). | ||
triceo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * The selections are then sorted by some specific metric, | ||
| * normally ascending unless it's configured descending. | ||
zepfred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * The property {@code sortManner}, | ||
| * present in the selector configurations such as {@link ValueSelectorConfig} and {@link EntitySelectorConfig}, | ||
| * specifies how the data will be sorted. | ||
| * Additionally, | ||
| * the property {@code constructionHeuristicType} from {@link ConstructionHeuristicPhaseConfig} can also configure how entities | ||
| * and values are sorted. | ||
| * <p> | ||
| * Implementations are expected to be stateless. | ||
| * The solver may choose to reuse instances. | ||
| * | ||
| * @param <Solution_> the solution type, the class with the {@link PlanningSolution} annotation | ||
| * @param <T> the selection type | ||
| * | ||
| * @see ValueSelectorConfig | ||
| * @see EntitySelectorConfig | ||
| * @see ConstructionHeuristicPhaseConfig | ||
| */ | ||
| @NullMarked | ||
| @FunctionalInterface | ||
| public interface ComparatorFactory<Solution_, T> { | ||
|
|
||
| /** | ||
| * @param solution never null, the {@link PlanningSolution} to which the selection belongs or applies to | ||
| * @return never null | ||
| */ | ||
| Comparator<T> createComparator(Solution_ solution); | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.