repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
timefold-solver
github_2023
java
1,341
TimefoldAI
zepfred
@@ -19,15 +19,16 @@ final class DynamicPropagationQueue<Tuple_ extends AbstractTuple, Carrier_ extends AbstractPropagationMetadataCarrier<Tuple_>> implements PropagationQueue<Carrier_> { + private static final int INITIAL_CAPACITY = 1000; // Selected arbitrarily.
Would it make sense to use the entity count to estimate capacity?
timefold-solver
github_2023
java
1,324
TimefoldAI
zepfred
@@ -14,19 +14,37 @@ final class ComparisonIndexer<T, Key_ extends Comparable<Key_>> implements Indexer<T> { - private final int propertyIndex; + private final KeyRetriever<Key_> keyRetriever; private final Supplier<Indexer<T>> downstreamIndexerSupplier; private final Comparator<Key_> keyComp...
The name `NoneIndexer` seems off to me. Maybe should choose a more meaningful name, such as `RawDataIndexer` or something similar.
timefold-solver
github_2023
java
1,329
TimefoldAI
zepfred
@@ -19,43 +19,26 @@ */ public abstract sealed class AbstractTuple permits UniTuple, BiTuple, TriTuple, QuadTuple { - /* - * We create a lot of tuples, many of them having store size of 1. - * If an array of size 1 was created for each such tuple, memory would be wasted and indirection created. - * T...
Does this change increase memory consumption?
timefold-solver
github_2023
java
1,312
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,157 @@ +package ai.timefold.solver.core.impl.domain.solution.descriptor; + +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collector...
Might be useful to add `toFullString` that ignores the limit (I find with `TRACKED_FULL_ASSERT`, the diff limit often hides changed variables).
timefold-solver
github_2023
java
1,312
TimefoldAI
Christopher-Chianelli
@@ -1265,6 +1268,68 @@ public <Score_ extends Score<Score_>> void setScore(Solution_ solution, Score_ s ((ScoreDescriptor) scoreDescriptor).setScore(solution, score); } + public PlanningSolutionDiff<Solution_> diff(Solution_ oldSolution, Solution_ newSolution) { + var oldEntities = getEntityDe...
Might be useful to also add shadow variable differences (ex: users might be interested in the difference in arrival time of a visit, which is hard to know just from the list assigned to a vehicle).
timefold-solver
github_2023
java
1,308
TimefoldAI
triceo
@@ -78,6 +82,14 @@ class TimefoldProcessorMultipleSolversInvalidSolutionClassTest { .hasMessageContaining( "Unused classes ([ai.timefold.solver.quarkus.testdata.chained.domain.TestdataChainedQuarkusSolution]) found with a @PlanningSolution annotation.")); + @Inject...
Why do we need to add these, if the test worked without them before? Smells of a backwards incompatible change.
timefold-solver
github_2023
python
1,271
TimefoldAI
Christopher-Chianelli
@@ -653,13 +653,13 @@ def __init__(self, *, class DeepPlanningClone(JavaAnnotation): """ - Marks a problem fact class as being required to be deep planning cloned.
Please keep this in the docstring; attributes that are instances of a planning_entity and planning_solution type are automatically deep cloned.
timefold-solver
github_2023
python
1,271
TimefoldAI
Christopher-Chianelli
@@ -954,3 +954,68 @@ class Solution: solution = solver.solve(problem) assert solution.score.score == 0 assert solution.entity.value == [1, 2, 3] + +def test_deep_clone_class(): + @deep_planning_clone + @dataclass + class Code: + value: str + parent_entity: 'Entity' = field(default=...
There should be an assert here to test if the cloning created a new instance ```suggestion assert solution.codes[0].parent_entity == solution.entities[0] assert solution.codes[0] is not problem.codes[0] ```
timefold-solver
github_2023
python
1,271
TimefoldAI
Christopher-Chianelli
@@ -653,13 +653,13 @@ def __init__(self, *, class DeepPlanningClone(JavaAnnotation): """ - Marks a problem fact class as being required to be deep planning cloned. - Not needed for a `planning_solution` or `planning_entity` because those are automatically deep cloned. - It can also mark an attribute as...
```suggestion Marks an attribute as being required to be deep planning cloned. Not needed for `planning_solution` or `planning_entity` attributes because those are automatically deep cloned. ```
timefold-solver
github_2023
java
1,306
TimefoldAI
zepfred
@@ -0,0 +1,179 @@ +package ai.timefold.solver.core.impl.score.stream.bavet.visual; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.s...
I'm unsure about the method name. What about `parse`?
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -0,0 +1,45 @@ +package ai.timefold.solver.core.api.function; + +import java.util.Objects; +import java.util.function.Consumer; +import java.util.function.Function; + +import org.jspecify.annotations.NonNull; + +/** + * Represents a function that accepts three arguments and returns no result.
```suggestion * Represents a function that accepts four arguments and returns no result. ```
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -31,7 +30,7 @@ public IndexedIfExistsBiNode(boolean shouldExist, } public IndexedIfExistsBiNode(boolean shouldExist, - BiFunction<A, B, IndexProperties> mappingAB, Function<C, IndexProperties> mappingC, + BiMapping<A, B> mappingAB, IndexerFactory.UniMapping<C> mappingC,
```suggestion BiMapping<A, B> mappingAB, UniMapping<C> mappingC, ```
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -43,8 +43,8 @@ public ComparisonIndexer(JoinerType comparisonJoinerType, int propertyIndex, } @Override - public ElementAwareListEntry<T> put(IndexProperties indexProperties, T tuple) { - Key_ indexKey = indexProperties.toKey(propertyIndex); + public ElementAwareListEntry<T> put(Object index...
Can we guarantee that the type of `indexProperties` is always `Key_`? It seems better to me that using a contract requiring the type `Key_` is preferable to allowing two possible types.
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -526,87 +467,119 @@ public Function<Right_, ai.timefold.solver.core.impl.score.stream.bavet.common.i for (int i = 0; i < mappingCount; i++) { result[i] = mappings[i].apply(a); } - ret...
The logic seems correct. I wonder if the result type could be something other than `Object`, which would clarify the contract for inner nodes.
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -430,61 +384,48 @@ public <A> Function<A, ai.timefold.solver.core.impl.score.stream.bavet.common.in for (int i = 0; i < mappingCount; i++) { result[i] = mappings[i].apply(a, b, c, d); } - ...
Is there a reason for not wrapping here?
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -23,21 +22,19 @@ public abstract class AbstractIndexedIfExistsNode<LeftTuple_ extends AbstractTup extends AbstractIfExistsNode<LeftTuple_, Right_> implements LeftTupleLifecycle<LeftTuple_>, RightTupleLifecycle<UniTuple<Right_>> { - private final Function<Right_, IndexProperties> mappingRight; ...
```suggestion protected AbstractIndexedIfExistsNode(boolean shouldExist, UniMapping<Right_> mappingRight, ```
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -44,17 +44,15 @@ public final void insertLeft(LeftTuple_ leftTuple) { throw new IllegalStateException("Impossible state: the input for the tuple (" + leftTuple + ") was already added in the tupleStore."); } - ExistsCounter<LeftTuple_> counter = new ExistsCounter<>(le...
The tuple instance will be the first parameter in the forEach loop, even though it originally appears in the second position in the code. Will this break any existing code?
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -77,9 +75,7 @@ public final void updateLeft(LeftTuple_ leftTuple) { ElementAwareList<FilteringTracker<LeftTuple_>> leftTrackerList = leftTuple.getStore(inputStoreIndexLeftTrackerList); leftTrackerList.forEach(FilteringTracker::remove); counter.countRight = 0; - for (...
Same as above
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -106,32 +102,27 @@ public final void insertRight(UniTuple<Right_> rightTuple) { throw new IllegalStateException("Impossible state: the input for the tuple (" + rightTuple + ") was already added in the tupleStore."); } - ElementAwareListEntry<UniTuple<Right_>> rightEn...
Same as above
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -106,32 +102,27 @@ public final void insertRight(UniTuple<Right_> rightTuple) { throw new IllegalStateException("Impossible state: the input for the tuple (" + rightTuple + ") was already added in the tupleStore."); } - ElementAwareListEntry<UniTuple<Right_>> rightEn...
Same as above
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -40,19 +40,16 @@ public final void insertLeft(LeftTuple_ leftTuple) { throw new IllegalStateException("Impossible state: the input for the tuple (" + leftTuple + ") was already added in the tupleStore."); } - ElementAwareListEntry<LeftTuple_> leftEntry = leftTupleLis...
That's what I meant in my comments in `AbstractUnindexedIfExistsNode`
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -31,7 +30,7 @@ public IndexedIfExistsQuadNode(boolean shouldExist, } public IndexedIfExistsQuadNode(boolean shouldExist, - QuadFunction<A, B, C, D, IndexProperties> mappingABCD, Function<E, IndexProperties> mappingE, + QuadMapping<A, B, C, D> mappingABCD, IndexerFactory.UniMapping<E...
```suggestion QuadMapping<A, B, C, D> mappingABCD, UniMapping<E> mappingE, ```
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -31,7 +30,7 @@ public IndexedIfExistsTriNode(boolean shouldExist, } public IndexedIfExistsTriNode(boolean shouldExist, - TriFunction<A, B, C, IndexProperties> mappingABC, Function<D, IndexProperties> mappingD, + TriMapping<A, B, C> mappingABC, IndexerFactory.UniMapping<D> mappingD,
```suggestion TriMapping<A, B, C> mappingABC, UniMapping<D> mappingD, ```
timefold-solver
github_2023
java
1,300
TimefoldAI
zepfred
@@ -72,8 +93,13 @@ public void remove(ElementAwareListEntry<T> entry) { } else { entry.next.previous = entry.previous; } + entry.list = null; entry.previous = null; entry.next = null; + if (availableBlankEntry == null) { // Entry will be reused.
Nice!
timefold-solver
github_2023
others
1,269
TimefoldAI
lee-carlon
@@ -98,6 +98,25 @@ The solution instance given to the `solve(Solution)` method does not need to be It can be partially or fully initialized, which is often the case in xref:responding-to-change/responding-to-change.adoc[repeated planning]. ==== +[#multithreadedSolving] +=== Multi-threaded solving + +There are sever...
```suggestion ** The xref:using-timefold-solver/running-the-solver.adoc#solverManager[`SolverManager`] can help with this. ```
timefold-solver
github_2023
others
1,269
TimefoldAI
lee-carlon
@@ -262,7 +281,8 @@ Even `debug` logging can slow down performance considerably for fast stepping al (such as Late Acceptance and Simulated Annealing), but not for slow stepping algorithms (such as Tabu Search). -Both cause congestion in xref:enterprise-edition/enterprise-edition.adoc#multithreadedSolving[multi-thr...
```suggestion Both trace logging and debug logging cause congestion in xref:using-timefold-solver/running-the.solver.adoc#multithreadedSolving[multi-threaded solving] with most appenders, ```
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -210,6 +212,7 @@ public class SolverConfig extends AbstractConfig<SolverConfig> { // Warning: all fields are null (and not defaulted) because they can be inherited // and also because the input config file should match the output config file + protected List<PreviewFeature> enablePreviewFeatureList = ...
Shouldn't this be an `EnumSet`?
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -60,6 +61,7 @@ */ @XmlRootElement(name = SolverConfig.XML_ELEMENT_NAME) @XmlType(name = SolverConfig.XML_TYPE_NAME, propOrder = { + "enablePreviewFeatureList",
I'd drop the `list` - or do we have a precedent for that anywhere else in the config?
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -432,6 +443,14 @@ public void setMonitoringConfig(@Nullable MonitoringConfig monitoringConfig) { // With methods // ************************************************************************ + public @NonNull SolverConfig withPreviewFeature(@NonNull PreviewFeature previewFeature) {
I'd consider making this a vararg, and override the list every time. If nothing is provided, nothing is enabled. If something is provided, then that's what's enabled.
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -25,6 +27,7 @@ public class HeuristicConfigPolicy<Solution_> { + private final List<PreviewFeature> previewFeatureList;
`EnumSet` will work better for this.
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -0,0 +1,95 @@ +package ai.timefold.solver.core.impl.localsearch.decider.acceptor.lateacceptance; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchMoveScope; +import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchPhaseScope; +import ai.tim...
Do we need this? It's a shorthand for something already very short. Also, wouldn't you be able to get rid of the cast, if you do it like so? private <Score_ extends Score<Score_>> int compare(Score_ first, Score_ second) {
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -0,0 +1,95 @@ +package ai.timefold.solver.core.impl.localsearch.decider.acceptor.lateacceptance; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchMoveScope; +import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchPhaseScope; +import ai.tim...
Personally, I'd refactor this to something with meaning - such as: var lateScoreWorse = compare(score, lateWorse) > 0;
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -0,0 +1,95 @@ +package ai.timefold.solver.core.impl.localsearch.decider.acceptor.lateacceptance; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchMoveScope; +import ai.timefold.solver.core.impl.localsearch.scope.LocalSearchPhaseScope; +import ai.tim...
Do we need to extend this? IMO it's different enough to stand on its own. There's not so much code to share anyway.
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -15,9 +15,8 @@ public static HeuristicConfigPolicy<TestdataSolution> buildHeuristicConfigPolicy public static <Solution_> HeuristicConfigPolicy<Solution_> buildHeuristicConfigPolicy(SolutionDescriptor<Solution_> solutionDescriptor) { - return new HeuristicConfigPolicy.Builder<>(Environment...
Isn't the point of a builder to not have these crazy constructors?
timefold-solver
github_2023
others
1,253
TimefoldAI
triceo
@@ -507,6 +507,50 @@ Use a lower tabu size than in a pure Tabu Search configuration. </localSearch> ---- +[#diversifiedLateAcceptance] +== Diversified Late acceptance + + +[#diversifiedLateAcceptanceAlgorithm] +=== Algorithm description + +Diversified Late Acceptance is similar to Late Acceptance, +but it offers ...
This sentence is a bit complicated. I'd break it down into bullet points - updated if X, or if Y.
timefold-solver
github_2023
others
1,253
TimefoldAI
triceo
@@ -507,6 +507,50 @@ Use a lower tabu size than in a pure Tabu Search configuration. </localSearch> ---- +[#diversifiedLateAcceptance] +== Diversified Late acceptance + + +[#diversifiedLateAcceptanceAlgorithm] +=== Algorithm description + +Diversified Late Acceptance is similar to Late Acceptance, +but it offers ...
You should also show the preview configuration.
timefold-solver
github_2023
others
1,253
TimefoldAI
triceo
@@ -507,6 +507,50 @@ Use a lower tabu size than in a pure Tabu Search configuration. </localSearch> ---- +[#diversifiedLateAcceptance] +== Diversified Late acceptance +
I'd add a note that it's a preview feature, with a link here: https://docs.timefold.ai/timefold-solver/latest/upgrading-timefold-solver/backwards-compatibility#previewFeatures
timefold-solver
github_2023
others
1,253
TimefoldAI
triceo
@@ -317,6 +317,9 @@ <xs:sequence> + <xs:element maxOccurs="unbounded" minOccurs="0" name="enablePreviewFeatureList" nillable="true" type="tns:previewFeature"/>
If I read this correctly, if there were more than one preview feature, this would look like this: <enablePreviewFeatureList>FEATURE_A</> <enablePreviewFeatureList>FEATURE_B</> Then _for sure_ this shouldn't have the `list` suffix.
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -198,20 +217,31 @@ public ThreadFactory buildThreadFactory(ChildThreadType childThreadType) { } } + public void ensurePreviewFeature(PreviewFeature previewFeature) { + if (previewFeatureList == null || !previewFeatureList.contains(previewFeature)) { + throw new IllegalStateExcept...
Tag needs fixing.
timefold-solver
github_2023
others
1,253
TimefoldAI
triceo
@@ -507,6 +507,63 @@ Use a lower tabu size than in a pure Tabu Search configuration. </localSearch> ---- +[#diversifiedLateAcceptance] +== Diversified Late acceptance + + +[#diversifiedLateAcceptanceAlgorithm] +=== Algorithm description + +Diversified Late Acceptance is similar to Late Acceptance, +but it offers ...
```suggestion Diversified Late Acceptance was first proposed in https://arxiv.org/pdf/1806.09328[Diversified Late Acceptance Search by M. Namazi, C. Sanderson, M. A. H. Newton, M. M. A. Polash, and A. Sattar] ```
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -0,0 +1,113 @@ +package ai.timefold.solver.core.impl.localsearch.decider.acceptor.lateacceptance; + +import java.util.Arrays; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.localsearch.decider.acceptor.AbstractAcceptor; +import ai.timefold.solver.core.impl.localsearch.scope.L...
Please declare variables closer to where you need them, you decrease the size of the context readers need to keep in their heads. This particular variable is only needed on line 63.
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -0,0 +1,113 @@ +package ai.timefold.solver.core.impl.localsearch.decider.acceptor.lateacceptance; + +import java.util.Arrays; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.localsearch.decider.acceptor.AbstractAcceptor; +import ai.timefold.solver.core.impl.localsearch.scope.L...
The comparison is already made on line 63. Please reuse.
timefold-solver
github_2023
java
1,253
TimefoldAI
triceo
@@ -0,0 +1,113 @@ +package ai.timefold.solver.core.impl.localsearch.decider.acceptor.lateacceptance; + +import java.util.Arrays; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.localsearch.decider.acceptor.AbstractAcceptor; +import ai.timefold.solver.core.impl.localsearch.scope.L...
Please reuse the comparison. This is called relatively frequently, it needs to be efficient.
timefold-solver
github_2023
java
1,237
TimefoldAI
triceo
@@ -0,0 +1,34 @@ +package ai.timefold.solver.core.impl.domain.solution.cloner.gizmo; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; +import java.util.Map; + +import ai.timefold.solver.core.impl.testdata.domain.clone.deepcloning.AnnotatedTestdataVariousTypes; +import ai.timefold.s...
If my memory serves, the cloning tests are usually written in a way that the same bug can be tested for both reflection-based and Gizmo-based cloners. It is important that we maintain functional equivalence between the two implementations. Please find the cloner test which implements this duality, and preferrably ad...
timefold-solver
github_2023
java
1,228
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,291 @@ +package ai.timefold.solver.core.impl.domain.variable; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import ai.timefold.solver.core.impl.domain.variable.descriptor.ListVariableDescriptor; +import ai.timefold.solver.core.impl.domain.variable.index.IndexShadowVariableDes...
`getInverseSingleton` and `getIndex` might do a map lookup on the same value. Might be worth it to do a single map lookup here if requiresLocationMap is true.
timefold-solver
github_2023
others
1,196
TimefoldAI
triceo
@@ -587,6 +587,9 @@ <xs:element minOccurs="0" name="moveCountLimit" type="xs:long"/> + <xs:element minOccurs="0" name="unimprovedBestSolutionLimit" type="xs:double"/>
We need a better name for this one - one that actually indicated what is going to happen. - `exhaustionDetection` (we already use "exhaust" for exhaustive search, so maybe not) - `depletionDetection` - `flatLineDetection` (I like it because it is simple; I don't like it because it is too un-scientific) - ... ?
timefold-solver
github_2023
java
1,196
TimefoldAI
triceo
@@ -0,0 +1,178 @@ +package ai.timefold.solver.core.impl.solver.termination; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.phase.scope.AbstractPhaseScope; +import ai.timefold.solver.core.impl.phase.scope.AbstractStepScope; +import ai.timefold.solver.core.impl.solver.scope.Solver...
Needs a unit in the name.
timefold-solver
github_2023
java
1,196
TimefoldAI
triceo
@@ -0,0 +1,178 @@ +package ai.timefold.solver.core.impl.solver.termination; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.phase.scope.AbstractPhaseScope; +import ai.timefold.solver.core.impl.phase.scope.AbstractStepScope; +import ai.timefold.solver.core.impl.solver.scope.Solver...
Needs a better name, describing the functionality. This also needs to show up in the docs and in the images, as it is one of the key parameters to understand the algorithm. The charts need to clearly mark this point.
timefold-solver
github_2023
java
1,196
TimefoldAI
triceo
@@ -0,0 +1,178 @@ +package ai.timefold.solver.core.impl.solver.termination; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.phase.scope.AbstractPhaseScope; +import ai.timefold.solver.core.impl.phase.scope.AbstractStepScope; +import ai.timefold.solver.core.impl.solver.scope.Solver...
Based on the current description, I do not understand what this does. Also, same comment as above.
timefold-solver
github_2023
java
1,196
TimefoldAI
triceo
@@ -0,0 +1,178 @@ +package ai.timefold.solver.core.impl.solver.termination; + +import ai.timefold.solver.core.api.score.Score; +import ai.timefold.solver.core.impl.phase.scope.AbstractPhaseScope; +import ai.timefold.solver.core.impl.phase.scope.AbstractStepScope; +import ai.timefold.solver.core.impl.solver.scope.Solver...
I understand why this is, but as a future improvement, we should think about ways of making this termination the default without the user having to configure anything. I want this to eventually be the only termination the user will ever need. This will require the termination to _somehow_ survive the CH phase.
timefold-solver
github_2023
others
1,196
TimefoldAI
triceo
@@ -565,6 +565,58 @@ Terminates as soon as a feasible solution has been discovered. This `Termination` is usually combined with other terminations. +[#unimprovedBestSolutionTermination] +==== `UnimprovedBestSolutionTermination` + +`UnimprovedBestSolutionTermination` terminates when the solver cannot improve the be...
Are we using time? I thought we were using move counts.
timefold-solver
github_2023
others
1,196
TimefoldAI
triceo
@@ -565,6 +565,58 @@ Terminates as soon as a feasible solution has been discovered. This `Termination` is usually combined with other terminations. +[#unimprovedBestSolutionTermination] +==== `UnimprovedBestSolutionTermination` + +`UnimprovedBestSolutionTermination` terminates when the solver cannot improve the be...
Isn't this a bit confusing? Why not change the definition and instead of basing it on estimated total time, it would be based on the time it spent improving? The limit would be `1.0` in that case, and the docs would say eg. "the last best score was achieved at 10 seconds, and the solver will terminate in another 10...
timefold-solver
github_2023
others
1,196
TimefoldAI
triceo
@@ -565,6 +565,58 @@ Terminates as soon as a feasible solution has been discovered. This `Termination` is usually combined with other terminations. +[#unimprovedBestSolutionTermination] +==== `UnimprovedBestSolutionTermination` + +`UnimprovedBestSolutionTermination` terminates when the solver cannot improve the be...
We should discuss this interval, give it a name, and write the pictures in such a way that they show this interval.
timefold-solver
github_2023
others
1,196
TimefoldAI
triceo
@@ -565,6 +565,58 @@ Terminates as soon as a feasible solution has been discovered. This `Termination` is usually combined with other terminations. +[#unimprovedBestSolutionTermination] +==== `UnimprovedBestSolutionTermination` + +`UnimprovedBestSolutionTermination` terminates when the solver cannot improve the be...
We keep talking about curves here, but maybe we should talk about the last point of improvement. (Which is also a concept which needs a good name, and needs to be shown in the graph.)
timefold-solver
github_2023
others
1,196
TimefoldAI
triceo
@@ -565,6 +565,58 @@ Terminates as soon as a feasible solution has been discovered. This `Termination` is usually combined with other terminations. +[#unimprovedBestSolutionTermination] +==== `UnimprovedBestSolutionTermination` + +`UnimprovedBestSolutionTermination` terminates when the solver cannot improve the be...
Please explain why, and with which.
timefold-solver
github_2023
others
1,229
TimefoldAI
lee-carlon
@@ -10,6 +10,8 @@ image::quickstart/vehicle-routing/vehicleRoutingClassDiagramPure.png[] == Location The `Location` class is used to represent the destination for deliveries or the home location for vehicles. +The `drivingTimeSeconds` map contains the time required to driving from `this` location to any other locat...
```suggestion The `drivingTimeSeconds` map contains the time required to drive from `this` location to any other location. ```
timefold-solver
github_2023
others
1,229
TimefoldAI
lee-carlon
@@ -306,12 +274,15 @@ The `Visit` class represents a delivery that needs to be made by vehicles. A visit includes a destination location, a delivery time window represented by `[minStartTime, maxEndTime]`, a demand that needs to be fulfilled by the vehicle, and a service duration time. +The `Visit` class has an `@P...
```suggestion The `Visit` class has an `@PlanningEntity` annotation but no genuine variables and is called a https://timefold.ai/docs/timefold-solver/latest/using-timefold-solver/modeling-planning-problems#shadowVariable[shadow entity]. ```
timefold-solver
github_2023
others
1,229
TimefoldAI
lee-carlon
@@ -608,193 +505,27 @@ class Visit { -- ==== -Some methods are annotated with `@InverseRelationShadowVariable`, `@PreviousElementShadowVariable`, -`@NextElementShadowVariable`, and `@ShadowVariable`. +Some methods are annotated with `@InverseRelationShadowVariable`, `@PreviousElementShadowVariable` and `@CascadingU...
```suggestion This change is automatically propagated to the subsequent visits and stops when the `arrivalTime` value hasn't changed or when it's reached the end of the chain of visit objects. ```
timefold-solver
github_2023
others
1,203
TimefoldAI
triceo
@@ -64,9 +64,14 @@ To complete this guide, you need: == The build file and the dependencies -Use https://code.quarkus.io/[code.quarkus.io] to generate an application +Use https://code.quarkus.io/?a=timefold-solver-quickstart&j=17&e=resteasy&e=resteasy-jackson&e=ai.timefold.solver%3Atimefold-solver-quarkus-jackson&...
```suggestion Use https://code.quarkus.io/?a=timefold-solver-quickstart&j=21&e=resteasy&e=resteasy-jackson&e=ai.timefold.solver%3Atimefold-solver-quarkus-jackson&e=ai.timefold.solver%3Atimefold-solver-quarkus[code.quarkus.io] to generate an application ``` Maybe we want to nudge people towards the latest LTS?
timefold-solver
github_2023
others
1,201
TimefoldAI
triceo
@@ -1,19 +1,19 @@ # This file is temporary, since for the time being, we need to build docs from the main branch. # Remove when 1.16.0 is out, otherwise this file quickly becomes stale.
```suggestion # Remove when 1.17.0 is out, otherwise this file quickly becomes stale. ```
timefold-solver
github_2023
java
1,198
TimefoldAI
zepfred
@@ -198,71 +199,65 @@ private EntitySelector<Solution_> applyFiltering(EntitySelector<Solution_> entit } protected void validateSorting(SelectionOrder resolvedSelectionOrder) { - if ((config.getSorterManner() != null || config.getSorterComparatorClass() != null + var sorterManner = config.getS...
Let's create a variable for `config.getSorterComparatorClass()` and `config.getSorterWeightFactoryClass()`.
timefold-solver
github_2023
java
1,198
TimefoldAI
zepfred
@@ -278,7 +273,7 @@ protected EntitySelector<Solution_> applySorting(SelectionCacheType resolvedCach } else { throw new IllegalArgumentException("The entitySelectorConfig (" + config
Let's use `formatted`
timefold-solver
github_2023
java
1,198
TimefoldAI
zepfred
@@ -256,71 +257,64 @@ protected ValueSelector<Solution_> applyInitializedChainedValueFilter(HeuristicC } protected void validateSorting(SelectionOrder resolvedSelectionOrder) { - if ((config.getSorterManner() != null || config.getSorterComparatorClass() != null + var sorterManner = config.getS...
Consider applying the same pattern used in multiple places: declare the variable and then check if it is null.
timefold-solver
github_2023
java
1,198
TimefoldAI
zepfred
@@ -198,71 +199,65 @@ private EntitySelector<Solution_> applyFiltering(EntitySelector<Solution_> entit } protected void validateSorting(SelectionOrder resolvedSelectionOrder) { - if ((config.getSorterManner() != null || config.getSorterComparatorClass() != null + var sorterManner = config.getS...
Consider applying the same pattern used in multiple places: declare the variable and then check if it is null.
timefold-solver
github_2023
java
1,198
TimefoldAI
zepfred
@@ -336,7 +330,7 @@ protected ValueSelector<Solution_> applySorting(SelectionCacheType resolvedCache } else { throw new IllegalArgumentException("The valueSelectorConfig (" + config
Let's use `formatted`
timefold-solver
github_2023
java
1,198
TimefoldAI
zepfred
@@ -610,18 +610,16 @@ public String toString() { @Override public boolean equals(Object o) { - if (this == o) { + if (this == o)
Do we want to remove the curly braces?
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -111,15 +101,15 @@ protected MoveSelectorConfig<?> buildUnfoldedMoveSelectorConfig(HeuristicConfigP + " or use a changeMoveSelector instead."); } if (!onlyDestinationVariableDescriptor.isListVariable()) { - throw new IllegalArgumentException("The dest...
Let's use `formatted`.
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -111,15 +101,15 @@ protected MoveSelectorConfig<?> buildUnfoldedMoveSelectorConfig(HeuristicConfigP + " or use a changeMoveSelector instead."); } if (!onlyDestinationVariableDescriptor.isListVariable()) { - throw new IllegalArgumentException("The dest...
Let's use `formatted`.
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -146,61 +145,57 @@ protected ValueSelector<Solution_> buildMimicReplaying(HeuristicConfigPolicy<Sol || config.getSorterClass() != null || config.getProbabilityWeightFactoryClass() != null || config.getSelectedCountLimit() != null) { - throw new IllegalArg...
It can be merged with `ORIGINAL`.
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -47,10 +47,7 @@ public EasyScoreCalculator<Solution_, Score_> getEasyScoreCalculator() { public Score_ calculateScore() { variableListenerSupport.assertNotificationQueuesAreEmpty(); Score_ score = easyScoreCalculator.calculateScore(workingSolution); - if (score == null) { - t...
Let's use `formatted`.
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -86,12 +86,11 @@ public <A> void assertValidFromType(Class<A> fromType) { } public List<Constraint_> buildConstraints(ConstraintProvider constraintProvider) { - Constraint[] constraints = constraintProvider.defineConstraints(this); - if (constraints == null) { - throw new Illegal...
Let's use `formatted`.
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -57,18 +57,20 @@ public <Score_ extends Score<Score_>> Termination<Solution_> buildTermination( Arrays.fill(timeGradientWeightNumbers, 0.50); // Number pulled out of thin air terminationList.add(new BestScoreTermination<>(scoreDefinition, bestScoreLimit_, timeGradientWeightNumbers)); ...
Why are we including the backslash in this message?
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -18,7 +19,7 @@ public void serialize(ConstraintWeightOverrides<Score_> constraintWeightOverride generator.writeStartObject(); for (var constraintName : constraintWeightOverrides.getKnownConstraintNames()) { var weight = constraintWeightOverrides.getConstraintWeight(constraintName);
```suggestion var weight = Objects.requireNonNull(constraintWeightOverrides.getConstraintWeight(constraintName)); ```
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -18,7 +19,7 @@ public void serialize(ConstraintWeightOverrides<Score_> constraintWeightOverride generator.writeStartObject(); for (var constraintName : constraintWeightOverrides.getKnownConstraintNames()) { var weight = constraintWeightOverrides.getConstraintWeight(constraintName); - ...
```suggestion generator.writeStringField(constraintName, weight.toString()); ```
timefold-solver
github_2023
java
1,197
TimefoldAI
zepfred
@@ -238,18 +238,19 @@ private void loadSolverConfig(IncludeAbstractClassesEntityScanner entityScanner, if (solverConfig.getSolutionClass() == null) { solverConfig.setSolutionClass(entityScanner.findFirstSolutionClass()); } - if (solverConfig.getEntityClassList() == null) { + ...
```suggestion var entityClassCount = solverEntityClassList.stream() ```
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -219,226 +219,233 @@ public final class ConstraintCollectors { * The default result of the collector (e.g. when never called) is {@code 0}. * * @param <A> type of the matched fact - * @return never null */ - public static <A> UniConstraintCollector<A, ?, Integer> sum(ToIntFunction<? su...
Yes. There are overloads for that method which do not require these arguments - so when an argument is actually present, it is required unless Javadoc says otherwise.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -543,168 +509,172 @@ public void setThreadFactoryClass(Class<? extends ThreadFactory> threadFactoryCl * * @return null, a number or {@value #PARALLEL_BENCHMARK_COUNT_AUTO}. */ - public String getParallelBenchmarkCount() { + public @Nullable String getParallelBenchmarkCount() { return...
I'm afraid this pattern is not correct. :-( - Getters in configs have to be `Nullable`, because the fields may hold `null`. `null` here means that the user chose not to specify. (Why else would we choose `Long` instead of `long`, avoiding reference types altogether?) - Setters likewise have to be able to accept `null`...
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -90,12 +92,15 @@ public enum SolverMetric { this.isConstraintMatchBased = isConstraintMatchBased; } - public String getMeterId() { + public @NonNull String getMeterId() { return meterId; } - public static void registerScoreMetrics(SolverMetric metric, Tags tags, ScoreDefiniti...
Not our best API design here. :-( You know Kotlin better than I do. Would these annotations on this crazy type actually help? I feel like they would, but I will defer to your judgment here.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -236,7 +246,8 @@ public NearbySelectionConfig withBetaDistributionBeta(Double betaDistributionBet // Builder methods // ************************************************************************ - public void validateNearby(SelectionCacheType resolvedCacheType, SelectionOrder resolvedSelectionOrder) { +...
Non-null OK for both.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -325,7 +329,8 @@ public String toString() { return getClass().getSimpleName() + "(" + entityClass + ")"; } - public static <Solution_> boolean hasSorter(EntitySorterManner entitySorterManner, + // TODO: entityDescriptor @NonNull? + public static <Solution_> boolean hasSorter(@NonNull EntityS...
Non-null OK for both.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -234,28 +237,26 @@ public Config_ withFixedProbabilityWeight(Double fixedProbabilityWeight) { * Gather a list of all descendant {@link MoveSelectorConfig}s * except for {@link UnionMoveSelectorConfig} and {@link CartesianProductMoveSelectorConfig}. * - * @param leafMoveSelectorConfigList not nu...
Yes, it makes sense. I would not expect null inside of this collection.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -69,213 +72,215 @@ public class ValueSelectorConfig extends SelectorConfig<ValueSelectorConfig> { public ValueSelectorConfig() { } - public ValueSelectorConfig(String variableName) { + // TODO: @NonNull ok here?
I went over the code and everywhere this is called, it is actually given a value. If there is something in the docs about this, then first of all I don't really understand why we decided to document this, but more importantly, it should just be fixed to say that this is not nullable.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -275,112 +278,116 @@ public TerminationConfig withTerminationClass(Class<? extends Termination> termi return this; } - public TerminationConfig withTerminationCompositionStyle(TerminationCompositionStyle terminationCompositionStyle) { + public @NonNull TerminationConfig + withTermina...
This is very unclear. Erring on the side of caution, I'd say nullable.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -430,7 +437,8 @@ public void shortenTimeMillisSpentLimit(long timeMillisSpentLimit) { } } - public void overwriteUnimprovedSpentLimit(Duration unimprovedSpentLimit) { + // TODO @NonNull ok here? + public void overwriteUnimprovedSpentLimit(@NonNull Duration unimprovedSpentLimit) {
Dtto.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -268,10 +261,7 @@ public static SolverConfig createFromXmlReader(Reader reader, ClassLoader classL public SolverConfig() { } - /** - * @param classLoader sometimes null - */ - public SolverConfig(ClassLoader classLoader) { + public SolverConfig(@Nullable ClassLoader classLoader) {
People can create their own instances of this class, and build the solver config programmatically, as opposed to using XML. Therefore I'd say that nullable is correct here.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -58,7 +61,8 @@ public class ConfigUtils { * @param <T> the new instance type * @return new instance of clazz */ - public static <T> T newInstance(Object configBean, String propertyName, Class<T> clazz) { + // TODO: propertyName, clazz + public static <T> @NonNull T newInstance(@Nullable Ob...
I'd say so.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -87,8 +91,9 @@ public static <T> T newInstance(Supplier<String> ownerDescriptor, String propert } } - public static void applyCustomProperties(Object bean, String beanClassPropertyName, - Map<String, String> customProperties, String customPropertiesPropertyName) { + // TODO: param cu...
Judgment call. I say no.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -295,7 +304,8 @@ public static int ceilDivide(int dividend, int divisor) { return (dividend / divisor) + correction; } - public static int resolvePoolSize(String propertyName, String value, String... magicValues) { + // TODO what to make of magicValues? + public static int resolvePoolSize(St...
The user would have to specifically cast the `null` to either `String[]` or `String`, in order for this to work at all. For that reason, I say non-null. Also, shouldn't `propertyName` be non-null as well? I'd say so.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -384,6 +392,7 @@ public static List<Member> getAllMembers(Class<?> baseClass, Class<? extends Ann return memberStream.distinct().sorted(alphabeticMemberComparator).collect(Collectors.toList()); } + // TODO @SafeVarargs public static Class<? extends Annotation> extractAnnotationClass(Memb...
Agree.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -415,6 +425,7 @@ Maybe the member (%s) should return a parameterized %s.""" memberName, type, memberName, type.getSimpleName()))); } + // TODO public static Optional<Class<?>> extractGenericTypeParameter(String parentClassConcept, Class<?> parentClass, Class<?> type, ...
Agree.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -11,17 +14,19 @@ public interface MultiConstraintAssertion { * @param score total score calculated for the given set of facts * @throws AssertionError when the expected score does not match the calculated score */ - default void scores(Score<?> score) { + // TODO: @NonNull score sensible? + ...
Yes. This is an assertion - since it's not possible for score returned by the solver to ever be null, I'd say non-null here makes total sense.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -11,17 +14,19 @@ public interface MultiConstraintAssertion { * @param score total score calculated for the given set of facts * @throws AssertionError when the expected score does not match the calculated score */ - default void scores(Score<?> score) { + // TODO: @NonNull score sensible? + ...
Dtto.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -1,21 +1,22 @@ package ai.timefold.solver.test.api.score.stream; +import org.jspecify.annotations.NonNull; + public interface MultiConstraintVerification<Solution_> { /** * As defined by {@link SingleConstraintVerification#given(Object...)}. * - * @param facts never null, at least one - ...
Agree. For varargs, I think they generally should be non-null. (See my explanation above.)
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -90,10 +93,11 @@ public enum SolverMetric { this.isConstraintMatchBased = isConstraintMatchBased; } - public String getMeterId() { + public @NonNull String getMeterId() { return meterId; } + @NullMarked public static void registerScoreMetrics(SolverMetric metric, Tags ta...
I'd leave it for now. I'll have some downtime before the release, I'll go back to my notes and review some of the places where maybe I want to think about it a bit more. This will be one of them.
timefold-solver
github_2023
java
1,160
TimefoldAI
triceo
@@ -527,9 +518,9 @@ public SolverConfig withClassLoader(ClassLoader classLoader) { * As defined by {@link ScoreDirectorFactoryConfig#withEasyScoreCalculatorClass(Class)}, but returns this. * * @param easyScoreCalculatorClass sometimes null - * @return this, never null */ - public SolverCo...
Damn, I keep missing questions. :-( The Github UX for this needs to improve. I'd go with non-null - let's make a distinction between the getters and the withers. Brief search through the code indicates we do not actually pass null there anywhere.
timefold-solver
github_2023
java
1,185
TimefoldAI
zepfred
@@ -94,14 +95,14 @@ public void setTrackingWorkingSolution(boolean trackingWorkingSolution) { @Override public InnerScoreDirector<Solution_, Score_> buildScoreDirector() { - return buildScoreDirector(true, true); + return buildScoreDirector(false, ConstraintMatchPolicy.DISABLED);
Should we set `ENABLED_WITHOUT_JUSTIFICATIONS` or `ENABLED` instead?
timefold-solver
github_2023
java
1,185
TimefoldAI
zepfred
@@ -29,56 +30,53 @@ public interface InnerScoreDirectorFactory<Solution_, Score_ extends Score<Score InnerScoreDirector<Solution_, Score_> buildScoreDirector();
Is there documentation for the default value of `ConstraintMatchPolicy` used in `buildScoreDirector()`?
timefold-solver
github_2023
java
1,185
TimefoldAI
zepfred
@@ -28,9 +29,9 @@ public final class EasyScoreDirector<Solution_, Score_ extends Score<Score_>> private final EasyScoreCalculator<Solution_, Score_> easyScoreCalculator; public EasyScoreDirector(EasyScoreDirectorFactory<Solution_, Score_> scoreDirectorFactory, - boolean lookUpEnabled, boolean con...
It seems that changing the `ConstraintMatchPolicy` is no longer possible. Should it be allowed?
timefold-solver
github_2023
java
1,009
TimefoldAI
triceo
@@ -13,9 +15,10 @@ public interface PinningFilter<Solution_, Entity_> { /** * @param solution working solution to which the entity belongs - * @param entity never null, a {@link PlanningEntity} + * @param entity a {@link PlanningEntity} * @return true if the entity it is pinned, false if the ...
Agree.
timefold-solver
github_2023
java
1,009
TimefoldAI
triceo
@@ -46,6 +46,7 @@ * * @return {@link NullPinningFilter} when it is null (workaround for annotation limitation) */ + // TODO feels like this could be annotated with @NonNull
As we've agreed annotations wouldn't be treated, let's remove these TODOs.