-
Notifications
You must be signed in to change notification settings - Fork 168
feat: enhanced ruin & recreate #1976
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
triceo
wants to merge
9
commits into
TimefoldAI:main
Choose a base branch
from
Christopher-Chianelli:feat/351
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
9 commits
Select commit
Hold shift + click to select a range
e14f7b1
wip: R&R
Christopher-Chianelli 329d26d
feat: allow assigning multiple entities at once in an assignment action
Christopher-Chianelli e26dae8
chore: make advanced R&R use neighboorhood API
Christopher-Chianelli e615e4b
chore: remove uneccessary changes
Christopher-Chianelli 1998f11
chore: review comments
Christopher-Chianelli 6579077
chore: better descriptor return signatures
Christopher-Chianelli 969834c
chore: add docs
Christopher-Chianelli e138452
chore: review comments
Christopher-Chianelli 1bcc11a
chore: review comments
Christopher-Chianelli 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
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
106 changes: 106 additions & 0 deletions
106
...fold/solver/core/config/heuristic/selector/move/generic/MultistageMoveSelectorConfig.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,106 @@ | ||
| package ai.timefold.solver.core.config.heuristic.selector.move.generic; | ||
|
|
||
| import java.util.function.Consumer; | ||
|
|
||
| import jakarta.xml.bind.annotation.XmlType; | ||
|
|
||
| import ai.timefold.solver.core.config.heuristic.selector.move.MoveSelectorConfig; | ||
| import ai.timefold.solver.core.config.util.ConfigUtils; | ||
|
|
||
| import org.jspecify.annotations.NonNull; | ||
|
|
||
| @XmlType(propOrder = { | ||
| "stageProviderClass", | ||
| "entityClass", | ||
| "variableName" | ||
| }) | ||
| public class MultistageMoveSelectorConfig extends MoveSelectorConfig<MultistageMoveSelectorConfig> { | ||
| public static final String XML_ELEMENT_NAME = "multistageMoveSelector"; | ||
|
|
||
| protected Class<?> stageProviderClass; | ||
|
|
||
| protected Class<?> entityClass = null; | ||
| protected String variableName = null; | ||
|
|
||
| // ************************** | ||
| // Getters/Setters | ||
| // ************************** | ||
|
|
||
| public Class<?> getStageProviderClass() { | ||
| return stageProviderClass; | ||
| } | ||
|
|
||
| public void setStageProviderClass( | ||
| Class<?> stageProviderClass) { | ||
| this.stageProviderClass = stageProviderClass; | ||
| } | ||
|
|
||
| public Class<?> getEntityClass() { | ||
| return entityClass; | ||
| } | ||
|
|
||
| public void setEntityClass(Class<?> entityClass) { | ||
| this.entityClass = entityClass; | ||
| } | ||
|
|
||
| public String getVariableName() { | ||
| return variableName; | ||
| } | ||
|
|
||
| public void setVariableName(String variableName) { | ||
| this.variableName = variableName; | ||
| } | ||
|
|
||
| // ************************** | ||
| // With methods | ||
| // ************************** | ||
|
|
||
| public @NonNull MultistageMoveSelectorConfig withStageProviderClass( | ||
| @NonNull Class<?> stageProviderClass) { | ||
| this.setStageProviderClass(stageProviderClass); | ||
| return this; | ||
| } | ||
|
|
||
| public @NonNull MultistageMoveSelectorConfig withEntityClass(@NonNull Class<?> entityClass) { | ||
| this.setEntityClass(entityClass); | ||
| return this; | ||
| } | ||
|
|
||
| public @NonNull MultistageMoveSelectorConfig withVariableName(@NonNull String variableName) { | ||
| this.setVariableName(variableName); | ||
| return this; | ||
| } | ||
|
|
||
| // ************************** | ||
| // Interface methods | ||
| // ************************** | ||
|
|
||
| @Override | ||
| public boolean hasNearbySelectionConfig() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public @NonNull MultistageMoveSelectorConfig copyConfig() { | ||
| return new MultistageMoveSelectorConfig().inherit(this); | ||
| } | ||
|
|
||
| @Override | ||
| public void visitReferencedClasses(@NonNull Consumer<Class<?>> classVisitor) { | ||
| classVisitor.accept(stageProviderClass); | ||
| } | ||
|
|
||
| @Override | ||
| public @NonNull MultistageMoveSelectorConfig | ||
| inherit(@NonNull MultistageMoveSelectorConfig inheritedConfig) { | ||
| super.inherit(inheritedConfig); | ||
| stageProviderClass = | ||
| ConfigUtils.inheritOverwritableProperty(stageProviderClass, | ||
| inheritedConfig.getStageProviderClass()); | ||
| entityClass = | ||
| ConfigUtils.inheritOverwritableProperty(entityClass, inheritedConfig.getEntityClass()); | ||
| variableName = | ||
| ConfigUtils.inheritOverwritableProperty(variableName, inheritedConfig.getVariableName()); | ||
| return this; | ||
| } | ||
| } | ||
71 changes: 71 additions & 0 deletions
71
...er/core/config/heuristic/selector/move/generic/list/ListMultistageMoveSelectorConfig.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,71 @@ | ||||||||||
| package ai.timefold.solver.core.config.heuristic.selector.move.generic.list; | ||||||||||
|
|
||||||||||
| import java.util.function.Consumer; | ||||||||||
|
|
||||||||||
| import jakarta.xml.bind.annotation.XmlType; | ||||||||||
|
|
||||||||||
| import ai.timefold.solver.core.config.heuristic.selector.move.MoveSelectorConfig; | ||||||||||
| import ai.timefold.solver.core.config.util.ConfigUtils; | ||||||||||
|
|
||||||||||
| import org.jspecify.annotations.NonNull; | ||||||||||
|
|
||||||||||
| @XmlType(propOrder = { | ||||||||||
| "stageProviderClass" | ||||||||||
| }) | ||||||||||
| public class ListMultistageMoveSelectorConfig extends MoveSelectorConfig<ListMultistageMoveSelectorConfig> { | ||||||||||
| public static final String XML_ELEMENT_NAME = "listMultistageMoveSelector"; | ||||||||||
|
|
||||||||||
| protected Class<?> stageProviderClass; | ||||||||||
|
|
||||||||||
| // ************************** | ||||||||||
| // Getters/Setters | ||||||||||
| // ************************** | ||||||||||
|
|
||||||||||
| public Class<?> getStageProviderClass() { | ||||||||||
| return stageProviderClass; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public void setStageProviderClass( | ||||||||||
| Class<?> stageProviderClass) { | ||||||||||
| this.stageProviderClass = stageProviderClass; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // ************************** | ||||||||||
| // With methods | ||||||||||
| // ************************** | ||||||||||
|
|
||||||||||
| public @NonNull ListMultistageMoveSelectorConfig withStageProviderClass( | ||||||||||
| @NonNull Class<?> stageProviderClass) { | ||||||||||
| this.setStageProviderClass(stageProviderClass); | ||||||||||
| return this; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // ************************** | ||||||||||
| // Interface methods | ||||||||||
| // ************************** | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public boolean hasNearbySelectionConfig() { | ||||||||||
| return false; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public @NonNull ListMultistageMoveSelectorConfig copyConfig() { | ||||||||||
| return new ListMultistageMoveSelectorConfig().inherit(this); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public void visitReferencedClasses(@NonNull Consumer<Class<?>> classVisitor) { | ||||||||||
| classVisitor.accept(stageProviderClass); | ||||||||||
|
||||||||||
| classVisitor.accept(stageProviderClass); | |
| if (stageProviderClass != null) { | |
| classVisitor.accept(stageProviderClass); | |
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The visitReferencedClasses method should check if stageProviderClass is null before passing it to the classVisitor to avoid potential NullPointerException when the consumer doesn't handle null values. Additionally, entityClass should also be visited if it's non-null since it's a referenced class.