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 | 171 | TimefoldAI | rsynek | @@ -38,23 +41,60 @@ public static HardMediumSoftScore parseScore(String scoreString) {
}
public static HardMediumSoftScore ofUninitialized(int initScore, int hardScore, int mediumScore, int softScore) {
+ if (initScore == 0) {
+ return of(hardScore, mediumScore, softScore);
+ }
... | How often is this method called to express a single-level score that is either -1, 0, or 1? This `if-else-if` structure surely does not come for free.
Proposal: do this optimization only for single-level score factory methods, where the chance we hit the constant is much higher.
(applies to all Score types) |
timefold-solver | github_2023 | others | 158 | TimefoldAI | rsynek | @@ -88,31 +88,23 @@ jobs:
- name: Set micro snapshot version on the release branch
run: |
+ git checkout -B ${{ github.event.inputs.releaseBranch }}-bump | ```suggestion
git checkout -B ${{ github.event.inputs.releaseBranch }}-bump-to-next-micro-version
``` |
timefold-solver | github_2023 | others | 158 | TimefoldAI | rsynek | @@ -88,31 +88,23 @@ jobs:
- name: Set micro snapshot version on the release branch
run: |
+ git checkout -B ${{ github.event.inputs.releaseBranch }}-bump
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT
- find . -name 'pom.xml' | xa... | ```suggestion
git checkout -B ${{ github.event.inputs.releaseBranch }}-bump-to-next-minor-version
``` |
timefold-solver | github_2023 | others | 158 | TimefoldAI | rsynek | @@ -88,31 +88,23 @@ jobs:
- name: Set micro snapshot version on the release branch
run: |
+ git checkout -B ${{ github.event.inputs.releaseBranch }}-bump
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT
- find . -name 'pom.xml' | xa... | ```suggestion
git push origin ${{ github.event.inputs.releaseBranch }}-bump-to-next-micro-version
``` |
timefold-solver | github_2023 | others | 158 | TimefoldAI | rsynek | @@ -88,31 +88,23 @@ jobs:
- name: Set micro snapshot version on the release branch
run: |
+ git checkout -B ${{ github.event.inputs.releaseBranch }}-bump
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT
- find . -name 'pom.xml' | xa... | ```suggestion
gh pr create --reviewer triceo,ge0ffrey --base ${{ github.event.inputs.releaseBranch }} --head ${{ github.event.inputs.releaseBranch }}-bump-to-next-micro-version --title "chore: move to ${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT" --body-file .github/workflows/release-pr-body-stable.m... |
timefold-solver | github_2023 | others | 158 | TimefoldAI | rsynek | @@ -88,31 +88,23 @@ jobs:
- name: Set micro snapshot version on the release branch
run: |
+ git checkout -B ${{ github.event.inputs.releaseBranch }}-bump
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT
- find . -name 'pom.xml' | xa... | ```suggestion
git push origin ${{ github.event.inputs.releaseBranch }}-bump-to-next-minor-version
``` |
timefold-solver | github_2023 | others | 158 | TimefoldAI | rsynek | @@ -88,31 +88,23 @@ jobs:
- name: Set micro snapshot version on the release branch
run: |
+ git checkout -B ${{ github.event.inputs.releaseBranch }}-bump
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT
- find . -name 'pom.xml' | xa... | ```suggestion
gh pr create --reviewer triceo,ge0ffrey --base ${{ github.event.inputs.sourceBranch }} --head ${{ github.event.inputs.releaseBranch }}-bump-to-next-minor-version --title "chore: move to ${{ github.event.inputs.nextVersion }}-SNAPSHOT" --body-file .github/workflows/release-pr-body.md
``` |
timefold-solver | github_2023 | others | 156 | TimefoldAI | rsynek | @@ -112,63 +113,77 @@ As you can see in the examples, most instances have a lot more possible solution
Timefold supports several optimization algorithms to efficiently wade through that incredibly large number of possible solutions.
Depending on the use case, some optimization algorithms perform better than others, b... | Should we clearly say that every feature apart from scalability features is included? |
timefold-solver | github_2023 | others | 146 | TimefoldAI | triceo | @@ -16,7 +16,7 @@ with https://timefold.ai[Timefold]'s constraint solving Artificial Intelligence
You will build a REST application that optimizes a school timetable for students and teachers:
-image::quickstart/school-timetabling/schoolTimetablingScreenshot.png[]
+image::quickstart/school-timetabling/schoolTimeta... | Why do we keep and reference an *old* version of the app? |
timefold-solver | github_2023 | others | 138 | TimefoldAI | rsynek | @@ -46,32 +46,30 @@ jobs:
distribution: 'temurin'
cache: 'maven'
+ # Need Maven 3.9.0+ to recognize MAVEN_ARGS.
+ - name: Set up Maven
+ uses: stCarolas/setup-maven@v4.5
+ with:
+ maven-version: 3.9.3
+
# We skip tests in dry run, to make the process faste... | There is a dedicated GHA? Interesting. |
timefold-solver | github_2023 | others | 138 | TimefoldAI | rsynek | @@ -242,7 +242,7 @@ public class CloudBalance ... {
[[cloudBalancingMainMethod]]
== Run the cloud balancing Hello World
-. xref:introduction/introduction.adoc#runTheExamplesInAnIDE[Download and configure the examples in your preferred IDE.]
+. xref:introduction/introduction.adoc#buildFromSource[Download and configu... | Nice catch. |
timefold-solver | github_2023 | others | 115 | TimefoldAI | rsynek | @@ -1,16 +1,27 @@
-# TODO release XSD to timefold.ai/xsd/
-# TODO reset timefold-quickstarts stable branch
-# TODO adjust website pom.yml release date and version
-# TODO tag github issues with version
name: Release
on:
workflow_dispatch:
inputs:
version:
- description: 'Release version'
+ ... | Let's move these two before the "Next version..." parameters to define these branches before referring to them. |
timefold-solver | github_2023 | others | 115 | TimefoldAI | rsynek | @@ -19,79 +30,94 @@ jobs:
- name: Checkout timefold-solver
uses: actions/checkout@v3
with:
- path: 'timefold-solver'
- repository: 'TimefoldAI/timefold-solver'
fetch-depth: 0
- - name: Checkout timefold-quickstarts
- uses: actions/checkout@v3
- ... | Something for consideration: define some MAVEN_OPTIONS (?) env var to keep the `-no-transfer-progress --batch-mode` in a single place. |
timefold-solver | github_2023 | others | 115 | TimefoldAI | rsynek | @@ -19,79 +30,94 @@ jobs:
- name: Checkout timefold-solver
uses: actions/checkout@v3
with:
- path: 'timefold-solver'
- repository: 'TimefoldAI/timefold-solver'
fetch-depth: 0
- - name: Checkout timefold-quickstarts
- uses: actions/checkout@v3
- ... | In the last stage of the release, this branch should be deleted. Apart from just having a stale branch in the git repository, if you want to do a micro release from already existing release branch, there will likely be a conflict with the existing release-bump branch. |
timefold-solver | github_2023 | others | 120 | TimefoldAI | triceo | @@ -18,8 +18,7 @@ A _realistic contest_ is _an official, independent contest_:
Realistic contests provide an objective comparison of Timefold with competitive software and academic research.
-The source code of all these examples is available in the distribution zip under [path]_examples/sources_
-and also in git ... | Maybe link to Github instead? |
timefold-solver | github_2023 | others | 108 | TimefoldAI | rsynek | @@ -25,63 +25,73 @@
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
- <listChangeMoveSelector>
- <valueSelector id="1"/>
- <destinationSelector>
- <nearbySelection>
- <originValueSelector mimicSelectorRef="1"/>
- <nearbyDistanceMeterClass>ai.timefo... | I see a lot of combinations got commented out as expected. However, this impacts:
a) performance tests in timefold-examples (if they run these configurations)
b) turtle tests (assuming there are some turtle tests) |
timefold-solver | github_2023 | java | 102 | TimefoldAI | rsynek | @@ -461,4 +468,27 @@ Constraint talkUndesiredRoomTags(ConstraintFactory factory) {
.asConstraint(TALK_UNDESIRED_ROOM_TAGS);
}
+ Constraint speakerMakespan(ConstraintFactory factory) {
+ return factory.forEach(Speaker.class)
+ .join(Talk.class,
+ fi... | The next line should cover this case too. Is the extra `if` worth it? |
timefold-solver | github_2023 | java | 99 | TimefoldAI | rsynek | @@ -718,19 +718,130 @@ private static <Result> Runnable innerSum(MutableReference<Result> resultContain
*/
public static <A, Mapped extends Comparable<? super Mapped>> UniConstraintCollector<A, ?, Mapped> min(
Function<A, Mapped> groupValueMapping) {
- return min(groupValueMapping, Compar... | ```suggestion
* {@code .groupBy(min(Person::name, Person::age))} returns {@code Ann} or {@code Eric},
``` |
timefold-solver | github_2023 | java | 90 | TimefoldAI | rsynek | @@ -35,11 +37,34 @@ public int countMutations(Solution_ a, Solution_ b) {
Object bEntity = bIt.next();
for (GenuineVariableDescriptor<Solution_> variableDescriptor : entityDescriptor
.getGenuineVariableDescriptorList()) {
- // TODO broken if ... | Maybe slightly more readable:
```
int shorterListSize = Math.min(aSize, bSize);
for (int i = 0; i < shorterListSize; i++) {
``` |
timefold-solver | github_2023 | others | 69 | TimefoldAI | rsynek | @@ -0,0 +1,17 @@
+# https://github.com/Ezard/semantic-prs
+enabled: true
+titleAndCommits: true
+allowMergeCommits: false
+types:
+ - feat
+ - fix
+ - docs
+ - style
+ - refactor
+ - perf
+ - test
+ - build
+ - ci
+ - chore | What's the difference between style, refactor and chore? And what about build vs. ci? The fewer keywords we use, the bigger chance we use them right. |
timefold-solver | github_2023 | others | 69 | TimefoldAI | rsynek | @@ -0,0 +1,74 @@
+== Contributing to Timefold Solver
+
+This is an open source project, and you are more than welcome to contribute!
+
+* Found an issue? https://github.com/TimefoldAI/timefold-solver/issues[Submit an issue.]
+* Want to fix an issue or contribute an improvement? https://github.com/TimefoldAI/timefold-so... | ```suggestion
. https://github.com/TimefoldAI/timefold-solver/fork[Fork it.]
``` |
timefold-solver | github_2023 | others | 69 | TimefoldAI | rsynek | @@ -0,0 +1,74 @@
+== Contributing to Timefold Solver
+
+This is an open source project, and you are more than welcome to contribute!
+
+* Found an issue? https://github.com/TimefoldAI/timefold-solver/issues[Submit an issue.]
+* Want to fix an issue or contribute an improvement? https://github.com/TimefoldAI/timefold-so... | ```suggestion
. https://github.com/TimefoldAI/timefold-solver/compare[Create a new Pull Request.]
``` |
timefold-solver | github_2023 | java | 68 | TimefoldAI | rsynek | @@ -103,6 +123,29 @@ public void update(InTuple_ tuple) {
}
}
+ private List<FlattenedItem_> iterableToList(Iterable<FlattenedItem_> iterable) {
+ if (iterable instanceof Collection<FlattenedItem_> collection) {
+ // Optimization for Collection, where we know the size.
+ ... | In this case, it is safe to cast the `iterable` to a `Collection` and pass it here directly. It could bring an additional minor perf improvement, if we skip the `forEach` and the method reference (no proof). |
timefold-solver | github_2023 | java | 28 | TimefoldAI | ge0ffrey | @@ -131,8 +130,7 @@ public BenchmarkAggregatorFrame(BenchmarkAggregator benchmarkAggregator) {
this.benchmarkAggregator = benchmarkAggregator;
benchmarkResultIO = new BenchmarkResultIO();
plannerBenchmarkResultList = Collections.emptyList();
- Locale locale = benchmarkAggregator.getBen... | A) Either the benchmark report has a locale.
B) Or the locale is the eye of the beholder. Basically, the browser's locale determines if it's 1'000,05 (BE) or 1,000.05 (US).
If B) is possible, I prefer that. A big advantage over the JfreeChart approach is that the locale isn't hard coded in the report output.
An... |
timefold-solver | github_2023 | others | 28 | TimefoldAI | ge0ffrey | @@ -56,6 +56,10 @@
<version.surefire.plugin>3.0.0-M8</version.surefire.plugin>
<version.versions.plugin>2.15.0</version.versions.plugin>
+ <version.org.webjars.webjars-locator>0.46</version.org.webjars.webjars-locator>
+ <version.org.webjars.bootstrap>5.2.3</version.org.webjars.bootstrap>
+ <versio... | Should be at line 35 in this file, with the other dependency version, not with the plugin versions. |
timefold-solver | github_2023 | others | 28 | TimefoldAI | ge0ffrey | @@ -148,6 +152,24 @@
<artifactId>jcl-over-slf4j</artifactId>
<version>${version.org.slf4j}</version>
</dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>webjars-locator</artifactId>
+ <version>${version.org.webjars.webjars-locator}</version>
+ ... | comment should be above these artifacts? |
timefold-solver | github_2023 | java | 1,493 | TimefoldAI | zepfred | @@ -27,14 +27,17 @@
import ai.timefold.solver.core.config.localsearch.decider.acceptor.LocalSearchAcceptorConfig;
import ai.timefold.solver.core.config.localsearch.decider.forager.LocalSearchForagerConfig;
import ai.timefold.solver.core.config.phase.PhaseConfig;
+import ai.timefold.solver.core.config.solver.PreviewF... | Should it be named `moveProviderClass`? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -155,12 +157,12 @@ protected void pickMove(ConstructionHeuristicStepScope<Solution_> stepScope) {
protected <Score_ extends Score<Score_>> void doMove(ConstructionHeuristicMoveScope<Solution_> moveScope) {
InnerScoreDirector<Solution_, Score_> scoreDirector = moveScope.getScoreDirector();
- sc... | This variable seems off to me. I think it should be within the scope of `scoreDirector.assertExpectedUndoMoveScore`. |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -24,17 +25,17 @@ public class DefaultConstructionHeuristicPhase<Solution_>
implements ConstructionHeuristicPhase<Solution_> {
protected final ConstructionHeuristicDecider<Solution_> decider;
- protected final EntityPlacer<Solution_> entityPlacer;
+ protected final PlacerBasedMoveRepository<Solu... | Should we retrieve it from the builder? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -131,29 +126,32 @@ public void expandNode(ExhaustiveSearchStepScope<Solution_> stepScope) {
@SuppressWarnings("unchecked")
private <Score_ extends Score<Score_>> void doMove(ExhaustiveSearchStepScope<Solution_> stepScope,
ExhaustiveSearchNode moveNode) {
- InnerScoreDirector<Solution_, ... | Let's make the name consistent. We have used `executeTemporaryMove` in the CH decider. |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -131,29 +126,32 @@ public void expandNode(ExhaustiveSearchStepScope<Solution_> stepScope) {
@SuppressWarnings("unchecked")
private <Score_ extends Score<Score_>> void doMove(ExhaustiveSearchStepScope<Solution_> stepScope,
ExhaustiveSearchNode moveNode) {
- InnerScoreDirector<Solution_, ... | Same as before. The scope seems incorrect to me. |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -113,21 +111,20 @@ public void decideNextStep(LocalSearchStepScope<Solution_> stepScope) {
@SuppressWarnings("unchecked")
protected <Score_ extends Score<Score_>> void doMove(LocalSearchMoveScope<Solution_> moveScope) {
- InnerScoreDirector<Solution_, Score_> scoreDirector = moveScope.getScoreDire... | Same as before |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -113,21 +111,20 @@ public void decideNextStep(LocalSearchStepScope<Solution_> stepScope) {
@SuppressWarnings("unchecked")
protected <Score_ extends Score<Score_>> void doMove(LocalSearchMoveScope<Solution_> moveScope) {
- InnerScoreDirector<Solution_, Score_> scoreDirector = moveScope.getScoreDire... | Did you notice any improvements in performance after removing this lambda? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -57,12 +58,12 @@ phaseTermination, buildDecider(phaseConfigPolicy, phaseTermination))
private LocalSearchDecider<Solution_> buildDecider(HeuristicConfigPolicy<Solution_> configPolicy,
PhaseTermination<Solution_> termination) {
- var moveSelector = buildMoveSelector(configPolicy);
+ ... | Let's use `String::format` |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -2,64 +2,82 @@
import java.util.List;
import java.util.Objects;
+import java.util.function.BiFunction;
+import ai.timefold.solver.core.api.score.Score;
import ai.timefold.solver.core.impl.domain.solution.descriptor.DefaultPlanningListVariableMetaModel;
import ai.timefold.solver.core.impl.domain.solution.desc... | ```suggestion
if (EphemeralMoveDirector.class.isAssignableFrom(getClass())) {
``` |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -0,0 +1,116 @@
+package ai.timefold.solver.core.impl.move.generic;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import ai.timefold.solver.core.api.domain.solution.PlanningSolution;
+import a... | Should we use `LinkedIdentityHashSet`? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -0,0 +1,116 @@
+package ai.timefold.solver.core.impl.move.generic;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import ai.timefold.solver.core.api.domain.solution.PlanningSolution;
+import a... | Same as before |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -0,0 +1,12 @@
+package ai.timefold.solver.core.impl.move.streams;
+
+import java.util.Iterator;
+import java.util.Random;
+
+import ai.timefold.solver.core.preview.api.move.Move;
+
+public interface MoveIterable<Solution_> extends Iterable<Move<Solution_>> { | I'm not sure what the advantage is of creating this abstraction |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -0,0 +1,34 @@
+package ai.timefold.solver.core.impl.move;
+
+import ai.timefold.solver.core.impl.phase.event.PhaseLifecycleListener;
+import ai.timefold.solver.core.preview.api.move.Move;
+
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * This is a shared abstraction for all three types of move iterators curr... | If we plan to use only this repository in the future, we need to consider that both CH and the Exact methods require a finite repository. |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -190,6 +182,7 @@ protected <Score_ extends Score<Score_>> void predictWorkingStepScore(AbstractSt
@Override
public void stepEnded(AbstractStepScope<Solution_> stepScope) {
if (!isNested()) {
+ var solver = stepScope.getPhaseScope().getSolverScope().getSolver(); | To ensure that these solver changes do not cause score corruption, we need to avoid sharing the score director in nested phases, while the solver itself can be shared. Given that the previous statement is correct, the changes will not cause any issues. Does that make sense? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -229,25 +226,42 @@ public void setWorkingSolution(Solution_ workingSolution) {
* possibly many thousands of objects.
* Providing the init score and genuine entity count requires another pass over the entities.
* The following code does all of those operations in a single pass.
+ ... | I wonder if `moveRepository.initialize` will be called twice. |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -260,25 +274,30 @@ private void assertInitScoreZeroOrLess() {
}
@Override
- public Score_ doAndProcessMove(Move<Solution_> move, boolean assertMoveScoreFromScratch, Consumer<Score_> moveProcessor) {
- if (trackingWorkingSolution) {
+ public void executeMove(Move<Solution_> move) { | Is it safe to skip the assertions here? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -90,6 +92,19 @@ static <Score_ extends Score<Score_>> ConstraintAnalysis<Score_> getConstraintAn
*/
void setWorkingSolution(Solution_ workingSolution);
+ /** | This comment answers one of my questions |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -26,34 +23,10 @@ public interface InnerScoreDirectorFactory<Solution_, Score_ extends Score<Score
*/
ScoreDefinition<Score_> getScoreDefinition();
- @Override
- default InnerScoreDirector<Solution_, Score_> buildScoreDirector(boolean lookUpEnabled,
- ConstraintMatchPolicy constraintMatc... | Should this method be part of `ScoreDirectorFactory`? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -12,20 +10,4 @@
*/
public interface ScoreDirectorFactory<Solution_> { | Does it make sense to maintain this interface? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -80,21 +77,21 @@ void oldAndNewTrailing() {
var inverseVariableSupply = SelectorTestUtils.mockSingletonInverseVariableSupply(
new TestdataChainedEntity[] { a1, a2, a3, a4, a5, b1, b2, b3 });
- try (var ephemeralMoveDirector = new MoveDirector<>(innerScoreDirector).ephemeral()) {
- ... | I observed in several places that we are not invoking `executeTemporaryMove` when replacing the ephemeral director. Can this be a problem? |
timefold-solver | github_2023 | java | 1,476 | TimefoldAI | zepfred | @@ -133,48 +148,47 @@ void doMoveInSameChain() {
SelectorTestUtils.assertChain(a0, a1, a2, a3, a4, a5, a6, a7);
var moveDirector = new MoveDirector<>(innerScoreDirector);
- try (var ephemeralMoveDirector = moveDirector.ephemeral()) {
- var scoreDirector = ephemeralMoveDirector.getS... | This one you're calling the temporary action |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -57,6 +60,7 @@ public static <Solution_> VariableListenerSupport<Solution_> create(InnerScoreDi
.toList();
this.listVariableDescriptor = scoreDirector.getSolutionDescriptor().getListVariableDescriptor();
this.listVariableEventList = new ArrayList<>();
+ this.unassignedValueW... | Arguably this should be an identity hash set; no entities should be considered equal here. (The class doesn't exist in the JDK, but it can be created by converting `IdentityHashMap`.) |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -0,0 +1,126 @@
+package ai.timefold.solver.core.impl.util;
+
+import java.util.Collection;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Set;
+
+public class IdentityHashSet<V> implements Set<V> { | Take a look at the Javadoc of `AbstractSet` - it explains how to write a minimal set implementation. All the other methods should only be implemented if you can make them faster in your implementation, and arguably in this case, we don't really need it. Less is more. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -0,0 +1,126 @@
+package ai.timefold.solver.core.impl.util;
+
+import java.util.Collection;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Set;
+
+public class IdentityHashSet<V> implements Set<V> {
+
+ private ElementAwareList<V> delegate;
+ private ... | Let's make them final. Clearing is cheap, final is fast. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -0,0 +1,126 @@
+package ai.timefold.solver.core.impl.util;
+
+import java.util.Collection;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.Set;
+
+public class IdentityHashSet<V> implements Set<V> {
+
+ private ElementAwareList<V> delegate;
+ private ... | Should be called `LinkedIdentityHashSet`. Also, it should be final. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -57,6 +60,7 @@ public static <Solution_> VariableListenerSupport<Solution_> create(InnerScoreDi
.toList();
this.listVariableDescriptor = scoreDirector.getSolutionDescriptor().getListVariableDescriptor();
this.listVariableEventList = new ArrayList<>();
+ this.unassignedValueW... | We should add a comment here, explaining why we chose this particular type.
(It's not obvious.) |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -240,61 +261,83 @@ public void beforeListVariableChanged(ListVariableDescriptor<Solution_> variable
public void afterListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex,
int toIndex) {
var notifiables = notifiableRegistry.get(variableDescr... | Both of these separate iterations have been merged together to just one iteration.
If you can iterate once, iterate once; useful for CPU caches. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -240,61 +261,83 @@ public void beforeListVariableChanged(ListVariableDescriptor<Solution_> variable
public void afterListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex,
int toIndex) {
var notifiables = notifiableRegistry.get(variableDescr... | I only split this into a separate method so that I can see its impact in the profiler individually. This is not actually a perf optimization, just helps with profiling. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -0,0 +1,77 @@
+package ai.timefold.solver.core.impl.util;
+
+import java.util.AbstractSet;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * This set does not support null keys.
+ *
+ * @param <V>
+ */
+@NullMarked
+public final class LinkedIden... | These zero checks are speculative; but if you take a look at what the map does even when it's empty, I bet this will prove itself if the methods are called often enough. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -0,0 +1,77 @@
+package ai.timefold.solver.core.impl.util;
+
+import java.util.AbstractSet;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * This set does not support null keys.
+ *
+ * @param <V>
+ */
+@NullMarked
+public final class LinkedIden... | contains+remove is worse than just remove, if you don't need to support null keys. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -0,0 +1,77 @@
+package ai.timefold.solver.core.impl.util;
+
+import java.util.AbstractSet;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * This set does not support null keys.
+ *
+ * @param <V>
+ */
+@NullMarked
+public final class LinkedIden... | computeIfAbsent does the same thing, but it also forces the JVM to create a lambda instance. This does not. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -155,9 +155,18 @@ public void forEach(Consumer<? super T> tupleConsumer) {
*/
@Override
public Iterator<T> iterator() {
+ if (size == 0) {
+ return Collections.emptyIterator(); | Reduces allocations in some pathological cases. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -25,38 +28,51 @@
import ai.timefold.solver.core.impl.domain.variable.supply.Supply;
import ai.timefold.solver.core.impl.domain.variable.supply.SupplyManager;
import ai.timefold.solver.core.impl.score.director.InnerScoreDirector;
+import ai.timefold.solver.core.impl.util.LinkedIdentityHashSet;
+
+import org.jspeci... | Don't create what doesn't need creating. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -215,14 +233,17 @@ public void beforeVariableChanged(VariableDescriptor<Solution_> variableDescript
}
public void afterElementUnassigned(ListVariableDescriptor<Solution_> variableDescriptor, Object element) {
- Collection<ListVariableListenerNotifiable<Solution_>> notifiables = notifiableRegistry.... | Don't use what doesn't need using. |
timefold-solver | github_2023 | java | 1,480 | TimefoldAI | triceo | @@ -240,61 +261,83 @@ public void beforeListVariableChanged(ListVariableDescriptor<Solution_> variable
public void afterListVariableChanged(ListVariableDescriptor<Solution_> variableDescriptor, Object entity, int fromIndex,
int toIndex) {
var notifiables = notifiableRegistry.get(variableDescr... | No need to create the event if we already have the notification.
Help the GC do less work, help yourself. |
timefold-solver | github_2023 | java | 1,479 | TimefoldAI | triceo | @@ -15,7 +17,14 @@ FeatureBuildItem feature() {
}
@BuildStep
- void registerTimefoldJacksonModule(BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
+ ClassPathJacksonModuleBuildItem registerTimefoldJacksonModule() {
+ // Make timefold-solver-jackson discoverable by quarkus-rest
+ ... | I'm good with removing this. |
timefold-quickstarts | github_2023 | python | 703 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,87 @@
+from timefold.solver.score import *
+from datetime import time
+from typing import Final | Unused import
```suggestion
``` |
timefold-quickstarts | github_2023 | python | 703 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,255 @@
+import json
+from itertools import count
+from random import Random
+from datetime import datetime, time, timedelta
+from typing import List, Callable, TypeVar
+
+from .domain import *
+
+random = Random(0)
+T = TypeVar('T')
+L = TypeVar('L')
+
+# Constants for employee skills
+ATTENDANT_SKILL = "Fli... | I personally find this hard to read/reason about. I recommend using a for loop instead:
```suggestion
for start_date in dates:
apply_random_value(count_dates, flights, lambda f: f.departure_utc_date_time is None, lambda f: flight_consumer(f, start_date))
``` |
timefold-quickstarts | github_2023 | python | 703 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,255 @@
+import json
+from itertools import count
+from random import Random
+from datetime import datetime, time, timedelta
+from typing import List, Callable, TypeVar
+
+from .domain import *
+
+random = Random(0)
+T = TypeVar('T')
+L = TypeVar('L')
+
+# Constants for employee skills
+ATTENDANT_SKILL = "Fli... | The walrus `x := y` operator can be confusing and not usually encountered. I recommend importing [itertools.count](https://docs.python.org/3/library/itertools.html#itertools.count) and using it as an id generator
```suggestion
ids = map(str, itertools.count())
for airport in flight_airports:
for _ ... |
timefold-quickstarts | github_2023 | python | 703 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,255 @@
+import json
+from itertools import count
+from random import Random
+from datetime import datetime, time, timedelta
+from typing import List, Callable, TypeVar
+
+from .domain import *
+
+random = Random(0)
+T = TypeVar('T')
+L = TypeVar('L')
+
+# Constants for employee skills
+ATTENDANT_SKILL = "Fli... | Can be removed if my suggestion above is applied.
```suggestion
``` |
timefold-quickstarts | github_2023 | python | 703 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,177 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider... | Not needed; if `__gt__` is not defined, `__lt__` will be used.
```suggestion
``` |
timefold-quickstarts | github_2023 | python | 703 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,177 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider... | Tuple comparison logic can simplify this:
```suggestion
def _comparison_key(self):
return (departure_utc_date_time, departure_airport, arrival_utc_date_time, arrival_airport, flight_number)
def __lt__(self, other: "Flight") -> bool:
return self._comparison_key() < other._comparison_... |
timefold-quickstarts | github_2023 | python | 694 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,61 @@
+from timefold.solver.score import *
+from datetime import time
+from typing import Final
+
+from .domain import *
+from .score_analysis import LoadBalanceJustification
+
+
+@constraint_provider
+def define_constraints(constraint_factory: ConstraintFactory):
+ return [
+ one_assignment_per_da... | Extra line
```suggestion
``` |
timefold-quickstarts | github_2023 | python | 694 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,97 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider,... | I would make this default to `False` (in Java, all `boolean` values are initialized to `false` even if they don't appear in a constructor and don't have a field initializer.
```suggestion
pinned: Annotated[bool, PlanningPin, Field(default=False)]
``` |
timefold-quickstarts | github_2023 | python | 694 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,68 @@
+from timefold.solver.test import ConstraintVerifier
+from tournament_scheduling.domain import *
+from tournament_scheduling.constraints import *
+
+constraint_verifier = ConstraintVerifier.build(define_constraints, TournamentSchedule, TeamAssignment)
+# Sample teams and days (equivalent to static vari... | If you make `pinned` default to `False`, you won't need to specify it on all these objects (applies to the whole file). |
timefold-quickstarts | github_2023 | python | 694 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,68 @@
+from timefold.solver.test import ConstraintVerifier
+from tournament_scheduling.domain import *
+from tournament_scheduling.constraints import *
+
+constraint_verifier = ConstraintVerifier.build(define_constraints, TournamentSchedule, TeamAssignment)
+# Sample teams and days (equivalent to static vari... | I don't think the latter part of the comment is helpful. It would only confuse a Python developer looking at it.
I would remove this comment, since it is obvious this is sample data (and there no such comment in Java).
```suggestion
``` |
timefold-quickstarts | github_2023 | others | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,159 @@
+<!DOCTYPE>
+<html lang="en">
+<head>
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
+ <meta content="width=device-width, initial-scale=1" name="viewport">
+ <title>Sports League Scheduling - Timefold Solver on Python</title> | ```suggestion
<title>Sports League Scheduling - Timefold Solver for Python</title>
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,155 @@
+from timefold.solver.score import *
+from datetime import time
+from typing import Final
+
+from .domain import *
+
+
+MAX_CONSECUTIVE_MATCHES: Final[int] = 4
+
+
+@constraint_provider
+def define_constraints(constraint_factory: ConstraintFactory):
+ return [
+ matches_on_same_day(constrain... | The `if isinstance(match.home_team, Team) and isinstance(match.away_team, Team) else 0` should be unnecessary; all matches home and away teams should be set.
It might be best to add a method to Team `get_distance(self, team: Team)` to perform the lookup logic. |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,155 @@
+from timefold.solver.score import *
+from datetime import time
+from typing import Final
+
+from .domain import *
+
+
+MAX_CONSECUTIVE_MATCHES: Final[int] = 4
+
+
+@constraint_provider
+def define_constraints(constraint_factory: ConstraintFactory):
+ return [
+ matches_on_same_day(constrain... | I would inline `is_invalid_classic_match` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,126 @@
+import json
+import random | To prevent accidentally using a shared random, only import the `Random` class from the package.
```suggestion
from random import Random
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,126 @@
+import json
+import random
+from datetime import datetime, time, timedelta
+from typing import List, Callable
+
+from .domain import *
+
+ | You should create a seeded random so the generated demo data is consistent.
```suggestion
random = Random(0)
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,126 @@
+import json
+import random
+from datetime import datetime, time, timedelta
+from typing import List, Callable
+
+from .domain import *
+
+
+DISTANCE_IN_KM = [
+ [0, 2163, 2163, 2160, 2156, 2156, 2163, 340, 1342, 512, 3038, 1526, 2054, 2054],
+ [2163, 0, 11, 50, 813, 813, 11, 1967, 842, 1661, 11... | I would rename this to just `generate_demo_data`
```suggestion
def generate_demo_data() -> LeagueSchedule:
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,113 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider... | The home and away teams should always be set. Also remove the `Field(default=None)`.
```suggestion
home_team: Annotated[Team,
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,113 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider... | ```suggestion
away_team: Annotated[Team,
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,113 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider... | I would add a `get_distance(self, team: Team)` method here. |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,113 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider... | Slightly unaligned.
```suggestion
PlanningEntityCollectionProperty]
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,113 @@
+from timefold.solver import SolverStatus
+from timefold.solver.domain import (planning_entity, planning_solution, PlanningId, PlanningVariable,
+ PlanningEntityCollectionProperty,
+ ProblemFactCollectionProperty, ValueRangeProvider... | I would annotate this attribute with `Field(default=False)` so you wouldn't need to specify it every time in the test.
```suggestion
weekend_or_holiday: Annotated[bool, Field(default=False)]
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,165 @@
+from timefold.solver.test import ConstraintVerifier
+
+from sports_league_scheduling.domain import *
+from sports_league_scheduling.constraints import *
+
+constraint_verifier = ConstraintVerifier.build(define_constraints, LeagueSchedule, Match)
+
+
+def test_matches_same_day():
+ # Two matches fo... | `round=None` and `classic_match=False` are the defaults for `Match` and do not need to be specified
(applies to the whole file wherever `classic_match=False` or `round=None`).
```suggestion
match3 = Match(id="3", home_team=home_team, away_team=rival_team)
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -0,0 +1,165 @@
+from timefold.solver.test import ConstraintVerifier
+
+from sports_league_scheduling.domain import *
+from sports_league_scheduling.constraints import *
+
+constraint_verifier = ConstraintVerifier.build(define_constraints, LeagueSchedule, Match)
+
+
+def test_matches_same_day():
+ # Two matches fo... | Don't need to specify `distance_to_team` if you are not populating it (it will create an empty dict using the default factory)
(applies to the whole file wherever `distance_to_team={}` is used).
```suggestion
home_team = Team(id="1", name="TeamA")
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -81,7 +81,7 @@ def start_to_away_hop(constraint_factory: ConstraintFactory) -> Constraint:
.for_each(Match)
.if_not_exists(Round, Joiners.equal(lambda match: match.round.index - 1,
lambda match_round: match_round.index))
- .penaliz... | Parenthesis uneccessary
```suggestion
.penalize(HardSoftScore.ONE_SOFT, lambda match: match.away_team.get_distance(match.home_team))
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -91,7 +91,7 @@ def home_to_away_hop(constraint_factory: ConstraintFactory) -> Constraint:
.join(Match,
Joiners.equal(lambda match: match.home_team, lambda match: match.away_team),
Joiners.equal(lambda match: match.round.index + 1, lambda match: match.round.index))
-... | ```suggestion
.penalize(HardSoftScore.ONE_SOFT, lambda match, other_match: match.home_team.get_distance(other_match.home_team))
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -101,7 +101,7 @@ def away_to_away_hop(constraint_factory: ConstraintFactory) -> Constraint:
.join(Match,
Joiners.equal(lambda match: match.away_team, lambda match: match.away_team),
Joiners.equal(lambda match: match.round.index + 1, lambda match: match.round.index))... | ```suggestion
.penalize(HardSoftScore.ONE_SOFT, lambda match, other_match: match.home_team.get_distance(other_match.home_team))
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -111,45 +111,22 @@ def away_to_home_hop(constraint_factory: ConstraintFactory) -> Constraint:
.join(Match,
Joiners.equal(lambda match: match.away_team, lambda match: match.home_team),
Joiners.equal(lambda match: match.round.index + 1, lambda match: match.round.index... | ```suggestion
.penalize(HardSoftScore.ONE_SOFT, lambda match, other_match: match.home_team.get_distance(match.away_team))
``` |
timefold-quickstarts | github_2023 | python | 685 | TimefoldAI | Christopher-Chianelli | @@ -111,45 +111,22 @@ def away_to_home_hop(constraint_factory: ConstraintFactory) -> Constraint:
.join(Match,
Joiners.equal(lambda match: match.away_team, lambda match: match.home_team),
Joiners.equal(lambda match: match.round.index + 1, lambda match: match.round.index... | ```suggestion
.penalize(HardSoftScore.ONE_SOFT, lambda match: match.home_team.get_distance(match.away_team))
``` |
timefold-quickstarts | github_2023 | others | 601 | TimefoldAI | triceo | @@ -121,4 +120,28 @@ jobs:
export NEW_PYTHON_VERSION="999-dev0"
.github/scripts/change_versions.sh
git commit -am "build: move back to version $NEW_VERSION"
- git push origin $RELEASE_BRANCH_NAME
\ No newline at end of file
+ git push origin $RELEASE_BRANCH_NAME
+
+ ... | Why are we doing this if none of workflows in the other repos had this?
Can't we delete the branch if it exists, like we do everywhere else? For consistency. |
timefold-quickstarts | github_2023 | others | 601 | TimefoldAI | triceo | @@ -1,4 +1,4 @@
-name: Release
+'name: Release | ? |
timefold-quickstarts | github_2023 | others | 553 | TimefoldAI | triceo | @@ -1,11 +1,9 @@
At this point, the release of _Timefold Quickstarts_ is ready to be published.
-- [x] Release branch has been created.
-- [x] Git tag has been published.
-- [ ] Delete the branch `dry_run`.
-- [ ] Create the version branch (e.g., `1.13.x`) from the `stable` one.
+- Release branch has been created.
+... | Arguably, this can be removed entirely. It doesn't provide any extra information. |
timefold-quickstarts | github_2023 | others | 536 | TimefoldAI | triceo | @@ -28,6 +28,13 @@ jobs:
java-version: [ 17 ] # Only the first supported LTS; already too many jobs here.
timeout-minutes: 120
steps:
+ # Clone timefold-quickstarts
+ # No need to check for stale repo, as Github merges the main repo into the fork automatically. | Please remove this line (and others like it), we no longer check for stale repo anywhere. |
timefold-quickstarts | github_2023 | java | 536 | TimefoldAI | triceo | @@ -45,7 +45,7 @@ public class Job {
/**
* Start is after cleanup.
*/
- @CascadingUpdateShadowVariable(targetMethodName = "updateStartCleaningDateTime", sourceVariableNames = {"line", "previousJob"})
+ @CascadingUpdateShadowVariable(targetMethodName = "updateStartCleaningDateTime")
private L... | Didn't we discuss that _nothing_ is allowed to depend on cascading shadows?
How do piggybacks work, if the shadows are not part of the var listener chain anymore, but instead are processed independently in their own loop? |
timefold-quickstarts | github_2023 | java | 527 | TimefoldAI | triceo | @@ -40,15 +41,19 @@ public class Job {
@NextElementShadowVariable(sourceVariableName = "jobs")
private Job nextJob;
- /** Start is after cleanup. */
- @ShadowVariable(variableListenerClass = StartDateTimeUpdatingVariableListener.class, sourceVariableName = "line")
- @ShadowVariable(variableListener... | Observation: that's a lot of boilerplate. The annotation - 6 times. The name of the method - 6 times. The name of each variable - three times. |
timefold-quickstarts | github_2023 | java | 527 | TimefoldAI | triceo | @@ -1,102 +0,0 @@
-package org.acme.foodpackaging.domain.solver;
-
-import java.time.LocalDateTime;
-import java.util.Objects;
-
-import org.acme.foodpackaging.domain.Job;
-import org.acme.foodpackaging.domain.Line;
-import org.acme.foodpackaging.domain.PackagingSchedule;
-import ai.timefold.solver.core.api.domain.vari... | Beautiful! |
timefold-quickstarts | github_2023 | python | 528 | TimefoldAI | triceo | @@ -41,3 +42,14 @@ def __post_init__(self):
self.description = (f"Vehicle '{self.vehicle_name}' total travel time is "
f"{self.total_driving_time_seconds // (60 * 60)} hours "
f"{round(self.total_driving_time_seconds / 60)} minutes.")
+
+
+@dataclass
+c... | We've agreed a while back that we won't be adding justifications to the quickstarts.
Please remove; if the Java quickstart still has them, that's an accident and please remove those too. |
timefold-quickstarts | github_2023 | javascript | 528 | TimefoldAI | triceo | @@ -20,6 +21,37 @@ const visitGroup = L.layerGroup().addTo(map);
const homeLocationGroup = L.layerGroup().addTo(map);
const routeGroup = L.layerGroup().addTo(map);
+/************************************ Time line constants and variable definitions ************************************/
+
+const byVehiclePanel = docu... | Please make sure this file is identical to the Java frontend.
(I haven't checked whether it is or not.) |
timefold-quickstarts | github_2023 | javascript | 496 | TimefoldAI | zepfred | @@ -335,8 +335,8 @@ function analyze() {
function getScoreComponents(score) {
let components = {hard: 0, medium: 0, soft: 0};
- $.each([...score.matchAll(/(-?[0-9]+)(hard|medium|soft)/g)], (i, parts) => {
- components[parts[2]] = parseInt(parts[1], 10);
+ $.each([...score.matchAll(/(-?\d*(\.\d+)?)(... | Agreed. Let's create a papercut story to ensure consistency between the quickstart modules. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.