-
Notifications
You must be signed in to change notification settings - Fork 160
feat: allow caching the results of an unfiltered UniStream (WIP) #1853
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d427a31
feat: wip - allow caching the results of an unfiltered UniStream
Christopher-Chianelli 0d25bd9
fix: retract all nodes before updating the map
Christopher-Chianelli a0bd181
fix: sonar issues
Christopher-Chianelli e74cde6
feat: add bi/tri/quad support for static data, change API slightly
Christopher-Chianelli 9ce1432
chore: review comments
Christopher-Chianelli 3a1b6f6
perf: minor optimization
Christopher-Chianelli 9f13ee7
chore: naming
Christopher-Chianelli 082eefc
chore: use a new recorder for each object
Christopher-Chianelli a05889b
test: add tests for various precompute inputs
Christopher-Chianelli ccd01c3
fix: make complement() use forEachUnfiltered when used in a precomput…
Christopher-Chianelli 8cdf054
chore: review comments
Christopher-Chianelli d37698c
feat: implement node sharing for precompute
Christopher-Chianelli 9c12b49
chore: move group update code into new propagator class
Christopher-Chianelli 72f8a62
fix: sonar issues
Christopher-Chianelli cf7db04
chore: use AutoClosable for RecordingTupleLifecycle
Christopher-Chianelli 0847164
fix: make forEach node sharing consider retrival semantics
Christopher-Chianelli da173ad
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
44 changes: 44 additions & 0 deletions
44
core/src/main/java/ai/timefold/solver/core/api/score/stream/PrecomputeFactory.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,44 @@ | ||
package ai.timefold.solver.core.api.score.stream; | ||
|
||
import java.util.function.Function; | ||
|
||
import ai.timefold.solver.core.api.domain.entity.PlanningEntity; | ||
import ai.timefold.solver.core.api.score.stream.uni.UniConstraintStream; | ||
|
||
/** | ||
* Similar to a {@link ConstraintFactory}, except its methods (and the | ||
* {@link ConstraintStream}s they return) do not apply any automatic | ||
* filters (like those mentioned in {@link ConstraintFactory#forEach(Class)}). | ||
*/ | ||
public interface PrecomputeFactory { | ||
/** | ||
* As defined by {@link ConstraintFactory#forEachUnfiltered(Class)}, | ||
* with the additional change of any joining stream will also be unfiltered. | ||
* <p> | ||
* For example, | ||
* <p> | ||
* | ||
* <pre> | ||
* precomputeFactory.forEachUnfiltered(Shift.class) | ||
* .join(Shift.class, Joiners.equal(Shift::getLocation)); | ||
* </pre> | ||
* <p> | ||
* Would roughly be equivalent to | ||
* <p> | ||
* | ||
* <pre> | ||
* constraintFactory.forEachUnfiltered(Shift.class) | ||
* .join(constraintFactory.forEachUnfiltered(Shift.class), | ||
* Joiners.equal(Shift::getLocation)); | ||
* </pre> | ||
* <p> | ||
* Important: no variables can be referenced in any operations performed | ||
* by the returned {@link ConstraintStream}, otherwise a score corruption will | ||
* occur. | ||
* See the note in {@link ConstraintFactory#precompute(Function)} for | ||
* more details. | ||
* | ||
* @param <A> the type of the matched problem fact or {@link PlanningEntity planning entity} | ||
*/ | ||
<A> UniConstraintStream<A> forEachUnfiltered(Class<A> sourceClass); | ||
Christopher-Chianelli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
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
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.