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
others
734
TimefoldAI
zepfred
@@ -366,89 +368,109 @@ A xref:using-timefold-solver/running-the-solver.adoc#logging[logging level] of ` and slow down the xref:constraints-and-score/performance.adoc#scoreCalculationSpeed[score calculation speed]. ==== -[#planningId] -==== `@PlanningId` - -For some functionality (such as multi-threaded solving and ...
```suggestion It is especially useful for large datasets, where score calculation speed is the bottleneck. ```
timefold-solver
github_2023
others
734
TimefoldAI
zepfred
@@ -366,89 +368,109 @@ A xref:using-timefold-solver/running-the-solver.adoc#logging[logging level] of ` and slow down the xref:constraints-and-score/performance.adoc#scoreCalculationSpeed[score calculation speed]. ==== -[#planningId] -==== `@PlanningId` - -For some functionality (such as multi-threaded solving and ...
```suggestion but the scaling is not exactly linear due to the overhead of managing communication between multiple threads. ```
timefold-solver
github_2023
others
734
TimefoldAI
zepfred
@@ -366,89 +368,109 @@ A xref:using-timefold-solver/running-the-solver.adoc#logging[logging level] of ` and slow down the xref:constraints-and-score/performance.adoc#scoreCalculationSpeed[score calculation speed]. ==== -[#planningId]
The page responding-to-change.adoc still references this section
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -301,50 +301,12 @@ To pin the entire list, preventing any modifications to the list whatsoever, Replanning an existing plan can be very disruptive. If the plan affects humans (such as employees, drivers, ...), very disruptive changes are often undesirable. -In such cases, nonvolatile replanning helps by restrict...
Can we retain this example? It appears intersting to me.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -1648,48 +1525,8 @@ public interface ConstraintMatchAwareIncrementalScoreCalculator<Solution_, Score } ---- -For example in machine reassignment, create one `ConstraintMatchTotal` per constraint type and call `addConstraintMatch()` for each constraint match:
Can we keep or replace the code by another example?
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -1810,114 +1728,38 @@ To use a custom cloner, configure it on the planning solution: [source,java,options="nowrap"] ---- -@PlanningSolution(solutionCloner = NQueensSolutionCloner.class) -public class NQueens { +@PlanningSolution(solutionCloner = TimetableSolutionCloner.class) +public class Timetable { ... ...
Let's add an initialization snippet from school timetabling quickstart.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -23,7 +23,7 @@ Annotate it with `@ConstraintConfiguration`: [source,java,options="nowrap"] ---- @ConstraintConfiguration -public class ConferenceConstraintConfiguration {
Why are we replacing conference scheduling with vehicle routing?
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -142,11 +143,15 @@ image::constraints-and-score/overview/scoreFoldingIsBroken.png[align="center"] [NOTE] ==== -Your business might tell you that your hard constraints all have the same weight, because they cannot be broken (so the weight does not matter). This is not true because if no feasible solution exists f...
```suggestion For example, in vehicle routing, if a vehicle exceeds its capacity by 15 tons, ```
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -195,20 +190,20 @@ get the `Indictment` map from the ``ScoreExplanation``: [source,java,options="nowrap"] ---- -SolutionManager<CloudBalance, HardSoftScore> scoreManager = SolutionManager.create(solverFactory); -ScoreExplanation<CloudBalance, HardSoftScore> scoreExplanation = solutionManager.explain(cloudBalance...
```suggestion for (Visit visit : vehicleRoutePlan.getVisitList()) { ``` ```suggestion for (Visit visit : vehicleRoutePlan.getVisitList()) { ``` ```suggestion for (Visit visit : vehicleRoutePlan.getVisitList()) { ``` ```suggestion for (Visit visit : vehicleRoutePlan.getVisitList()) { ``` ```suggestion for (...
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -686,21 +684,9 @@ public interface Solver<Solution_> { ---- The ``BestSolutionChangedEvent``'s `newBestSolution` may not be initialized or feasible. -Use the `isFeasible()` method on ``BestSolutionChangedEvent``'s new best `Score` to detect such cases: -
Can we keep/replace this snippet?
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -2235,7 +2203,8 @@ public interface SelectionProbabilityWeightFactory<Solution_, T> { </entitySelector> ---- -For example, if there are three entities: process A (probabilityWeight 2.0), process B (probabilityWeight 0.5) and process C (probabilityWeight 0.5), then process A will be selected four times more t...
Should we replace the word process by visit or any other model name?
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -2399,59 +2344,27 @@ it must not change any of the problem facts as that will cause score corruption. Use xref:responding-to-change/responding-to-change.adoc#realTimePlanning[real-time planning] to change problem facts while solving. ==== -Timefold Solver automatically filters out _non doable moves_ by calling t...
Let's add another example.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -2519,12 +2432,12 @@ and return all their values (to which they are changing) in ``getPlanningValues( ---- @Override
Let's add another code?
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -2991,11 +2857,9 @@ For example, on N queens it hits wall at a few dozen queens: image::optimization-algorithms/exhaustiveSearchScalabilityNQueens.png[align="center"] -In most use cases, such as Cloud Balancing, the wall appears out of thin air: - -image::optimization-algorithms/exhaustiveSearchScalabilityCloud...
Let's delete the image exhaustiveSearchScalabilityCloudBalance.png.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -200,41 +200,11 @@ To attain a schedule in which certain entities are scheduled earlier in the sche Only consider adding planning entity difficulty too if it can make the solver more efficient. ==== -To allow the heuristics to take advantage of that domain specific information, set a `difficultyComparatorClass` ...
Let's reuse the VRP code you showed before.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -1044,45 +1014,18 @@ To affect the score function, xref:constraints-and-score/overview.adoc#formalize Only consider adding planning value strength too if it can make the solver more efficient. ==== -To allow the heuristics to take advantage of that domain specific information, set a `strengthComparatorClass` to ...
Let's add a code snippet.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -1044,45 +1014,18 @@ To affect the score function, xref:constraints-and-score/overview.adoc#formalize Only consider adding planning value strength too if it can make the solver more efficient. ==== -To allow the heuristics to take advantage of that domain specific information, set a `strengthComparatorClass` to ...
Let's add a code snippet
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -1401,48 +1409,12 @@ public interface EasyScoreCalculator<Solution_, Score_ extends Score<Score_>> { } ---- -For example in N-queens: - -[source,java,options="nowrap"] ----- -public class NQueensEasyScoreCalculator
Let's add an EasyScoreCalculator code snippet.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -1504,113 +1476,18 @@ public interface IncrementalScoreCalculator<Solution_, Score_ extends Score<Scor image::constraints-and-score/score-calculation/incrementalScoreCalculatorSequenceDiagram.png[align="center"] -For example in n queens: - -[source,java,options="nowrap"] ----- -public class NQueensAdvancedIncre...
Does it make sense to add the incremental score calculator?
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -2121,49 +2091,14 @@ public interface SelectionSorterWeightFactory<Solution_, T> { } ---- -[source,java,options="nowrap"] ----- -public class QueenDifficultyWeightFactory implements SelectionSorterWeightFactory<NQueens, Queen> { - - public QueenDifficultyWeight createSorterWeight(NQueens nQueens, Queen queen)...
Can we use a VRP example here?
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -245,8 +203,9 @@ For example, in bin packing: small item < medium item < big item. Although most algorithms start with the more difficult entities first, they just reverse the ordering. ==== -_None of the current planning variable states should be used to compare planning entity difficulty._ During Construction ...
```suggestion For example, a ``Lesson``'s `timeslot` variable should not be used. ```
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -258,29 +217,33 @@ For example, a ``Queen``'s `row` variable should not be used. A planning variable is a JavaBean property (so a getter and setter) on a planning entity. It points to a planning value, which changes during planning. -For example, a ``Queen``'s `row` property is a genuine planning variable. -Note...
The domain name `Lessons` is being used in other places.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -1810,114 +1728,38 @@ To use a custom cloner, configure it on the planning solution: [source,java,options="nowrap"] ---- -@PlanningSolution(solutionCloner = NQueensSolutionCloner.class) -public class NQueens { +@PlanningSolution(solutionCloner = TimetableSolutionCloner.class) +public class Timetable { ... ...
Let's add a partial code snippet for Timetable solution cloner.
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -41,17 +41,18 @@ Just provide the planning problem as argument to the `solve()` method and it wil [source,java,options="nowrap"] ---- - NQueens problem = ...; - NQueens bestSolution = solver.solve(problem); + Timetable problem = ...; + Timetable bestSolution = solver.solve(problem); ---- -For exam...
```suggestion For example, in school timetabling, ```
timefold-solver
github_2023
others
730
TimefoldAI
zepfred
@@ -41,17 +41,18 @@ Just provide the planning problem as argument to the `solve()` method and it wil [source,java,options="nowrap"] ---- - NQueens problem = ...; - NQueens bestSolution = solver.solve(problem); + Timetable problem = ...; + Timetable bestSolution = solver.solve(problem); ---- -For exam...
Let's delete the image solvedNQueens04.png
timefold-solver
github_2023
java
727
TimefoldAI
triceo
@@ -0,0 +1,5 @@ +package ai.timefold.solver.core.impl.domain.solution.cloner; + +public interface PlanningCloneable<T> { + T createEmptyInstance();
I'd like this interface to have wider use. It should not only serve for collections, it should serve for any type. To that end, the method should be called `createNewInstance()`, and the cloner should be adapted to handle it. As a test case, if it can clone a cloneable planning entity inside of a non-cloneable plan...
timefold-solver
github_2023
java
727
TimefoldAI
triceo
@@ -228,12 +232,16 @@ private <K, V> Map<K, V> cloneMap(Class<?> expectedType, Map<K, V> originalMap, return cloneMap; } + @SuppressWarnings("unchecked") private static <K, V> Map<K, V> constructCloneMap(Map<K, V> originalMap) { // Normally, a Map will never be selected for cloning, but...
Why shouldn't this go first? Why does `TreeMap` get precedence?
timefold-solver
github_2023
java
727
TimefoldAI
triceo
@@ -0,0 +1,5 @@ +package ai.timefold.solver.core.impl.domain.solution.cloner; + +public interface PlanningCloneable<T> {
The interface needs a good description of what it's for, what will happen when used, and how the method should be implemented.
timefold-solver
github_2023
others
723
TimefoldAI
zepfred
@@ -3,26 +3,12 @@ updates: - package-ecosystem: maven directory: "/" schedule: - interval: daily - time: '05:00' + interval: weekly
Should we keep the scheduling time?
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion This can significantly improve score calculation speed if the repeated operation is computationally expensive. ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion [IMPORTANT] ==== Debugging breakpoints put inside your constraints will not be respected, because the `ConstraintProvider` class will be transformed when this feature is enabled. ==== ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion When two building blocks are functionally equivalent, they can share the same node in the network. ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion To be functionally equivalent, the following must be true: ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion * The building blocks must have functionally equivalent parent building blocks. ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion * The building blocks must have functionally equivalent inputs. ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion For example, the building blocks below are functionally equivalent: ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion Whereas these building blocks are not functionally equivalent: ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion Counterintuitively, the building blocks produced by these (seemly) identical methods are not necessarily functionally equivalent: ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion The Java Virtual Machine is free to (and often does) create different instances of functionally equivalent lambdas. ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion Consider the following input class: ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion When automatic node sharing is enabled, the class will be transformed to look like this: ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion This transformation means that debugging breakpoints placed inside the original `ConstraintProvider` will not be honored in the transformed `ConstraintProvider`. ```
timefold-solver
github_2023
others
685
TimefoldAI
triceo
@@ -759,5 +760,191 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
```suggestion From the above, you can see how this feature allows building blocks to share functionally equivalent parents, without needing the `ConstraintProvider` to be written in an awkward way. ```
timefold-solver
github_2023
others
686
TimefoldAI
zepfred
@@ -4,6 +4,7 @@ ** xref:quickstart/hello-world/hello-world-quickstart.adoc[leveloffset=+1] ** xref:quickstart/quarkus/quarkus-quickstart.adoc[leveloffset=+1] ** xref:quickstart/spring-boot/spring-boot-quickstart.adoc[leveloffset=+1] +** xref:quickstart/quarkus-vehicle-routing/quarkus-vehicle-routing-quickstart.adoc[...
Is this expected?
timefold-solver
github_2023
others
686
TimefoldAI
zepfred
@@ -0,0 +1,213 @@ +[#upgradeToLatestVersion] += Upgrade to the latest version +:doctype: book +:sectnums: +:icons: font + +Timefold Solver public APIs are backwards compatible, +but users often also use impl classes, +many of which are documented in the reference manual too.
Do we have a link for that?
timefold-solver
github_2023
others
686
TimefoldAI
zepfred
@@ -0,0 +1,18 @@ +[#upgradeAndMigrationOverview] += Upgrade and Migration: Overview +:doctype: book +:sectnums: +:icons: font + +In this section, you will: + +- Learn how to upgrade from OptaPlanner to Timefold Solver. +- Learn how to upgrade to the latest version of Timefold Solver automatically. +- Find a detailed up...
The ```suggestion see the https://github.com/TimefoldAI/timefold-solver/releases[Timefold Solver release notes] ```
timefold-solver
github_2023
others
686
TimefoldAI
zepfred
@@ -0,0 +1,213 @@ +[#upgradeToLatestVersion] += Upgrade to the latest version +:doctype: book +:sectnums: +:icons: font + +Timefold Solver public APIs are backwards compatible, +but users often also use impl classes,
implementation classes?
timefold-solver
github_2023
others
686
TimefoldAI
zepfred
@@ -0,0 +1,213 @@ +[#upgradeToLatestVersion] += Upgrade to the latest version +:doctype: book +:sectnums: +:icons: font + +Timefold Solver public APIs are backwards compatible, +but users often also use impl classes, +many of which are documented in the reference manual too. +This upgrade recipe minimizes the pain to u...
There's something off about this Impl detail icon. What do you think? ![Screenshot from 2024-03-08 10-49-39](https://github.com/TimefoldAI/timefold-solver/assets/11961659/fcc82670-f167-444e-ad06-0395c308c238)
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -0,0 +1,12 @@ +package ai.timefold.solver.core.api.solver; + +/** + * The statistics of a given problem submitted to a {@link Solver}. + * + * @param entityCount The number of genuine entities defined by the problem. + * @param variableCount The number of genuine variables defined by the problem. + * @param maximumV...
I think this last line deserves a bit more description. What do you mean by `log`, a logarithm? A natural logarithm? What is a solution space? Maybe it'd be best if we just say what the formula is.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -95,6 +95,14 @@ public interface SolverJob<Solution_, ProblemId_> { */ long getScoreCalculationCount(); + /** + * Return the {@link ProblemStatistics} for the {@link PlanningSolution problem} submitted to the + * {@link SolverManager}.
I'm wondering if we should describe the volatility of this value. It may be something else at solver start, during solver run, and at the end. (`ProblemChange` again.)
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -36,7 +36,10 @@ public enum SolverMetric { PICKED_MOVE_TYPE_BEST_SCORE_DIFF("timefold.solver.move.type.best.score.diff", new PickedMoveBestScoreDiffStatistic<>(), true), PICKED_MOVE_TYPE_STEP_SCORE_DIFF("timefold.solver.move.type.step.score.diff", new PickedMoveStepScoreDiffStatistic<>(), - ...
Since these metrics are enabled by default, I'd put them amongst the others which are enabled by default, at the top. The enum is not inside public API, so I don't worry about ordinals staying constant.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -1039,6 +1039,7 @@ public long getMaximumValueCount(Solution_ solution) { /** * Calculates an indication on how big this problem instance is. * This is intentionally very loosely defined for now. + * This is explicitly NOT the solution space size.
I see that this PR makes no changes to any of the scale computations. So we are happy with what is currently there for list and chained? I recall there were some PLANNER JIRA references there; at the very least they should be removed, since we've been over that code and the new version is something we want to move forw...
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -234,18 +228,52 @@ public void solvingStarted(SolverScope<Solution_> solverScope) { solverScope.startingNow(); solverScope.getScoreDirector().resetCalculationCount(); super.solvingStarted(solverScope); - int startingSolverCount = solverScope.getStartingSolverCount() + 1; + va...
Shouldn't we unregister the metrics that are registered, instead of relying on a list that needs to be updated every time we add a new default metric? This is a bug in the making.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -224,6 +226,22 @@ public long getTimeMillisSpent() { return endingSystemTimeMillis - startingSystemTimeMillis; } + public ProblemStatistics getProblemStatistics() { + return problemStatistics; + } + + public void setProblemStatistics(ProblemStatistics problemStatistics) { + thi...
This might as well be on the `SolutionDescriptor` directly. It only uses stuff from there.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -302,16 +330,20 @@ public void solvingEnded(SolverScope<Solution_> solverScope) { } public void outerSolvingEnded(SolverScope<Solution_> solverScope) { - // Must be kept open for doProblemFactChange - solverScope.getScoreDirector().close(); logger.info("Solving ended: time spent ({...
I'm thinking that maybe we introduce a new logging line for problem statistics? It seems to me that the counts and sizes are a different kind of information than the env mode, move thread count etc. - one is problem-specific, one is solver configuration. Not entirely sure about it, but the current approach seems to...
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -0,0 +1,12 @@ +package ai.timefold.solver.core.api.solver; + +/** + * The statistics of a given problem submitted to a {@link Solver}. + * + * @param entityCount The number of genuine entities defined by the problem. + * @param variableCount The number of genuine variables defined by the problem. + * @param maximumV...
Since this is public API, maybe we need to think about this a bit more. Shouldn't it be `planningEntityCount`? `planningVariableCount`? Maybe it's `SolutionStatistics`? Perhaps we should start a quick poll on Slack.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -0,0 +1,12 @@ +package ai.timefold.solver.core.api.solver; + +/** + * The statistics of a given problem submitted to a {@link Solver}. + * + * @param entityCount The number of genuine entities defined by the problem. + * @param variableCount The number of genuine variables defined by the problem. + * @param maximumV...
We already have to iterate over every entity to get this number. So I'm wondering... why not replace this number with a total number of distinct values? Could be a perf problem for int value ranges, which could easily include millions of distinct values. But for multi-variate problems, it does seem fairer to get a s...
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -121,12 +119,10 @@ public SubSingleBenchmarkRunner<Solution_> call() { subSingleStatistic.hibernatePointList(); } if (!warmUp) { - SolverScope<Solution_> solverScope = solver.getSolverScope(); - SolutionDescriptor<Solution_> solutionDescriptor = solverScope.getSol...
Aren't we mixing terms here? One speaks of scale, the other speaks of size.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -419,45 +420,42 @@ private void determineWinningScoreDifference() { * HACK to avoid loading the problem just to extract its problemScale. * Called multiple times, for every {@link SingleBenchmarkResult} of this {@link ProblemBenchmarkResult}. * - * @param registeringEntityCount {@code >= 0} - ...
Arguably `problemSizeStatistics` now. Please look for all uses of `problemStatistics` (incl. in getter/setter names) and make it consistent - looking at the PR, there are several places where you kept the old name, and I won't list all of them.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -0,0 +1,50 @@ +package ai.timefold.solver.core.api.solver; + +import java.text.DecimalFormat; + +import ai.timefold.solver.core.impl.util.MathUtils; + +/** + * The statistics of a given problem submitted to a {@link Solver}. + * + * @param entityCount The number of genuine entities defined by the problem. + * @param...
I'd prefer going with a more human-readable `A × 10^B`, unless there is a specific reason why we can't do that.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -684,22 +687,57 @@ public long getMaximumValueCount(Solution_ solution, Object entity) { } - public long getProblemScale(Solution_ solution, Object entity) { - int genuineEntityCount = getSolutionDescriptor().getGenuineEntityCount(solution); - long problemScale = 1L; + public void proces...
Uncountable value ranges already fail fast elsewhere. Please confirm and if that's the case, please also fail fast here. People shouldn't be using them.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -1026,7 +1030,39 @@ public long getGenuineVariableCount(Solution_ solution) { return result.longValue(); } - public long getMaximumValueCount(Solution_ solution) { + /** + * @param solution never null + * @return {@code >= 0} + */ + public long getApproximateValueCount(Solution_ ...
IMO this is precisely the kind of code that benefits from `var` the most. We have `Set` in the var name, we have `Set` in the method call on the right, no need to repeat the entire type on the left. (Even if it means putting the generic type directly to the diamond of `IdentityHashMap`.)
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -1036,22 +1072,64 @@ public long getMaximumValueCount(Solution_ solution) { .orElse(0L); } + public record ProblemScaleTracker(long logBase,
This is abusing the record a bit, isn't it? Records are supposed to be immutable, and to get that, we introduce deeply mutable types. :-) Personally, I think this should just be a class, which in turn would allow us to get rid of the `MutableLong`.
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -1036,22 +1072,64 @@ public long getMaximumValueCount(Solution_ solution) { .orElse(0L); } + public record ProblemScaleTracker(long logBase, + MutableLong basicProblemScaleLog, + Set<Object> visitedAnchorSet, + MutableLong listPinnedValueCount, + ...
Solution space size... Maybe we use "search space size" instead? It's closer to the industry lingo. (Assuming that search space size is what you mean here.)
timefold-solver
github_2023
java
671
TimefoldAI
triceo
@@ -234,16 +226,34 @@ public void solvingStarted(SolverScope<Solution_> solverScope) { solverScope.startingNow(); solverScope.getScoreDirector().resetCalculationCount(); super.solvingStarted(solverScope); - int startingSolverCount = solverScope.getStartingSolverCount() + 1; + va...
I keep thinking... isn't it enough to print this just once, either at start or finish? It will end up in the log, which means it's just duplication if the same information is there twice.
timefold-solver
github_2023
others
624
TimefoldAI
triceo
@@ -443,6 +443,9 @@ <xs:element minOccurs="0" name="constraintStreamImplType" type="tns:constraintStreamImplType"/> + <xs:element minOccurs="0" name="constraintStreamShareLambdas" type="xs:boolean"/>
Not sure about the name. Maybe we should avoid implementation details? - `constraintStreamAutomaticNodeSharing` (true/false) - `constraintStreamNodeSharing` (auto/none)
timefold-solver
github_2023
java
624
TimefoldAI
triceo
@@ -90,7 +94,8 @@ <Solution_> DestinationSelector<Solution_> applyNearbySelection(DestinationSelec public enum Feature { MULTITHREADED_SOLVING("Multi-threaded solving", "remove moveThreadCount from solver configuration"), PARTITIONED_SEARCH("Partitioned search", "remove partitioned search phase f...
```suggestion LAMBDA_SHARING("Automatic node sharing", "remove automatic node sharing from solver configuration"); ```
timefold-solver
github_2023
others
624
TimefoldAI
triceo
@@ -716,5 +717,215 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
Think like a user who wants to use this feature. What do they want to know first? - What do I get out of it? - How do I enable it? Everything else is secondary. Start with a simple paragraph explaining what it's for (improves score speeds when many constraints). If you can give a ballpark estimate for the improv...
timefold-solver
github_2023
others
624
TimefoldAI
triceo
@@ -716,5 +717,215 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
As explained above, this needs to be up there. But because it can not mention this transformation, it needs to be restated. Something like "Debugging breakpoints put inside your constraints will not be respected, because the `ConstraintProvider` class will be transformed when this feature is enabled". Then when you'...
timefold-solver
github_2023
others
624
TimefoldAI
triceo
@@ -716,5 +717,215 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
This should not be necessary. This is boilerplate, we need Enterprise to be easy. Make `enterprise-core` depend on ASM by default.
timefold-solver
github_2023
others
624
TimefoldAI
triceo
@@ -716,5 +717,215 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
I'm thinking if we should enable this by default everywhere. Enterprise ought to be simple. Maybe not right now, but eventually, yes.
timefold-solver
github_2023
others
624
TimefoldAI
triceo
@@ -716,5 +717,215 @@ the host is likely to hang or freeze, unless there is an OS specific policy in place to avoid Timefold Solver from hogging all the CPU processors. ==== +[#automaticNodeSharing] +=== Automatic node sharing +[NOTE] +==== +This feature is a commercial feature of Timefold Solver Enterprise Editi...
If we're not enabling it by default everywhere, then I'd argue it shouldn't be the default anywhere.
timefold-solver
github_2023
others
670
TimefoldAI
zepfred
@@ -1,11 +1,14 @@ -# This workflow currently doesn't work as a PR can not check out a private repo due to no secrets being available. name: Downstream - Timefold Solver Enterprise Edition on: - push: - branches: [main] - pull_request: + # Enables the workflow to run on PRs from forks; + # token sharing is sa...
Have you checked if the action ran after submitting a PR in your fork? I suspect that the CI may not run if we open a PR due to the `branches` property: `branches: [main, '*.x']`. You can replicate it by making this modification to the main branch of your fork and submitting a pull request to your fork.
timefold-solver
github_2023
others
660
TimefoldAI
triceo
@@ -472,13 +480,28 @@ Increase the termination time to potentially find a better solution. == Run the application -First start the application: +First start the application in dev mode: +IMPORTANT: The solver runs considerably slower in dev mode since the https://www.baeldung.com/jvm-tiered-compilation#2c2---ser...
I question if we need this, and if this is important. - I'd convert it to `NOTE` and use [Admonition](https://docs.asciidoctor.org/asciidoc/latest/blocks/admonitions/) to mark it properly. - I'd move it to the end after the code examples; don't break user flow. They want to see it work, performance is a secondary c...
timefold-solver
github_2023
others
660
TimefoldAI
triceo
@@ -873,6 +896,50 @@ Use `debug` logging to show every _step_: Use `trace` logging to show every _step_ and every _move_ per step. +=== Create a native image + +[[native]] +IMPORTANT: The solver runs considerably slower in a native image due to a lack of https://www.baeldung.com/jvm-tiered-compilation#1-best-of-bo...
I suggest we remove this note altogether. Native has its trade-offs and benefits; it is not for us docs to explain what those are, right? Our docs should explain how to get it to work.
timefold-solver
github_2023
others
660
TimefoldAI
triceo
@@ -873,6 +896,50 @@ Use `debug` logging to show every _step_: Use `trace` logging to show every _step_ and every _move_ per step. +=== Create a native image + +[[native]] +IMPORTANT: The solver runs considerably slower in a native image due to a lack of https://www.baeldung.com/jvm-tiered-compilation#1-best-of-bo...
```suggestion To decrease startup times for serverless deployments, or to deploy to environments without a JVM, you can build the application as a native executable. As a prerequisite, https://quarkus.io/guides/building-native-image#configuring-graalvm[install GraalVM and gu install the native-image tool]. Then contin...
timefold-solver
github_2023
others
660
TimefoldAI
triceo
@@ -166,10 +169,16 @@ dependencies { test { useJUnitPlatform() } + +tasks.named("bootRun") { + optimizedLaunch = false +} ---- -- ==== +IMPORTANT: Optimized launch is disabled, since optimized launch disables the https://www.baeldung.com/jvm-tiered-compilation#2c2---server-complier[JVM C2 compiler], cons...
Use Admonition as described above. Arguably, the concerns on optimized launch only apply to dev usage, and therefore should be in this note, and not above as the general example of doing things.
timefold-solver
github_2023
others
660
TimefoldAI
triceo
@@ -779,6 +788,75 @@ Use `debug` logging to show every _step_: Use `trace` logging to show every _step_ and every _move_ per step. +=== Create a native image + +IMPORTANT: The solver runs considerably slower in a native image due to a lack of https://www.baeldung.com/jvm-tiered-compilation#1-best-of-both-worlds[pr...
```suggestion To achieve faster startup times or to deploy to an environment without a JVM, you can build a native image: ```
timefold-solver
github_2023
others
660
TimefoldAI
triceo
@@ -779,6 +788,75 @@ Use `debug` logging to show every _step_: Use `trace` logging to show every _step_ and every _move_ per step. +=== Create a native image + +IMPORTANT: The solver runs considerably slower in a native image due to a lack of https://www.baeldung.com/jvm-tiered-compilation#1-best-of-both-worlds[pr...
Remove please, rationale given above.
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -90,9 +91,10 @@ public class EntityDescriptor<Solution_> { private final SolutionDescriptor<Solution_> solutionDescriptor; private final Class<?> entityClass; private final Predicate<Object> isInitializedPredicate; - private final Predicate<Object> hasNoNullVariables; private final List<Member...
`hasNoUnassignedVariablesListVar`, since `nullable` deprecated?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -146,16 +147,49 @@ public int getOrdinal() { * Using entityDescriptor::isInitialized directly breaks node sharing * because it creates multiple instances of this {@link Predicate}. * - * @deprecated Prefer {@link #getHasNoNullVariables()}. + * @deprecated Prefer {@link #getHasNoNullVariable...
Style: pointless else, since the if throws
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -410,13 +444,13 @@ private void createEffectiveVariableDescriptorMaps() { } effectiveGenuineVariableDescriptorMap.putAll(declaredGenuineVariableDescriptorMap); effectiveShadowVariableDescriptorMap.putAll(declaredShadowVariableDescriptorMap); - effectiveVariableDescriptorMap = new Li...
Why is this a utility method?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,234 @@ +package ai.timefold.solver.core.impl.domain.variable; + +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +import ai.timefold.solver.core.api.score.director.ScoreDirector; +import ai.timefold.solver.core.impl.d...
Couldn't a custom move assign multiple variables at once?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -1072,8 +1069,11 @@ public SolutionInitializationStatistics computeInitializationStatistics(Solution var unassignedValueCount = new MutableInt(); var genuineEntityCount = new MutableInt(); var shadowEntityCount = new MutableInt(); - for (var listVariableDescriptor : listVariableDesc...
Might want to add a comment that we count the number of possibly unassigned, and then subtract the number of actually assigned (i.e. instead of counting of number of unassigned directly, we compute `valueListSize - (count(assignedValues) = sum(size of entityList))`
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -91,35 +76,36 @@ public Class<?> getElementType() { // ************************************************************************ @Override - public boolean isInitialized(Object entity) { - return true; - } - - public List<Object> getListVariable(Object entity) { - Object value = get...
Unsure about that method name; what is provided? Arbitrary data?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -94,7 +102,9 @@ public <Supply_ extends Supply> boolean cancel(Demand<Supply_> demand) { var supplyWithDemandCount = supplyMap.get(demand); if (supplyWithDemandCount == null) { return false; - } else if (supplyWithDemandCount.demandCount == 1L) { + } + demand.cance...
If an object is demanded twice, should the demand be cancelled twice?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,26 @@ +package ai.timefold.solver.core.impl.heuristic.move; + +import ai.timefold.solver.core.api.score.director.ScoreDirector; + +public abstract class AbstractEasyMove<Solution_> implements Move<Solution_> {
Consider adding Javadoc for this class, given it is referenced by `AbstractMove`
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -81,7 +71,7 @@ public boolean isMoveDoable(ScoreDirector<Solution_> scoreDirector) { } @Override - public CompositeMove<Solution_> doMove(ScoreDirector<Solution_> scoreDirector) { + public Move<Solution_> doMove(ScoreDirector<Solution_> scoreDirector) {
Changes to this class look good, but I do not like the class itself, because it is very easy to create invalid composite moves. In particular, For each move in the `moveList` MUST be independent. Consider the following two moves, for instance: ``` ListSwapMove(e1, v2, e2, v3) SublistSwap(e1, v1, v2) ``` This w...
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,138 @@ +package ai.timefold.solver.core.impl.heuristic.move; + +import java.util.ArrayList; +import java.util.List; + +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.doma...
We can add a check here to check for user errors. In particular, if `beforeListVariableChanged` is called for the same entity twice without an `triggerVariableListeners()` call in-between, that is almost certainly an error. (Additional checks could be added to make sure there a before call for each after call, but that...
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,138 @@ +package ai.timefold.solver.core.impl.heuristic.move; + +import java.util.ArrayList; +import java.util.List; + +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.doma...
Outdated comment (from when `ListVariableBeforeChangeAction` and `ListVariableAfterChangeAction` shared the same code).
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -59,7 +65,14 @@ public SelectionCacheType getCacheType() { public void phaseStarted(AbstractPhaseScope<Solution_> phaseScope) { super.phaseStarted(phaseScope); InnerScoreDirector<Solution_, ?> scoreDirector = phaseScope.getScoreDirector(); + reloadCachedEntityList(scoreDirector); + }...
Should `cachedEntityList` include null for an `EntitySelector`? I am not sure if `MoveSelectors` would like or expect getting a null entity from their selectors.
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,77 @@ +package ai.timefold.solver.core.impl.heuristic.selector.move.generic.list; + +import java.util.Objects; + +import ai.timefold.solver.core.api.score.director.ScoreDirector; +import ai.timefold.solver.core.impl.domain.variable.descriptor.ListVariableDescriptor; +import ai.timefold.solver.core.impl.heuri...
Does this move do nothing but call a variable listener?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,126 @@ +package ai.timefold.solver.core.impl.heuristic.selector.move.generic.list; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Objects; + +import ai.timefold.solver.core.api.domain.solution.PlanningSolution; +import ai.timefold.solver.core.a...
Is there any ordering requirements for list variable changed and list variable element assigned/unassigned?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,96 @@ +package ai.timefold.solver.core.impl.domain.valuerange.buildin.composite; + +import static ai.timefold.solver.core.impl.testdata.util.PlannerAssert.assertAllElementsOfIterator; +import static ai.timefold.solver.core.impl.testdata.util.PlannerAssert.assertElementsOfIterator; +import static org.assertj....
So null is returned first in the original iterator, but last when accessed via `get(int index)`?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -12,31 +13,16 @@ class NoChangeMoveTest { @Test void isMoveDoable() { - assertThat(new NoChangeMove<>().isMoveDoable(null)).isTrue(); - } - - @Test - void createUndoMove() { - assertThat(new NoChangeMove<>().createUndoMove(null)) - .isInstanceOf(NoChangeMove.class); ...
I am guessing we can support not implementing rebase for NoChangeMove by never making a NoChangeMove doable (whereas before a NoChangeMove was always doable).
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -34,8 +36,12 @@ void original() { var a = TestdataListEntity.createWithValues("A", v2, v1); var b = TestdataListEntity.createWithValues("B"); var c = TestdataListEntity.createWithValues("C", v3); + var solution = new TestdataListSolution(); + solution.setEntityList(List.of(a,...
Does the score director mock have side effects (that is, does `setWorkingSolution` do something)?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -121,18 +131,80 @@ void originalWithPinning() { // Not testing size; filtering selector doesn't and can't report correct size unless iterating over all values. assertAllCodesOfMoveSelectorWithoutSize(moveSelector, // Moving 3 from C[0] - "3 {C[0]->C[0]}", // noop + ...
Add a comment saying "First try all destinations for v3 (which is originally at C[0]), then v1 (originally at A[1]), then v4 (uninitialized), then v2 (originally at A[0]).
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -92,23 +105,76 @@ void originalWithPinning() { // - C [3] assertAllCodesOfMoveSelectorWithoutSize(moveSelector, - "3 {C[0]} <-> 3 {C[0]}", // undoable - "3 {C[0]} <-> 1 {A[1]}", - "1 {A[1]} <-> 3 {C[0]}", // redundant - "1 {A[1]} <-> 1 {...
Ditto (explain that the test is checking each swap move from the product of the two value selectors is tested).
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -0,0 +1,100 @@ +package ai.timefold.solver.core.impl.solver; + +import java.util.stream.IntStream; + +import ai.timefold.solver.core.api.solver.SolverFactory; +import ai.timefold.solver.core.config.constructionheuristic.ConstructionHeuristicPhaseConfig; +import ai.timefold.solver.core.config.heuristic.selector.move....
We are only asserting `solve` does not throw an exception?
timefold-solver
github_2023
java
573
TimefoldAI
Christopher-Chianelli
@@ -109,6 +114,39 @@ void resetGlobalRegistry() { meterRegistryList.forEach(Metrics.globalRegistry::remove); } + @Test + void constructionHeuristicWithAllowsUnassignedValuesListVariable() { + var solverConfig = PlannerTestUtils.buildSolverConfig(TestdataAllowsUnassignedValuesListSolution.cl...
Nitpick: length of the entity's value list