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 | 573 | TimefoldAI | Christopher-Chianelli | @@ -849,6 +887,44 @@ void solveRepeatedlyListVariable(SoftAssertions softly) {
softly.assertThat(solution.getScore().isSolutionInitialized()).isTrue();
}
+ @Test
+ void solveWithAllowsUnassignedValuesListVariable() {
+ var solverConfig = PlannerTestUtils.buildSolverConfig(TestdataAllowsUnas... | Why is `firstEntity.getValueList()` empty for `solveWithUnassignedValuesListVariable` and equal to `[value1, value2]` for `constructionHeuristicWithAllowsUnassignedValuesListVariable`, since it appears the dataset are the same (or are index, previous and next problem facts instead of shadow variables)? |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,22 @@
+package ai.timefold.solver.core.impl.testdata.domain.list.allows_unassigned_values;
+
+import ai.timefold.solver.core.api.score.buildin.simple.SimpleScore;
+import ai.timefold.solver.core.api.score.stream.Constraint;
+import ai.timefold.solver.core.api.score.stream.ConstraintFactory;
+import ai.timefo... | Does `core-impl` have `constraint-streams` as a test dependency? |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -24,6 +24,7 @@ public static IndexShadowVariableDescriptor<TestdataPinnedListSolution> buildVar
.getShadowVariableDescriptor("index");
}
+ // Intentionally missing the inverse relation variable; some tests rely on it not being here. | TBH, not sure how I feel about TestdataPinnedListValue not having inverse relation variable, since it not obvious from the class name that this class is serving the second purpose of not having an inverse relation variable. |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -106,14 +107,14 @@ public static TestdataSolution generateTestdataSolution(String code, int entityA
// ScoreDirector methods
// ************************************************************************
- public static <Solution_> InnerScoreDirector<Solution_, SimpleScore> mockScoreDirector(
+ public... | Any particular reason to enable lookup in the mock? |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -138,7 +138,7 @@ Constraint roomConflict(ConstraintFactory factory) {
}
Constraint speakerUnavailableTimeslot(ConstraintFactory factory) {
- return factory.forEachIncludingNullVars(Talk.class)
+ return factory.forEachIncludingUnassigned(Talk.class) | I think the Talk still uses `nullable=true`, since I don't see it in the changed files |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -51,7 +51,7 @@ protected Constraint roomConflict(ConstraintFactory constraintFactory) {
}
protected Constraint avoidOvertime(ConstraintFactory constraintFactory) {
- return constraintFactory.forEachIncludingNullVars(MeetingAssignment.class)
+ return constraintFactory.forEachIncludingUnassig... | I think `MeetingAssignment` still uses `nullable=true`, since I don't see it in the changed files. |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -218,4 +232,151 @@ void uniquePairShouldWorkOnStringPlanningId() {
.rewards(1, "There should be rewards")).hasMessageContaining("There should be rewards")
.hasMessageContaining("Expected reward");
}
+
+ @Test
+ void listVarUnassignedWhileAllowsUnassigned() {
+ var ... | I don't think you tested the case where the assertion fails for SingleConstraintAssertionTest (but that probably covered in other tests). |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,62 @@
+package ai.timefold.solver.core.impl.domain.variable;
+
+import ai.timefold.solver.core.api.domain.variable.ListVariableListener;
+import ai.timefold.solver.core.impl.domain.variable.descriptor.ListVariableDescriptor;
+import ai.timefold.solver.core.impl.domain.variable.index.IndexVariableSupply;
+imp... | Nitpick: identity hash lookups? |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,193 @@
+package ai.timefold.solver.core.impl.score.director;
+
+import ai.timefold.solver.core.api.score.director.ScoreDirector;
+import ai.timefold.solver.core.impl.domain.solution.descriptor.SolutionDescriptor;
+import ai.timefold.solver.core.impl.domain.variable.descriptor.ListVariableDescriptor;
+import ... | For `AbstractEasyMove`, there are additional restrictions on `beforeListVariableChange` and `afterListVariableChanged`. In particular:
- The `fromIndex` of `afterListVariableChanged` must match the `fromIndex` of its `beforeListVariableChanged` call. Otherwise this will happen in the undo move
```
// beforeListVa... |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -451,29 +477,26 @@ private void createEffectivePlanningPinIndexReader() {
effectivePlanningPinToIndexReader = null;
return;
}
-
- var listVariableDescriptor = getGenuineListVariableDescriptor();
- var planningListVariableReader = new Function<Object, List<?>>() {
-
- ... | Style: we can use `->` switch statement/expressions:
```
switch (planningPinIndexMemberAccessorList.size()) {
case 0 -> {
// ...
}
}
``` |
timefold-solver | github_2023 | java | 573 | TimefoldAI | Christopher-Chianelli | @@ -52,50 +51,50 @@ public <Node_> EntityOrderInfo withNewNode(Node_ node, ListVariableDescriptor<?>
}
@SuppressWarnings("unchecked")
- public <Node_> Node_ successor(Node_ object, ListVariableDescriptor<?> listVariableDescriptor,
- IndexVariableSupply indexVariableSupply, SingletonInverseVari... | An selected entity has at least one unpinned index, right? |
timefold-solver | github_2023 | others | 573 | TimefoldAI | Christopher-Chianelli | @@ -12,12 +12,57 @@ recipeList:
oldPropertyKey: quarkus.timefold.solver.solve-length
newPropertyKey: quarkus.timefold.solver.solve.duration
fileMatcher: '**/application.properties'
+ - org.openrewrite.java.ChangeMethodName: | I don't see a corresponding open-rewrite test |
timefold-solver | github_2023 | java | 609 | TimefoldAI | triceo | @@ -0,0 +1,419 @@
+package ai.timefold.solver.spring.boot.autoconfigure.util;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java... | I think that this is a bad idea. This is a piece of code which we shouldn't be implementing; serialization is a well understood problem, it has security implications if done wrong, and there are libraries who will do it better than we can.
Solver config is fully serializable to XML. If we have to do crazy things, le... |
timefold-solver | github_2023 | java | 609 | TimefoldAI | triceo | @@ -0,0 +1,200 @@
+package ai.timefold.solver.spring.boot.autoconfigure;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.lang.model.element.Modifier;
+
+import ai.timefold.solver.core.api.solver.SolverFactory;
+import ai.tim... | Let's find a better name for this class. I'm not sure why it's called "contribution", and it should be `TimefoldSolver`, not `Timefold`. |
timefold-solver | github_2023 | java | 609 | TimefoldAI | triceo | @@ -0,0 +1,204 @@
+package ai.timefold.solver.spring.boot.autoconfigure;
+
+import java.util.function.BiFunction;
+
+import ai.timefold.solver.core.api.score.Score;
+import ai.timefold.solver.core.api.score.ScoreManager;
+import ai.timefold.solver.core.api.score.stream.Constraint;
+import ai.timefold.solver.core.api.sc... | Let's make this a proper class, inner if you prefer; reads better in stack traces and profiler results. |
timefold-solver | github_2023 | java | 609 | TimefoldAI | triceo | @@ -0,0 +1,419 @@
+package ai.timefold.solver.spring.boot.autoconfigure.util;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java... | ```suggestion
throw new IllegalArgumentException("Cannot serialize (%s) because it is not a public class."
.formatted(value));
```
Let's consistently apply this convention in new code.
It makes for messages that are easier to read, especially as the number of arguments gro... |
timefold-solver | github_2023 | java | 609 | TimefoldAI | triceo | @@ -0,0 +1,25 @@
+package ai.timefold.solver.spring.boot.it;
+
+import ai.timefold.solver.core.api.solver.SolverFactory;
+import ai.timefold.solver.spring.boot.it.domain.IntegrationTestSolution;
+
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.spring... | Timefold is a company; we have Solver, we have Orbit. Let's start using `TimefoldSolver` consistently, because we're dealing with the solver here, not with the company. |
timefold-solver | github_2023 | java | 618 | TimefoldAI | Christopher-Chianelli | @@ -10,50 +10,28 @@
import ai.timefold.solver.core.api.score.buildin.simple.SimpleScore;
import ai.timefold.solver.core.api.score.calculator.ConstraintMatchAwareIncrementalScoreCalculator;
-import ai.timefold.solver.core.api.score.constraint.ConstraintMatch;
import ai.timefold.solver.core.api.score.constraint.Cons... | Why was this change necessary? |
timefold-solver | github_2023 | java | 103 | TimefoldAI | ge0ffrey | @@ -992,9 +1020,11 @@ public long getMaximumValueCount(Solution_ solution) {
}
/**
+ * @deprecated This was never implemented; any code that depends on this will throw {@link UnsupportedOperationException}.
* @param solution never null
* @return {@code >= 0}
*/
+ @Deprecated(forRemo... | SolutionDescription isn't public API nor documention nor really know.
I'd just remove the method instead of deprecating it. |
timefold-solver | github_2023 | java | 103 | TimefoldAI | ge0ffrey | @@ -838,6 +839,12 @@ public void validateConstraintWeight(String constraintPackage, String constraint
// Extraction methods
// ************************************************************************
+ public Collection<Object> getAllEntities(Solution_ solution) { | Is this method used somewhere in the new code? |
timefold-solver | github_2023 | java | 173 | TimefoldAI | ge0ffrey | @@ -24,6 +24,22 @@ protected void validateCacheTypeVersusSelectionOrder(SelectionCacheType resolved
break;
case SORTED:
case SHUFFLED: | step caching with shuffled is a theoretically possible use case, no?
You generate all your moves at the beginning of a step (because you can't do it at phase cache because the generated moves change depending on the variables state), and then you want to go through them shuffled (unlike random get every element at mos... |
timefold-solver | github_2023 | java | 614 | TimefoldAI | Christopher-Chianelli | @@ -42,13 +42,30 @@ protected Move<Solution_> createUpcomingSelection() {
}
Object upcomingValue = valueIterator.next();
- ElementRef destination = destinationIterator.next();
-
+ ElementRef destination = findUnpinnedDestination(destinationIterator, listVariableDescriptor);
+ if... | Should this be a static method in `UpcomingSelectionIterator`? |
timefold-solver | github_2023 | others | 611 | TimefoldAI | triceo | @@ -161,18 +161,19 @@ However, in exam timetabling, that is allowed, if there is enough seating capaci
Assigning humans to start a meeting at four seconds after 9 o'clock is pointless because most human activities have a time granularity of five minutes or 15 minutes.
Therefore it is not necessary to allow a planni... | ```suggestion
It's recommended to use a coarse time granularity (such as 1 week, 1 day, 1 half day, ...) or shorten the planning window size to scale.
``` |
timefold-solver | github_2023 | others | 606 | TimefoldAI | triceo | @@ -2673,6 +2673,108 @@ the whole purpose of `MoveIteratorFactory` over `MoveListFactory` is to create a
in a custom ``Iterator.next()``.
====
+For example:
+
+[source,java,options="nowrap"]
+----
+public class PossibleAssignmentsOnlyMoveIteratorFactory implements MoveIteratorFactory<MyPlanningSolution, MyChangeMov... | ```suggestion
The same effect can also be accomplished using <<filteredSelection,filtered selection>>.
``` |
timefold-solver | github_2023 | java | 540 | TimefoldAI | triceo | @@ -10,4 +22,18 @@ public <Type_> Type_ toKey(int id) {
return (Type_) property;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ SingleIndexProperties<?> th... | This is an anti-pattern.
`Object.hash(...)` is a varargs method, and as such, every invocation creates a needless array that is immediately thrown away. This causes a major performance regression and should never be used on the hot path. |
timefold-solver | github_2023 | java | 540 | TimefoldAI | triceo | @@ -8,6 +10,35 @@
* @param <Key_>
* @param <Value_>
*/
-public record Pair<Key_, Value_>(Key_ key, Value_ value) {
+public class Pair<Key_, Value_> { | This causes Javadoc plugin to fail. The params need to be on the constructor, not on the class. (As it's no longer a record with a canonical constructor.) |
timefold-solver | github_2023 | java | 546 | TimefoldAI | zepfred | @@ -130,8 +128,17 @@ public ScoreAnalysis<Score_> diff(ScoreAnalysis<Score_> other) {
return ConstraintAnalysis.diff(constraintRef, constraintAnalysis, otherConstraintAnalysis);
},
(constraintRef, otherConstraintRef) -> constraintRef,
- ... | I wonder if this change could break existing user tests. |
timefold-solver | github_2023 | others | 541 | TimefoldAI | thimmwork | @@ -52,16 +57,61 @@ public class TimetableEasyScoreCalculator implements EasyScoreCalculator<Timetab
}
----
+--
+
+Kotlin::
++
+--
+[source,kotlin]
+----
+class TimetableEasyScoreCalculator : EasyScoreCalculator<Timetable?, HardSoftScore?> { | both Timetable and HardSoftScore should be not-null (no "?"), because the interface's only method will never be called with a null parameter and the returned score should never be null, right? btw sorry to bust in here, and probably being out of line. |
timefold-solver | github_2023 | others | 541 | TimefoldAI | thimmwork | @@ -122,5 +172,150 @@ public class TimetableConstraintProvider implements ConstraintProvider {
}
----
+--
+
+Kotlin::
++
+--
+Create a `src/main/kotlin/org/acme/schooltimetabling/solver/TimetableConstraintProvider.kt` class:
+
+[source,kotlin]
+----
+package org.acme.schooltimetabling.solver
+
+import ai.timefold.s... | return type should be not-null (no "?") |
timefold-solver | github_2023 | others | 541 | TimefoldAI | thimmwork | @@ -122,5 +172,150 @@ public class TimetableConstraintProvider implements ConstraintProvider {
}
----
+--
+
+Kotlin::
++
+--
+Create a `src/main/kotlin/org/acme/schooltimetabling/solver/TimetableConstraintProvider.kt` class:
+
+[source,kotlin]
+----
+package org.acme.schooltimetabling.solver
+
+import ai.timefold.s... | parentheses can be removed as the lambda is the only parameter.
all parameters are not-null in this case, aren't they? removing lesson2's "?" will eliminate the need for not-null casting ("!!") in the next line. Same applies to the justifyWith() calls that follow |
timefold-solver | github_2023 | others | 541 | TimefoldAI | zepfred | @@ -391,19 +395,326 @@ public class TimetableApp {
}
----
+--
+
+Kotlin::
++
+--
+Create the `src/main/kotlin/org/acme/schooltimetabling/TimetableApp.kt` class:
+
+[source,kotlin]
+----
+package org.acme.schooltimetabling
+
+import ai.timefold.solver.core.api.solver.SolverFactory
+import ai.timefold.solver.core.con... | There is no `id` property for `Timeslot`. We should either update the model class or remove `nextTimeslotId++`. |
timefold-solver | github_2023 | others | 541 | TimefoldAI | zepfred | @@ -391,19 +395,326 @@ public class TimetableApp {
}
----
+--
+
+Kotlin::
++
+--
+Create the `src/main/kotlin/org/acme/schooltimetabling/TimetableApp.kt` class:
+
+[source,kotlin]
+----
+package org.acme.schooltimetabling
+
+import ai.timefold.solver.core.api.solver.SolverFactory
+import ai.timefold.solver.core.con... | There is no `id` property for `Room`. We should either update the model class or remove `nextRoomId++`. |
timefold-solver | github_2023 | others | 541 | TimefoldAI | zepfred | @@ -545,6 +888,56 @@ class TimetableConstraintProviderTest {
}
----
+--
+
+Kotlin::
++
+--
+
+Create the `src/test/kotlin/org/acme/schooltimetabling/solver/TimetableConstraintProviderTest.kt` class:
+
+[source,kotlin]
+----
+package org.acme.schooltimetabling.solver
+
+import ai.timefold.solver.core.api.score.strea... | Same `id` issue for `Room` and `Timeslot`. |
timefold-solver | github_2023 | others | 541 | TimefoldAI | zepfred | @@ -692,6 +1091,9 @@ application {
----
After building the project, you can find an archive with a runnable application inside the `build/distributions/` directory.
+-- | Let's make it consistent with Maven:
```
After building the project, you can find an archive with a runnable application inside the `build/libs/` directory.
[source,options="nowrap"]
----
$ gradle build
...
$ java -jar build/libs/hello-world-1.0-SNAPSHOT.jar
----
``` |
timefold-solver | github_2023 | java | 536 | TimefoldAI | zepfred | @@ -111,6 +120,96 @@ void solve() {
assertThat(solution.getScore().isSolutionInitialized()).isTrue();
}
+ @Test | Nice! |
timefold-solver | github_2023 | java | 536 | TimefoldAI | zepfred | @@ -865,4 +964,74 @@ void solveWithMultipleChainedPlanningEntities() {
assertThat(solution.getScore().isSolutionInitialized()).isTrue();
}
+ public static class CorruptedEasyScoreCalculator implements EasyScoreCalculator<TestdataSolution, SimpleScore> { | Mocking this class would make the test simpler. |
timefold-solver | github_2023 | java | 536 | TimefoldAI | zepfred | @@ -865,4 +964,74 @@ void solveWithMultipleChainedPlanningEntities() {
assertThat(solution.getScore().isSolutionInitialized()).isTrue();
}
+ public static class CorruptedEasyScoreCalculator implements EasyScoreCalculator<TestdataSolution, SimpleScore> {
+
+ @Override
+ public SimpleScor... | Same mocking idea as above. |
timefold-solver | github_2023 | others | 538 | TimefoldAI | rsynek | @@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Expects the following environment variables to be set:
+# $SPRING_INITIALIZR_YAML_FILE_PATH (Example: "application.yml")
+# $TIMEFOLD_SOLVER_VERSION (Example: "1.6.0")
+
+# Temporary file
+temp_file="temp.yml"
+
+# Flag to indicate if the 'timefold-solver' keyword is ... | After looking at the `application.yaml` I finally understand why this loop cannot be just a simple `sed` command (all hail the yaml files). |
timefold-solver | github_2023 | others | 494 | TimefoldAI | triceo | @@ -604,7 +601,7 @@ In Maven, add the following to your `pom.xml`:
...
<build>
<plugins>
- <plugin>
+ <plugin> | The formatting doesn't seem right here. The indent should be two spaces, no? |
timefold-solver | github_2023 | others | 494 | TimefoldAI | triceo | @@ -61,7 +61,6 @@ public class Timeslot {
----
Because no `Timeslot` instances change during solving, a `Timeslot` is called a _problem fact_.
-Such classes do not require any Timefold Solver specific annotations. | Any reason why you're removing this line? |
timefold-solver | github_2023 | others | 494 | TimefoldAI | triceo | @@ -627,33 +639,33 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@SpringBootTest(properties = {
"timefold.solver.termination.spent-limit=1h", // Effectively disable this termination in favor of the best-score-limit
"timefold.solver.termination.best-score-limit=0hard/*soft"})
-public c... | ```suggestion
For a full implementation with a web UI and in-memory storage, check out {spring-boot-quickstart-url}[the Spring-boot quickstart source code].
``` |
timefold-solver | github_2023 | java | 484 | TimefoldAI | triceo | @@ -695,14 +695,18 @@ public void assertExpectedUndoMoveScore(Move<Solution_> move, Score_ beforeMoveS
assertShadowVariablesAreNotStale(undoScore, undoMoveText);
String corruptionDiagnosis = "";
if (trackingWorkingSolution) {
- // Recalculate all shadow variables fr... | ```suggestion
``` |
timefold-solver | github_2023 | java | 484 | TimefoldAI | triceo | @@ -142,28 +143,54 @@ void corruptedUndoShadowVariableListener(EnvironmentMode environmentMode) {
SolverConfig solverConfig = new SolverConfig()
.withEnvironmentMode(environmentMode)
.withSolutionClass(CorruptedUndoShadowSolution.class)
- .withEntityClasses(Corr... | ```suggestion
// FAST_ASSERT does not create snapshots since it is not intrusive, and hence it can only
``` |
timefold-solver | github_2023 | java | 474 | TimefoldAI | rsynek | @@ -50,19 +50,21 @@ public List<RecommendedFit<Out_, Score_>> apply(InnerScoreDirector<Solution_, Sc
entityPlacer.stepStarted(stepScope);
try (scoreDirector) {
- for (var placement : entityPlacer) {
- var recommendedFitList = new ArrayList<RecommendedFit<Out_, Score_>>();
-... | Interesting there is no `sort()` method without a parameter instead of forcing users to pass `null`. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -63,7 +67,18 @@ public abstract class AbstractScoreDirector<Solution_, Score_ extends Score<Scor
private long calculationCount = 0L;
protected Solution_ workingSolution;
protected Integer workingInitScore = null;
- private ShadowVariablesAssert beforeMoveSnapshot;
+ private AllVariablesAssert<So... | This complicates the score director far too much.
Let's think of a way of encapsulating it in a single type. All of this work should happen within that type, with the interactions between `ScoreDirector` and the other type being kept at a minimum; thinking out loud here, perhaps some event-based system could do.
... |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -147,15 +155,23 @@ void corruptedUndoShadowVariableListener(EnvironmentMode environmentMode) {
switch (environmentMode) {
case FULL_ASSERT:
- case FAST_ASSERT: | We need a name for the new environment mode, something more descriptive than `SUPER_FULL_ASSERT`. Or maybe not?
Your original numbers suggest that this is not *that much* slower than `FULL_ASSERT`. If you can first fix the score calculation numbers to give us *correct* data, we can assess those speeds again and if w... |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -644,53 +693,166 @@ public void assertExpectedUndoMoveScore(Move<Solution_> move, Score_ beforeMoveS
if (!undoScore.equals(beforeMoveScore)) {
logger.trace(" Corruption detected. Diagnosing...");
- ShadowVariablesAssert afterUndoSnapshot =
- ShadowVariable... | It is very difficult to decipher what this will produce.
Let's start moving away from string builders; this is not performance-sensitive code, this leads to an exception.
So we can use the `"something %s something else".formatted(var)` pattern to make this much more readable.
We can also use raw strings to get rid o... |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -644,53 +693,166 @@ public void assertExpectedUndoMoveScore(Move<Solution_> move, Score_ beforeMoveS
if (!undoScore.equals(beforeMoveScore)) {
logger.trace(" Corruption detected. Diagnosing...");
- ShadowVariablesAssert afterUndoSnapshot =
- ShadowVariable... | Same comment on readable strings. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -644,53 +693,166 @@ public void assertExpectedUndoMoveScore(Move<Solution_> move, Score_ beforeMoveS
if (!undoScore.equals(beforeMoveScore)) {
logger.trace(" Corruption detected. Diagnosing...");
- ShadowVariablesAssert afterUndoSnapshot =
- ShadowVariable... | IMO we can also do a lot here to make the string much more readable, raw strings were made for this. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -644,53 +693,166 @@ public void assertExpectedUndoMoveScore(Move<Solution_> move, Score_ beforeMoveS
if (!undoScore.equals(beforeMoveScore)) {
logger.trace(" Corruption detected. Diagnosing...");
- ShadowVariablesAssert afterUndoSnapshot =
- ShadowVariable... | Let's make this (and other `append...` functions) a function without side effects; return `String`, don't accept `out`. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,100 @@
+package ai.timefold.solver.core.api.solver.exception;
+
+import ai.timefold.solver.core.api.score.Score;
+import ai.timefold.solver.core.impl.heuristic.move.Move;
+import ai.timefold.solver.core.impl.score.director.AbstractScoreDirectorFactory;
+import ai.timefold.solver.core.impl.score.director.Inne... | As much as I like the idea of giving the user something to use in their code to catch and reproduce a corruption, I don't think I'm ready to expose `Move` to people and tell them to use it.
When in doubt leave it out?
We can give them `toString()` of the move, if that'd help.
We can discuss on Slack.
|
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,100 @@
+package ai.timefold.solver.core.api.solver.exception;
+
+import ai.timefold.solver.core.api.score.Score;
+import ai.timefold.solver.core.impl.heuristic.move.Move;
+import ai.timefold.solver.core.impl.score.director.AbstractScoreDirectorFactory;
+import ai.timefold.solver.core.impl.score.director.Inne... | IMO exceptions should not have complex methods such as this one. If the users want to execute something over those solutions, they can do so on their own. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,100 @@
+package ai.timefold.solver.core.api.solver.exception; | I am definitely not ready to expose this in the public API.
I'm not saying it will never be exposed, but let's give it some bake time in the internals; if users pick it up, we can talk about exposing it. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,54 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import ai.timefold.solver.core.impl.domain.entity.descriptor.EntityDescriptor;
+import ai.timefold.solver.core.im... | IntelliJ has a plugin (I think it's called Grazie) that suggests appropriate line breaks in comments (among other things).
It makes for longer comments, but ones that read much better, because the lines are short and nothing goes over the fold.
I suggest you start using it and review the comments in your PR with that p... |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,6 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import ai.timefold.solver.core.impl.domain.variable.descriptor.VariableDescriptor;
+
+public record VariableId<Solution_>(VariableDescriptor<Solution_> variableDescriptor, Object entity) { | Thinking out loud... two records are considered equal if their components are equal. This works for variable descriptor, but how about entities? Does this need to survive cloning? After cloning, entities may not be equal - what often determines equality is their Planning ID. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,48 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import ai.timefold.solver.core.impl.domain.solution.descriptor.SolutionDescriptor;
+import ai.timefold.solver.core.impl.domain.variable.... | Could be a record too, no? You can have custom constructors for records. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,54 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import ai.timefold.solver.core.impl.domain.entity.descriptor.EntityDescriptor;
+import ai.timefold.solver.core.im... | If you only want this constructed from this method, you should introduce a private constructor. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,54 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import ai.timefold.solver.core.impl.domain.entity.descriptor.EntityDescriptor;
+import ai.timefold.solver.core.im... | Let's agree going forward that if a type can be `final`, it will be final, OK?
I'd also argue that we should agree on hiding types in packages by default, but that's not applicable here. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,99 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ai.timefold.solver.core.api.domain.variable.VariableListener;
+import ai.timefold.solver.core.api.score.director.ScoreDirector;
+import ai.timefold.solver.c... | We call that a `Genuine` variable. (Technically, the list variable is `GenuineListVariable`, but plenty of places shortcut that to just `ListVariable` already.) |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,54 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import ai.timefold.solver.core.impl.domain.entity.descriptor.EntityDescriptor;
+import ai.timefold.solver.core.im... | These long declarations call for `var`. The type of the variable here is obvious enough from the right hand side. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,107 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ai.timefold.solver.core.api.domain.variable.ListVariableListener;
+import ai.timefold.solver.core.api.score.director.ScoreDirector;
+import ai.timefold.sol... | IIRC for the demand-supply mechanism to work properly, the demands actually need to equal to some others, otherwise you're not really achieving the perf benefits for which the system exists.
Did you really mean that no two demands should ever be equal? |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,99 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ai.timefold.solver.core.api.domain.variable.VariableListener;
+import ai.timefold.solver.core.api.score.director.ScoreDirector;
+import ai.timefold.solver.c... | I see you use `var` in some places, and in others you don't. Let's try to be a bit more consistent; let's always use `var` where the right hand side makes it sufficiently obvious what ends up on the left hand side.
For collection declarations, I don't have a firm opinion. The generics either need to be on the LHS or R... |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,99 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import ai.timefold.solver.core.api.domain.variable.VariableListener;
+import ai.timefold.solver.core.api.score.director.ScoreDirector;
+import ai.timefold.solver.c... | Same comment as above regarding demand/supply. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,192 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import ai.timefold.solver.core.impl.domain.entity.descriptor.EntityDescriptor;
+import ai.time... | Since at this point in time, performance no longer matters, this is the place where lambdas can help a lot with reducing code verbosity. I'd use `forEach` here. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,192 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import ai.timefold.solver.core.impl.domain.entity.descriptor.EntityDescriptor;
+import ai.time... | I'd argue that the following reads better:
out.append("""
Variables that are different between before and undo:
%s"""
.formatted(formatList(changedBetweenBeforeAndUndo)));
The newlines are an anti-pattern which Java finally gave us a way to avoid.
|
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,192 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import ai.timefold.solver.core.impl.domain.entity.descriptor.EntityDescriptor;
+import ai.time... | I'm wondering if this perhaps creates too much verbosity. Why not `[A, B, C, D, ...]`?
Or do you expect the list elements to contain far too much text to require this extra formatting? |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -0,0 +1,48 @@
+package ai.timefold.solver.core.impl.domain.variable.listener.support.violation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import ai.timefold.solver.core.impl.domain.solution.descriptor.SolutionDescriptor;
+import ai.timefold.solver.core.impl.domain.variable.... | Why not use `equals(...)` for this? Isn't that what it's for? |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -203,13 +211,16 @@ private void assertNonNullPlanningId(Object fact) {
@Override
public Score_ doAndProcessMove(Move<Solution_> move, boolean assertMoveScoreFromScratch) {
- if (assertMoveScoreFromScratch) {
- beforeMoveSnapshot = ShadowVariablesAssert.takeSnapshot(getSolutionDescriptor... | I like the previous approach, where this condition was hidden behind a variable. The variable makes the purpose of the check obvious, while hiding what the check actually is. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -607,7 +621,8 @@ public void assertShadowVariablesAreNotStale(Score_ expectedWorkingScore, Object
+ "s were triggered without changes to the genuine variables"
+ " after completedAction (" + completedAction + ").\n"
+ "But all the shadow variable values ... | Since we're touching this code, let's convert this nastiness to the new formatting pattern.
Remember: if you can, and it is not too disruptive, always leave the code in better shape than the one you found it in. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -667,53 +682,41 @@ public void assertExpectedUndoMoveScore(Move<Solution_> move, Score_ beforeMoveS
if (!undoScore.equals(beforeMoveScore)) {
logger.trace(" Corruption detected. Diagnosing...");
- ShadowVariablesAssert afterUndoSnapshot =
- ShadowVariables... | Dtto., formatting pattern. |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -68,6 +69,14 @@ public void setAssertClonedSolution(boolean assertClonedSolution) {
this.assertClonedSolution = assertClonedSolution;
}
+ public boolean isTrackingWorkingSolution() { | This deserves a Javadoc, pointing to someplace that describes what it will do. Perhaps a reference to the relevant `EnvironmentMode`? |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -88,17 +87,16 @@ void determinism(EnvironmentMode environmentMode) {
Solver<TestdataSolution> solver2 = SolverFactory.<TestdataSolution> create(solverConfig).buildSolver();
switch (environmentMode) {
- case NON_REPRODUCIBLE:
+ case NON_REPRODUCIBLE -> { | I like we're doing this!
Just please double check the entire codebase for switching over environment modes and apply this consistently. (If you haven't already.) |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -141,6 +141,8 @@ void constraintPresentEvenIfNoMatches() {
scoreDirector.beforeVariableChanged(entity, "value");
entity.setValue(null);
scoreDirector.afterVariableChanged(entity, "value");
+ // FULL_ASSERT add variable listeners for tracking
+ scoreDirecto... | This concerns me.
Are you saying we need to do something *new* in order to use this functionality?
Why would this code need it, if it doesn't run any of the assert modes? |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -19,6 +19,26 @@
*/
@XmlEnum
public enum EnvironmentMode {
+ /**
+ * This mode turns on variable tracking and all assertions to fail-fast on a bug in a {@link Move} implementation, a
+ * constraint, the engine itself or something else at an appalling performance cost.
+ * <p>
+ * Because it tra... | Besides the general comment on line breaks and formatting, I think maybe we're a bit more evolved now to use words such as "horrible" and "appaling" in user-facing documentation. :-)
In this case, I suggest "This mode is by far the slowest of all the modes."
Also, somewhere in the body of the text, I would referen... |
timefold-solver | github_2023 | java | 433 | TimefoldAI | triceo | @@ -19,6 +19,26 @@
*/
@XmlEnum
public enum EnvironmentMode {
+ /**
+ * This mode turns on variable tracking and all assertions to fail-fast on a bug in a {@link Move} implementation, a
+ * constraint, the engine itself or something else at an appalling performance cost.
+ * <p>
+ * Because it tra... | This no longer turns on _all_ assertions. |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
The TRACED_FULL_ASSERT mode turns on all the <<environmentModeFullAssert, FULL_ASSERT>> assertions and additionally tracks changes to the working solution.
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
Consider the following incorrectly implemented move:
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
When it is evaluated by the solver, an exception will be thrown with the following in its message:
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
- Genuine and shadow variables that are different between "before" and "undo".
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
- Variables that are different between "from scratch" and "before".
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
- Variables that are different between "from scratch" and "undo".
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
- Missing variable listener events for the actual move.
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
Any variable that changed between the "before move" solution and the "after move" solution without either a
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
Any variable that changed between the "after move" solution and "after undo move" solution without either a
``` |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | The reproducible mode deserves a direct reference. (Unless it doesn't have an ID.) |
timefold-solver | github_2023 | others | 433 | TimefoldAI | triceo | @@ -102,6 +102,59 @@ This mode is reproducible (see the reproducible mode). It is also intrusive beca
The FULL_ASSERT mode is horribly slow (because it does not rely on incremental score calculation).
+[#environmentModeTracedFullAssert]
+=== `TRACED_FULL_ASSERT`
+
+The TRACED_FULL_ASSERT mode turns on all the <<en... | ```suggestion
The `TRACED_FULL_ASSERT` mode is by far the slowest mode,
because it clones solutions before and after each move.
``` |
timefold-solver | github_2023 | others | 432 | TimefoldAI | rsynek | @@ -522,6 +522,109 @@ A `BestSolutionChangedEvent` does not guarantee that every `ProblemChange` has b
. Use `Score.isSolutionInitialized()` instead of `Score.isFeasible()` to only ignore uninitialized solutions, but do accept infeasible solutions too.
+
+[#recommendedFitAPI]
+== Responding to adhoc changes
+
+Wit... | Every user might have a different idea what a simple API is.
```suggestion
The Recommended Fit API allows you to quickly respond to adhoc changes,
``` |
timefold-solver | github_2023 | others | 432 | TimefoldAI | rsynek | @@ -522,6 +522,109 @@ A `BestSolutionChangedEvent` does not guarantee that every `ProblemChange` has b
. Use `Score.isSolutionInitialized()` instead of `Score.isFeasible()` to only ignore uninitialized solutions, but do accept infeasible solutions too.
+
+[#recommendedFitAPI]
+== Responding to adhoc changes
+
+Wit... | ```suggestion
Once the customer has accepted one of the available options
``` |
timefold-solver | github_2023 | others | 432 | TimefoldAI | rsynek | @@ -522,6 +522,109 @@ A `BestSolutionChangedEvent` does not guarantee that every `ProblemChange` has b
. Use `Score.isSolutionInitialized()` instead of `Score.isFeasible()` to only ignore uninitialized solutions, but do accept infeasible solutions too.
+
+[#recommendedFitAPI]
+== Responding to adhoc changes
+
+Wit... | What happens if the planning entity has two planning variables of different types? Do we call the API twice (for every variable with different proposition functions)? |
timefold-solver | github_2023 | others | 432 | TimefoldAI | rsynek | @@ -522,6 +522,109 @@ A `BestSolutionChangedEvent` does not guarantee that every `ProblemChange` has b
. Use `Score.isSolutionInitialized()` instead of `Score.isFeasible()` to only ignore uninitialized solutions, but do accept infeasible solutions too.
+
+[#recommendedFitAPI]
+== Responding to adhoc changes
+
+Wit... | Can you maybe think of an example to show this situation? |
timefold-solver | github_2023 | java | 432 | TimefoldAI | mcimbora | @@ -0,0 +1,50 @@
+package ai.timefold.solver.core.impl.solver;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Function;
+
+import ai.timefold.solver.core.api.score.Score;
+import ai.timefold.solver.core.api.solver.RecommendedFit;
+import ai.timefold.solver.core.api.solver.ScoreAnalysisF... | Trying to understand this check. Let's say I've got the following solution with nullable variables (which is very common use case, since you might not be able to assign all the shifts everytime the solver runs).
Shift A - null
Shift B - employee1
Shift C - employee2
Now I call recommend(solution_with_shift_D, Shift D... |
timefold-solver | github_2023 | java | 446 | TimefoldAI | mcimbora | @@ -11,12 +13,12 @@ public interface SequenceChain<Value_, Difference_ extends Comparable<Difference
/**
* @return never null; the sequences contained in the collection in ascending order.
*/
- Iterable<Sequence<Value_, Difference_>> getConsecutiveSequences();
+ Collection<Sequence<Value_, Differ... | +1 Collection is easier to work with.
Unrelated to this changeset, with List, we could even get rid of getFirst/last etc? No strong opinion if these will be used. |
timefold-solver | github_2023 | java | 446 | TimefoldAI | mcimbora | @@ -0,0 +1,252 @@
+package ai.timefold.solver.jackson.api.score.stream.common;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.SoftAssertions.assertSoftly;
+
+import java.util.List;
+
+import ai.timefold.solver.core.api.score.stream.ConstraintCollectors;
+import ai.timef... | Wondering if we need first/last attributes? This can be derived from the position of the sequence in the array, wdyt? |
timefold-solver | github_2023 | java | 446 | TimefoldAI | mcimbora | @@ -0,0 +1,252 @@
+package ai.timefold.solver.jackson.api.score.stream.common;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.SoftAssertions.assertSoftly;
+
+import java.util.List;
+
+import ai.timefold.solver.core.api.score.stream.ConstraintCollectors;
+import ai.timef... | Got that, when a sequence with an id is already included in the payload, we use the id reference, otherwise we attach the sequence object (id + index). |
timefold-solver | github_2023 | others | 437 | TimefoldAI | rsynek | @@ -6,16 +6,20 @@
** xref:quickstart/spring-boot/spring-boot-quickstart.adoc[leveloffset=+1]
* xref:use-cases-and-examples/use-cases-and-examples.adoc[leveloffset=+1]
* xref:configuration/configuration.adoc[leveloffset=+1] | What is the difference between this configuration chapter and the `using-timefold-solver/configuration.adoc` ? I would rather avoid duplicate menu entries. |
timefold-solver | github_2023 | java | 428 | TimefoldAI | rsynek | @@ -1,115 +1,568 @@
package ai.timefold.solver.constraint.streams.bavet.common.index;
-import java.util.Map;
+import java.util.ArrayList;
import java.util.NavigableMap;
import java.util.TreeMap;
+import java.util.function.BiFunction;
+import java.util.function.Function;
import java.util.function.Supplier;
+impo... | The condition and the comment made me think there is a bug at the first glance; after carefully looking in the code I understand we intentionally skip the map for Equal joiners so that the index increases through the iteration.
Maybe a bit more explanatory comment would help. |
timefold-solver | github_2023 | java | 426 | TimefoldAI | Christopher-Chianelli | @@ -1829,6 +1879,248 @@ public static <A, ResultContainer_, Result_> UniConstraintCollector<A, ResultCon
composeFunction);
}
+ // ************************************************************************
+ // consecutive collectors
+ // ***************************************************... | I wonder if these interfaces should be top-level |
timefold-solver | github_2023 | java | 426 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,40 @@
+package ai.timefold.solver.core.impl.score.stream.bi;
+
+import java.util.Objects;
+import java.util.function.BiFunction;
+import java.util.function.Supplier;
+import java.util.function.ToIntFunction;
+
+import ai.timefold.solver.core.api.score.stream.ConstraintCollectors.SequenceChain;
+import ai.tim... | You can call `super.equals()` to check if mappers are the same |
timefold-solver | github_2023 | java | 426 | TimefoldAI | Christopher-Chianelli | @@ -10,9 +10,9 @@
abstract sealed class ObjectCalculatorBiCollector<A, B, Input_, Output_, Calculator_ extends ObjectCalculator<Input_, Output_>>
implements BiConstraintCollector<A, B, Calculator_, Output_>
- permits AverageReferenceBiCollector, CountDistinctIntBiCollector, CountDistinctLongBiCollect... | Can remain private; call `super.equals` in subclasses' `equals` method. |
timefold-solver | github_2023 | java | 426 | TimefoldAI | Christopher-Chianelli | @@ -79,9 +101,9 @@ void testConsecutiveNumbers() {
tree.add(atomic(8), 8);
IterableList<Sequence<AtomicInteger, Integer>> sequenceList = new IterableList<>(tree.getConsecutiveSequences());
- assertThat(sequenceList).hasSize(2);
+ Assertions.assertThat(sequenceList).hasSize(2); | Why use `Assertions.assertThat` when `import static org.assertj.core.api.Assertions.assertThat;` is in the file? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.