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-quickstarts
github_2023
others
496
TimefoldAI
zepfred
@@ -39,5 +39,4 @@ quarkus.swagger-ui.always-include=true # Test overrides ######################## # Effectively disable spent-time termination in favor of the best-score-limit -%test.quarkus.timefold.solver.termination.spent-limit=1h -%test.quarkus.timefold.solver.termination.best-score-limit=0hard/*medium/*soft \ ...
Is this change correct?
timefold-quickstarts
github_2023
java
495
TimefoldAI
triceo
@@ -22,8 +22,8 @@ public Constraint[] defineConstraints(ConstraintFactory constraintFactory) { return new Constraint[] { // Hard constraints crewConflict(constraintFactory), - readyDate(constraintFactory), - dueDate(constraintFactory), + ...
Shouldn't this be `minStartDate` and `maxEndDate`? Either way, it should be consistent with food packaging, which is also being updated in this PR, but for some reason it is being updated to something else.
timefold-quickstarts
github_2023
java
484
TimefoldAI
triceo
@@ -76,48 +71,33 @@ Constraint atLeast10HoursBetweenTwoShifts(ConstraintFactory constraintFactory) { Constraint oneShiftPerDay(ConstraintFactory constraintFactory) { return constraintFactory.forEachUniquePair(Shift.class, Joiners.equal(Shift::getEmployee), - Joiners.equal(shift ->...
Using `expand` is not necessary; I think you've done that, so that later in the `filter`, you can use a method reference. Is that a good enough reason to introduce a functionality that slows down the constraint and, arguably, makes it more complex to understand? In my opinion, it is not.
timefold-quickstarts
github_2023
java
484
TimefoldAI
triceo
@@ -89,6 +96,41 @@ public void setEmployee(Employee employee) { this.employee = employee; } + @JsonIgnore + public boolean isOverlappingWith(Collection<LocalDate> dates) { + return !getOverlappingDatesForShift(dates).isEmpty(); + }
Although this is a simple way of implementing the requirement, it is also an anti-pattern. Let us not teach our users that abandoning incrementality and turning everything into collection processing is the right way of doing things; they already think that anyway. There is a simple rule of thumb when working with c...
timefold-quickstarts
github_2023
java
484
TimefoldAI
triceo
@@ -75,49 +74,41 @@ Constraint atLeast10HoursBetweenTwoShifts(ConstraintFactory constraintFactory) { } Constraint oneShiftPerDay(ConstraintFactory constraintFactory) { - return constraintFactory.forEachUniquePair(Shift.class, Joiners.equal(Shift::getEmployee), - Joiners.equal(s...
In this case, I think that `expand(...)` actually has value. `getOverlappingDurationInMinutes()` has quite a lot of logic, which is now being run twice.
timefold-quickstarts
github_2023
java
484
TimefoldAI
triceo
@@ -75,49 +74,44 @@ Constraint atLeast10HoursBetweenTwoShifts(ConstraintFactory constraintFactory) { } Constraint oneShiftPerDay(ConstraintFactory constraintFactory) { - return constraintFactory.forEachUniquePair(Shift.class, Joiners.equal(Shift::getEmployee), - Joiners.equal(s...
The filter body should be extracted to a method on `Shift` and reused; it's non-trivial logic which is repeated in 3 constraints.
timefold-quickstarts
github_2023
java
484
TimefoldAI
triceo
@@ -89,6 +92,24 @@ public void setEmployee(Employee employee) { this.employee = employee; } + public boolean isOverlappingWithDate(LocalDate date) { + return getStart().toLocalDate().equals(date) || getEnd().toLocalDate().equals(date); + } + + public long getOverlappingDurationInMinutes(...
Any reason why this can't return an `int`? I doubt there will ever be 2 billion minutes of overlap. (`long` causes casting in the `penalize(...)` calls.)
timefold-quickstarts
github_2023
java
484
TimefoldAI
triceo
@@ -54,18 +52,19 @@ Constraint requiredSkill(ConstraintFactory constraintFactory) { } Constraint noOverlappingShifts(ConstraintFactory constraintFactory) { - return constraintFactory.forEachUniquePair(Shift.class, Joiners.equal(Shift::getEmployee), - Joiners.overlapping(Shift::...
Are you sure about `forEachUniquePair` here? It is useful, but not in situations where the order of the two elements actually matters, such as here. Consider shifts A, B. This will produce [A, B], but not [B, A]. This clashes with `A.end() < B.start()`; some of the pairs will not be selected and therefore not penali...
timefold-quickstarts
github_2023
java
484
TimefoldAI
triceo
@@ -54,18 +52,18 @@ Constraint requiredSkill(ConstraintFactory constraintFactory) { } Constraint noOverlappingShifts(ConstraintFactory constraintFactory) { - return constraintFactory.forEachUniquePair(Shift.class, Joiners.equal(Shift::getEmployee), - Joiners.overlapping(Shift::...
One joiner is statically imported, the other isn't. Let's either consistently do static imports, or consistently don't.
timefold-quickstarts
github_2023
others
483
TimefoldAI
triceo
@@ -2,7 +2,7 @@ <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1" name="viewport"> - <title>School timetabling - Timefold Quarkus</title> + <title>School timetabling - Timefold Python</title>
```suggestion <title>School timetabling - Timefold Solver for Python</title> ```
timefold-quickstarts
github_2023
others
476
TimefoldAI
triceo
@@ -49,6 +49,28 @@ Then try _live coding_: Notice that those changes are immediately in effect. +[[enterprise]] +== Run the application with the Enterprise Edition
This is not the entire description. Even though you link to the docs, I think it's still better to mention here that: - They need to configure username and password. - And the way to get username and password is to [contact us](https://timefold.ai/contact) to get a license.
timefold-quickstarts
github_2023
others
476
TimefoldAI
triceo
@@ -49,6 +49,28 @@ Then try _live coding_: Notice that those changes are immediately in effect. +[[enterprise]] +== Run the application with the Enterprise Edition + +For high-scalability use cases, try the paid https://docs.timefold.ai/timefold-solver/latest/enterprise-edition/enterprise-edition[Enterprise Editio...
```suggestion For high-scalability use cases, try https://docs.timefold.ai/timefold-solver/latest/enterprise-edition/enterprise-edition[Timefold Solver Enterprise Edition], our commercial offering, instead: ```
timefold-quickstarts
github_2023
others
476
TimefoldAI
triceo
@@ -50,9 +50,60 @@ Then try _live coding_: Notice that those changes are immediately in effect. [[enterprise]] -== Run the application with the Enterprise Edition +== Run the application with Timefold Solver Enterprise Edition -For high-scalability use cases, try the paid https://docs.timefold.ai/timefold-solver/...
Do tabs work on Github? Arguably if the quickstart doesn't have support for Gradle, this can be simplified by not including Gradle instructions.
timefold-quickstarts
github_2023
others
476
TimefoldAI
triceo
@@ -49,6 +49,79 @@ Then try _live coding_: Notice that those changes are immediately in effect. +[[enterprise]] +== Run the application with Timefold Solver Enterprise Edition + +For high-scalability use cases, switch to https://docs.timefold.ai/timefold-solver/latest/enterprise-edition/enterprise-edition[Timefold...
This is a Maven-specific instruction, it belongs in the Maven tab. Gradle does this differently.
timefold-quickstarts
github_2023
others
476
TimefoldAI
triceo
@@ -1,15 +1,3 @@ -######################## -# General properties -######################## - -# Enable CORS for runQuickstartsFromSource.sh -quarkus.http.cors=true -quarkus.http.cors.origins=/http://localhost:.*/ -# Allow all origins in dev-mode -%dev.quarkus.http.cors.origins=/.*/ -# Enable Swagger UI also in the nati...
```suggestion # Timefold Solver properties ```
timefold-quickstarts
github_2023
others
476
TimefoldAI
triceo
@@ -19,19 +7,35 @@ quarkus.timefold.solver.termination.spent-limit=30s # To change how many solvers to run in parallel # timefold.solver-manager.parallel-solver-count=4 -# To run increase CPU cores usage per solver -# quarkus.timefold.solver.move-thread-count=2 # Temporary comment this out to detect bugs in your...
```suggestion # Timefold Solver Enterprise Edition properties ```
timefold-quickstarts
github_2023
python
477
TimefoldAI
Christopher-Chianelli
@@ -21,7 +21,7 @@ def test_required_skill(): Shift(id="1", start=DAY_START_TIME, end=DAY_END_TIME, location="Location", required_skill="Skill", employee=employee)) .penalizes(1)) - employee = Employee(name="Beth", skills={"Skill"}) + employee = Employee(name="Beth", skills={"Skill"}, unavai...
```suggestion employee = Employee(name="Beth", skills={"Skill"}) ```
timefold-quickstarts
github_2023
python
477
TimefoldAI
Christopher-Chianelli
@@ -1,16 +1,18 @@ from timefold.solver.score import ConstraintFactory, HardSoftScore, constraint_provider -from .domain import Vehicle -from .justifications import VehicleCapacityJustification, MinimizeTravelTimeJustification +from .domain import * +from .score_analysis import * VEHICLE_CAPACITY = "vehicleCapacit...
I strongly disagree with this change. Why?
timefold-quickstarts
github_2023
python
474
TimefoldAI
Christopher-Chianelli
@@ -15,210 +15,174 @@ def test_required_skill(): - employee = Employee(name="Amy", skills=set()) + employee = Employee(name="Amy", skills=set(), unavailable_dates=set(), undesired_dates=set(), desired_dates=set())
Using `Field(default_factory=set)` would make unavailable_dates, etc. empty if unspecified (https://docs.pydantic.dev/latest/api/fields/#pydantic.fields.Field)
timefold-quickstarts
github_2023
others
459
TimefoldAI
zepfred
@@ -0,0 +1,79 @@ += Employee Scheduling (Python)
Let's fix the title.
timefold-quickstarts
github_2023
python
459
TimefoldAI
zepfred
@@ -0,0 +1,53 @@ +from timefold.solver.score import ConstraintFactory, HardSoftScore, constraint_provider + +from .domain import Vehicle +from .justifications import VehicleCapacityJustification, MinimizeTravelTimeJustification + +VEHICLE_CAPACITY = "vehicleCapacity" +MINIMIZE_TRAVEL_TIME = "minimizeTravelTime" + + +@c...
It looks like the capacity param comes first.
timefold-quickstarts
github_2023
javascript
459
TimefoldAI
zepfred
@@ -0,0 +1,165 @@ +function addNewVisit(id, lat, lng, map, marker) {
Do we need this file?
timefold-quickstarts
github_2023
others
466
TimefoldAI
triceo
@@ -0,0 +1,128 @@ +name: Maven
```suggestion name: Python ```
timefold-quickstarts
github_2023
javascript
458
TimefoldAI
zepfred
@@ -0,0 +1,435 @@ +var autoRefreshIntervalId = null; +const dateTimeFormatter = JSJoda.DateTimeFormatter.ofPattern('HH:mm') + +let demoDataId = null; +let scheduleId = null; +let loadedSchedule = null; + +$(document).ready(function () { + replaceQuickstartTimefoldAutoHeaderFooter(); + + $("#solveButton").click(functi...
This button is not working. Let's fix it.
timefold-quickstarts
github_2023
python
458
TimefoldAI
zepfred
@@ -0,0 +1,28 @@ +from timefold.solver import SolverFactory +from timefold.solver.config import (SolverConfig, ScoreDirectorFactoryConfig, + TerminationConfig, Duration, TerminationCompositionStyle) + +from school_timetabling.domain import Timetable, Lesson +from school_timetabling.co...
Let's either create a new test or update this one to enable API calls, allowing us to test the API with supported Python versions.
timefold-quickstarts
github_2023
python
451
TimefoldAI
zepfred
@@ -0,0 +1,61 @@ +from timefold.solver import SolverManager, SolverFactory, SolutionManager +from timefold.solver.config import (SolverConfig, ScoreDirectorFactoryConfig, + TerminationConfig, Duration) +from fastapi import FastAPI +from fastapi.staticfiles import StaticFiles + +from ....
It looks like we always return the `SMALL` dataset
timefold-quickstarts
github_2023
others
451
TimefoldAI
zepfred
@@ -0,0 +1,135 @@ +<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>Employee scheduling - Timefold Python</title> + + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vis-ti...
This button is not used. Let's either remove it or add the necessary logic for publishing schedules.
timefold-quickstarts
github_2023
others
447
TimefoldAI
zepfred
@@ -0,0 +1,64 @@ += School Timetabling (Python) + +Assign lessons to timeslots and rooms to produce a better schedule for teachers and students. + +== Prerequisites + +. Install Python 3.10+ + +. Install JDK 17+, for example with https://sdkman.io[Sdkman]: ++ +---- +$ sdk install java
Do we have instructions on how to install Python?
timefold-quickstarts
github_2023
others
447
TimefoldAI
zepfred
@@ -0,0 +1,64 @@ += School Timetabling (Python) + +Assign lessons to timeslots and rooms to produce a better schedule for teachers and students. + +== Prerequisites + +. Install Python 3.10+ + +. Install JDK 17+, for example with https://sdkman.io[Sdkman]: ++ +---- +$ sdk install java +---- + +== Run the application + ...
I can't install the dependencies. Do I need to run any additional commands? ``` (.venv) fred@fedora:~/Projects/timefold/timefold-quickstarts/python/hello-world$ pip install -r requirements.txt ERROR: Could not find a version that satisfies the requirement timefold-solver==999-dev0 (from versions: 1.10.0a0) ERROR: N...
timefold-quickstarts
github_2023
python
447
TimefoldAI
zepfred
@@ -0,0 +1,126 @@ +from timefold.solver.config import (SolverConfig, ScoreDirectorFactoryConfig, + TerminationConfig, Duration) +from timefold.solver import SolverFactory +from domain import Lesson, Timeslot, Room, Timetable +from constraints import school_timetabling_constraints +fro...
We are not using the `LARGE` type to create a different dataset.
timefold-quickstarts
github_2023
others
447
TimefoldAI
zepfred
@@ -0,0 +1,3 @@ +timefold-solver==999-dev0
This version is failing to be installed.
timefold-quickstarts
github_2023
python
447
TimefoldAI
zepfred
@@ -0,0 +1,28 @@ +from timefold.solver import SolverFactory
Nice!
timefold-quickstarts
github_2023
others
434
TimefoldAI
triceo
@@ -3,7 +3,7 @@ plugins { id "io.quarkus" version "3.9.4"
```suggestion id "io.quarkus" version "3.10.1" ```
timefold-quickstarts
github_2023
others
421
TimefoldAI
triceo
@@ -77,6 +77,9 @@ jobs: - name: Quickly build timefold-solver working-directory: ./timefold-solver run: mvn -B -Dquickly clean install - - name: Test timefold-quickstarts in Native mode + - name: Test timefold-quickstarts (slowly tests)
```suggestion - name: Test timefold-quickstarts (slow tests) ```
timefold-quickstarts
github_2023
others
421
TimefoldAI
triceo
@@ -1,137 +1,181 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + ...
These changes are unrelated and unnecessary. Probably your IDE messed up? Please remove from this file and others.
timefold-quickstarts
github_2023
others
421
TimefoldAI
triceo
@@ -0,0 +1,152 @@ +name: Long-Running + +on: + pull_request: + branches: [stable, development, '*.x'] + paths-ignore: + - 'LICENSE*' + - '.gitignore' + - '**.md' + - '**.adoc' + - '*.txt' + +jobs: +# build-quarkus:
Please re-enable.
timefold-quickstarts
github_2023
java
421
TimefoldAI
triceo
@@ -0,0 +1,41 @@ +package org.acme.schooltimetabling.solver; + +import static org.acme.schooltimetabling.TimetableApp.generateDemoData; +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.Duration; + +import ai.timefold.solver.core.api.solver.Solver; +import ai.timefold.solver.core.api.solver...
So we are no longer doing `FULL_ASSERT`? I thought we'd be doing both.
timefold-quickstarts
github_2023
others
421
TimefoldAI
triceo
@@ -154,8 +149,53 @@ <plugin> <groupId>org.graalvm.buildtools</groupId> <artifactId>native-maven-plugin</artifactId> + <configuration> + <imageName>app.native</imageName> + <buildArgs> + <!-- Ob == fast build --> + <buildArg>-Ob</buildArg> + ...
By using the following, you'll be able to remove the entire `default` profile, possibly even both the profiles: https://junit.org/junit5/docs/5.1.0/api/org/junit/jupiter/api/condition/EnabledIfSystemProperty.html
timefold-quickstarts
github_2023
java
421
TimefoldAI
triceo
@@ -0,0 +1,45 @@ +package org.acme.schooltimetabling.solver; + +import static org.acme.schooltimetabling.TimetableApp.generateDemoData; +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.Duration; + +import ai.timefold.solver.core.api.solver.Solver; +import ai.timefold.solver.core.api.solver...
I like this. Simple, no boilerplate, no profiles. Do you mind propagating this to the rest of the assert tests? (Spring Boot can do it differently, if this causes trouble.) Maybe I'd make two methods out of this? So that you see in the log whether it was the full or the fast that failed.
timefold-quickstarts
github_2023
java
421
TimefoldAI
triceo
@@ -1,14 +1,16 @@ package org.acme.schooltimetabling.solver; +import java.time.DayOfWeek; +import java.time.LocalTime; + import ai.timefold.solver.test.api.score.stream.ConstraintVerifier; + import org.acme.schooltimetabling.domain.Lesson; import org.acme.schooltimetabling.domain.Room; import org.acme.schooltime...
Please reformat the imports using the order we use in the Solver. (Alternatively: remove these unrelated changes, which will equal to the same result.)
timefold-quickstarts
github_2023
java
421
TimefoldAI
triceo
@@ -0,0 +1,48 @@ +package org.acme.schooltimetabling.solver; + +import static org.acme.schooltimetabling.TimetableApp.generateDemoData; +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.Duration; + +import ai.timefold.solver.core.api.solver.Solver; +import ai.timefold.solver.core.api.solver...
```suggestion assertThat(solution.getScore()).isNotNull(); } ```
timefold-quickstarts
github_2023
java
421
TimefoldAI
triceo
@@ -0,0 +1,48 @@ +package org.acme.schooltimetabling.solver; + +import static org.acme.schooltimetabling.TimetableApp.generateDemoData; +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.Duration; + +import ai.timefold.solver.core.api.solver.Solver; +import ai.timefold.solver.core.api.solver...
```suggestion assertThat(solution.getScore()).isNotNull(); } ```
timefold-quickstarts
github_2023
java
418
TimefoldAI
triceo
@@ -541,22 +535,6 @@ public void setCrowdControlRisk(int crowdControlRisk) { this.crowdControlRisk = crowdControlRisk; } - public Timeslot getPublishedTimeslot() { - return publishedTimeslot; - } - - public void setPublishedTimeslot(Timeslot publishedTimeslot) { - this.publishedTi...
This is also related to publishing, isn't it? We don't have a feature in the UI to pin anything, so arguably the entire support for pinning can go too.
timefold-quickstarts
github_2023
java
402
TimefoldAI
triceo
@@ -0,0 +1,80 @@ +package org.acme.tournamentschedule.rest; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.stream.IntStream; + +import jakarta.enterprise.context.ApplicationScoped; + +import org.acme.tournamentschedule.domain.Day; +import org.acme.tournamentschedule.d...
Maybe we want to use our own names? :-) Maarten, Geoffrey, Lukas, Chris, Fred, Radek, Maciej, ...
timefold-quickstarts
github_2023
others
402
TimefoldAI
triceo
@@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + ...
```suggestion <version.io.quarkus>3.9.4</version.io.quarkus> ```
timefold-quickstarts
github_2023
others
397
TimefoldAI
triceo
@@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + ...
```suggestion <version.io.quarkus>3.9.3</version.io.quarkus> ```
timefold-quickstarts
github_2023
java
397
TimefoldAI
triceo
@@ -0,0 +1,69 @@ +package org.acme.projectjobschedule.solver; + +import ai.timefold.solver.core.api.score.buildin.hardmediumsoft.HardMediumSoftScore; +import ai.timefold.solver.core.api.score.stream.Constraint; +import ai.timefold.solver.core.api.score.stream.ConstraintCollectors; +import ai.timefold.solver.core.api.sc...
I'm not exactly sure why we decided to make this an `impact` instead of a penalty, all those years ago. Can you think why this should be a positive number? If not, let's change the semantics and make it a penalty like anything else.
timefold-quickstarts
github_2023
java
390
TimefoldAI
triceo
@@ -0,0 +1,88 @@ +package org.acme.taskassigning.domain; + +import java.util.List; + +import ai.timefold.solver.core.api.domain.solution.PlanningEntityCollectionProperty; +import ai.timefold.solver.core.api.domain.solution.PlanningScore; +import ai.timefold.solver.core.api.domain.solution.PlanningSolution; +import ai.t...
This is a bit crazy. I suggest we spend a bit of time thinking about the constraints and how they should be weighted against each other, and based on that, replace this with a normal `HardMediumSoftScore`.
timefold-quickstarts
github_2023
others
390
TimefoldAI
triceo
@@ -0,0 +1,229 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + ...
```suggestion <version.io.quarkus>3.9.3</version.io.quarkus> ```
timefold-quickstarts
github_2023
java
373
TimefoldAI
triceo
@@ -0,0 +1,174 @@ +package org.acme.flighcrewscheduling.domain; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.SortedSet; +import java.util.TreeSet; + +import ai.timefold.solver.core.api.domain.entity.PlanningEntity; +import ai.timefold.s...
Do we need this to be `SortedSet`? Honestly it's the first time I'm seeing it used for this. Isn't `List` enough?
timefold-quickstarts
github_2023
java
373
TimefoldAI
triceo
@@ -0,0 +1,116 @@ +package org.acme.flighcrewscheduling.domain; + +import java.util.Comparator; +import java.util.Objects; + +import ai.timefold.solver.core.api.domain.entity.PlanningEntity; +import ai.timefold.solver.core.api.domain.lookup.PlanningId; +import ai.timefold.solver.core.api.domain.variable.PlanningVariabl...
And if we're no longer using `SortedSet`, we don't need these comparators, no? I'm really curious why we're using the sorted set.
timefold-quickstarts
github_2023
java
373
TimefoldAI
triceo
@@ -0,0 +1,280 @@ +package org.acme.flighcrewscheduling.rest; + +import static java.util.Collections.unmodifiableList; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +impo...
Let's add two more airports, to have move variety in the flights. `ATL` is massive, and `BNE` for Australia.
timefold-quickstarts
github_2023
java
373
TimefoldAI
triceo
@@ -0,0 +1,280 @@ +package org.acme.flighcrewscheduling.rest; + +import static java.util.Collections.unmodifiableList; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +impo...
You can use an arguably nicer syntax for this: Map.of( key, value, key, value, key, value, ...);
timefold-quickstarts
github_2023
java
373
TimefoldAI
triceo
@@ -0,0 +1,77 @@ +package org.acme.flighcrewscheduling.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.overlapping; + +import java.util.Collections; + +import ai.timefold.solver.core.api.score.buildin.hardsoftlong.HardSoftL...
I'm wondering if we need so many significant digits. We've got 10, 100, so this could be 1_000.
timefold-quickstarts
github_2023
java
373
TimefoldAI
triceo
@@ -0,0 +1,77 @@ +package org.acme.flighcrewscheduling.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.overlapping; + +import java.util.Collections; + +import ai.timefold.solver.core.api.score.buildin.hardsoftlong.HardSoftL...
Dtto.
timefold-quickstarts
github_2023
others
380
TimefoldAI
triceo
@@ -0,0 +1,229 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + ...
We're back to 3.8.3 for now.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,255 @@ +package org.acme.meetingschedule.rest; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.u...
Let's not use internal classes from the solver. If you need a `Pair`, write the record yourself - it's trivial. The `MutableInt` is unnecessary.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,224 @@ +package org.acme.meetingschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; +import static ai.timefold.solver.core.api.score.stream.Joiners.greaterThan; +import static ai.timefold.solver.c...
the grainIndex+durationInGrains is repeated so often that I think it would warrant a getter on assignment.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -333,4 +331,51 @@ private <T, L> void applyRandomValue(int count, List<T> values, L secondParam, P } } } + + private record Pair<Key_, Value_>(Key_ key, Value_ value) { + public Pair(Key_ key, Value_ value) { + this.key = key; + this.value = value; + ...
Considering that this is a quickstart, let's refactor the code so that mutable references aren't necessary. Every time you have to ask yourself "why is this here?" and the answer is not directly related to the idea you want to show the users, remove the thing.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -333,4 +331,51 @@ private <T, L> void applyRandomValue(int count, List<T> values, L secondParam, P } } } + + private record Pair<Key_, Value_>(Key_ key, Value_ value) { + public Pair(Key_ key, Value_ value) { + this.key = key; + this.value = value; + ...
It's a record; these are not necessary.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,135 @@ +package org.acme.meetingschedule.domain; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +@JsonIdentityInfo(scope = M...
I see two options here: - Either don't check if the person is already present. - Or if you want to check for that, do something if the person is already present. Fail, perhaps. Also, instead of this if switch, I'd rather turn this into two methods - add required attendant, add preferred attendant. See how the `isR...
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,152 @@ +package org.acme.meetingschedule.domain; + +import java.util.Objects; + +import ai.timefold.solver.core.api.domain.entity.PlanningEntity; +import ai.timefold.solver.core.api.domain.entity.PlanningPin; +import ai.timefold.solver.core.api.domain.lookup.PlanningId; +import ai.timefold.solver.core.api.do...
Didn't we add a method for this?
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,152 @@ +package org.acme.meetingschedule.domain; + +import java.util.Objects; + +import ai.timefold.solver.core.api.domain.entity.PlanningEntity; +import ai.timefold.solver.core.api.domain.entity.PlanningPin; +import ai.timefold.solver.core.api.domain.lookup.PlanningId; +import ai.timefold.solver.core.api.do...
Dtto.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,152 @@ +package org.acme.meetingschedule.domain; + +import java.util.Objects; + +import ai.timefold.solver.core.api.domain.entity.PlanningEntity; +import ai.timefold.solver.core.api.domain.entity.PlanningPin; +import ai.timefold.solver.core.api.domain.lookup.PlanningId; +import ai.timefold.solver.core.api.do...
Arguably if the counterpart to this is called `getStarting...`, this one should be `getEnding...`. Or they should be first/last. But it should be mutually consistent.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,134 @@ +package org.acme.meetingschedule.domain; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.Comparator; +import java.util.Locale; +import java.util.Objects; + +import ai.timefold.solver.core.api.domain.lookup.PlanningId; + +import...
Why is `TimeGrain` comparable and can we do anything to stop it?
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,134 @@ +package org.acme.meetingschedule.domain; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.Comparator; +import java.util.Locale; +import java.util.Objects; + +import ai.timefold.solver.core.api.domain.lookup.PlanningId; + +import...
Do we need this anywhere? What for?
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,268 @@ +package org.acme.meetingschedule.rest; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.u...
If you don't use lambdas so much, you won't have to complicate your code with mutable references.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,268 @@ +package org.acme.meetingschedule.rest; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.u...
Records don't need these.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -0,0 +1,224 @@ +package org.acme.meetingschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; +import static ai.timefold.solver.core.api.score.stream.Joiners.greaterThan; +import static ai.timefold.solver.c...
Don't we have a method for this? If not, let's add it. It's used very often. Please check the rest of the constraint provider too.
timefold-quickstarts
github_2023
java
380
TimefoldAI
triceo
@@ -99,23 +105,30 @@ public int calculateOverlap(MeetingAssignment other) { // start is inclusive, end is exclusive int start = startingTimeGrain.getGrainIndex(); int otherStart = other.startingTimeGrain.getGrainIndex(); - int otherEnd = otherStart + other.meeting.getDurationInGrains()...
Now this is confusing. `lastTimeGrainIndex` makes perfect sense - it is the last index. But `endingTimeGrainDuration` is also a grain index; arguably it's not a duration at all, because it starts from zero, not from the starting time grain. The difference between the two is effectively `-1`. And that, arguably, i...
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,90 @@ +package org.acme.sportsleagueschedule.domain; + +import ai.timefold.solver.core.api.domain.entity.PlanningEntity; +import ai.timefold.solver.core.api.domain.lookup.PlanningId; +import ai.timefold.solver.core.api.domain.variable.PlanningVariable; + +import com.fasterxml.jackson.annotation.JsonIgnore; +...
I would add a comment explaining what this means. Assume not everyone knows as much about football as you. For example, me. :-)
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,61 @@ +package org.acme.sportsleagueschedule.domain; + +import ai.timefold.solver.core.api.domain.lookup.PlanningId; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +@JsonIdentityInfo(scope = Round.class, generator = ObjectIdGenerato...
This is even more important to explain. In fact, maybe it's better to simply rename it to describe its function. `isOnWeekendOrHoliday`.
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,61 @@ +package org.acme.sportsleagueschedule.domain; + +import ai.timefold.solver.core.api.domain.lookup.PlanningId; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +@JsonIdentityInfo(scope = Round.class, generator = ObjectIdGenerato...
Round?
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,127 @@ +package org.acme.sportsleagueschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; + +import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSoftScore; +import ai.timefold.solver.core...
Based on my comments above, this will need to be renamed too.
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,127 @@ +package org.acme.sportsleagueschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; + +import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSoftScore; +import ai.timefold.solver.core...
Consider using the consecutive collector for this. (See either docs or nurse rostering.) Otherwise we really don't have an example to showcase it anymore.
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,130 @@ +package org.acme.sportsleagueschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; + +import java.util.function.Function; + +import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSof...
This is now a score trap. If the result is 5 or 50, it doesn't matter, the penalty will be 1. Make the solver's job easier, and penalize by the difference between the minimum and the actual value.
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,131 @@ +package org.acme.sportsleagueschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; + +import java.util.function.Function; + +import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSof...
```suggestion .asConstraint("Matches on the same day"); ```
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,131 @@ +package org.acme.sportsleagueschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; + +import java.util.function.Function; + +import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSof...
```suggestion .asConstraint("4 or more consecutive home matches"); ```
timefold-quickstarts
github_2023
java
388
TimefoldAI
triceo
@@ -0,0 +1,131 @@ +package org.acme.sportsleagueschedule.solver; + +import static ai.timefold.solver.core.api.score.stream.Joiners.equal; +import static ai.timefold.solver.core.api.score.stream.Joiners.filtering; + +import java.util.function.Function; + +import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSof...
```suggestion .asConstraint("4 or more consecutive away matches"); ```
timefold-quickstarts
github_2023
java
366
TimefoldAI
triceo
@@ -130,22 +129,21 @@ public Constraint preferredMaximumRoomCapacity(ConstraintFactory constraintFacto public Constraint departmentSpecialty(ConstraintFactory constraintFactory) { return constraintFactory.forEach(Stay.class) - .ifNotExists(DepartmentSpecialty.class, - ...
Let's not keep commented-out code around. That's what Git history is for.
timefold-quickstarts
github_2023
java
366
TimefoldAI
triceo
@@ -50,28 +45,21 @@ public void setDepartments(List<Department> departments) { this.departments = departments; } - public void setDepartmentSpecialties(List<DepartmentSpecialty> departmentSpecialties) { - this.departmentSpecialties = departmentSpecialties; - } - - public List<DepartmentS...
The next getter formats the stream better. Let's do the same thing, stay consistent.
timefold-quickstarts
github_2023
java
205
TimefoldAI
rsynek
@@ -45,7 +45,7 @@ private void pinCallAssignedToAgents(List<Call> calls) { public void startSolving(CallCenter inputProblem, Consumer<CallCenter> bestSolutionConsumer, Consumer<Throwable> errorHandler) { solverManager.solveAndListen(SINGLETON_ID, id -> inputProblem, bestSolution -> { - ...
`Score.isFeasible()` already covers (un)initialized solutions. ```suggestion if (bestSolution.isFeasible()) { ```
timefold-quickstarts
github_2023
java
205
TimefoldAI
rsynek
@@ -41,7 +42,8 @@ private static Set<Skill> buildSkillSet(Skill... skills) { } public CallCenter generateCallCenter() { - return new CallCenter(EnumSet.allOf(Skill.class), Arrays.asList(AGENTS), new ArrayList<>()); + return new CallCenter(EnumSet.allOf(Skill.class), Arrays.stream(AGENTS).map(A...
If the intention is to avoid reusing the same `Agent` instances, I suggest creating them in this method directly and removing the static array is more straightforward than copying the array.
timefold-quickstarts
github_2023
java
205
TimefoldAI
rsynek
@@ -96,6 +105,63 @@ void removeCall() { assertThat(call.getId()).isEqualTo(call2.getId()); } + @Test + @Timeout(60) + void removeCallWithInfeasibleInitialSolution() { + // Invalid initial solution + CallCenter inputProblem = dataGenerator.generateCallCenter(); + Call call1 ...
Numbering variables harms readability. While I am technically guilty of doing that as well, I see some sense in breaking the rule for test data (`call1`, `call2`), provided it does not have any specific purpose in the test. May I suggest renaming the variable to `localSearchSolverManager` ?
timefold-quickstarts
github_2023
java
197
TimefoldAI
rsynek
@@ -0,0 +1,92 @@ +package org.acme.callcenter.solver.retry; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.TestExecutionExceptionHandler; +import org.junit.jupiter.api.extension.TestTemplateInvocationContext; +import org.junit.jupiter.api.extension.TestTemplateInvoca...
```suggestion // Stop when there is one successful or the max attempts is exhausted ```
timefold-quickstarts
github_2023
java
197
TimefoldAI
rsynek
@@ -77,6 +76,7 @@ void prolongCall() { @Test @Timeout(60) + @Retry(3)
While this approach lowers the risk of the test failing again, it does not fix the root cause. This is a not a problem with a random failure due to e.g. network latency, which would justify the retries. Suggestion: try reproducing the issue by running the test in a loop (perhaps with some very short random pauses...
timefold-quickstarts
github_2023
java
316
TimefoldAI
triceo
@@ -69,4 +62,16 @@ public void setAvailabilityType(AvailabilityType availabilityType) { public String toString() { return availabilityType + "(" + employee + ", " + date + ")"; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof A...
Let's not use [Objects.hash(...)](https://docs.oracle.com/javase/8/docs/api/java/util/Objects.html#hash-java.lang.Object...-). This method creates a varargs array on the heap every time it is invoked. When this `hashCode` method gets on a hot path (such as in constraints), this is a considerable slowdown. Let's n...
timefold-quickstarts
github_2023
java
259
TimefoldAI
triceo
@@ -100,6 +96,50 @@ public String solve(VehicleRoutePlan problem) { return jobId; } + @Operation(summary = "Request recommendations to the RecommendedFit API for a new customer.") + @APIResponses(value = { + @APIResponse(responseCode = "200", + description = "The list...
```suggestion @Operation(summary = "Applies a given recommentation.") ```
timefold-quickstarts
github_2023
java
259
TimefoldAI
triceo
@@ -100,6 +96,50 @@ public String solve(VehicleRoutePlan problem) { return jobId; } + @Operation(summary = "Request recommendations to the RecommendedFit API for a new customer.") + @APIResponses(value = { + @APIResponse(responseCode = "200", + description = "The list...
I'd use `GET` here, since you're asking for data.
timefold-quickstarts
github_2023
java
259
TimefoldAI
triceo
@@ -100,6 +96,50 @@ public String solve(VehicleRoutePlan problem) { return jobId; } + @Operation(summary = "Request recommendations to the RecommendedFit API for a new customer.") + @APIResponses(value = { + @APIResponse(responseCode = "200", + description = "The list...
```suggestion @Path("recommendation") ``` And then you can use `recommendation` here, because `@POST` is no longer used to get the recommendations.
timefold-quickstarts
github_2023
java
259
TimefoldAI
triceo
@@ -100,6 +96,50 @@ public String solve(VehicleRoutePlan problem) { return jobId; } + @Operation(summary = "Request recommendations to the RecommendedFit API for a new customer.") + @APIResponses(value = { + @APIResponse(responseCode = "200", + description = "The list...
```suggestion Customer customer = request.solution().getCustomers().stream() .filter(c -> c.getId().equals(request.customerId())) .findFirst() .orElseThrow(() -> new IllegalStateException("Customer %s not found" .formatted(request.customerId()))); ``` ...
timefold-quickstarts
github_2023
java
259
TimefoldAI
triceo
@@ -100,6 +96,50 @@ public String solve(VehicleRoutePlan problem) { return jobId; } + @Operation(summary = "Request recommendations to the RecommendedFit API for a new customer.") + @APIResponses(value = { + @APIResponse(responseCode = "200", + description = "The list...
Same comment on formatting of fluent chains.
timefold-quickstarts
github_2023
java
259
TimefoldAI
triceo
@@ -1,31 +1,26 @@ package org.acme.vehiclerouting.rest; import java.util.Collection; +import java.util.List; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import jakarta.inject.Inject; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELE...
Star imports are not allowed. Please configure your IDE not to allow them.
timefold-quickstarts
github_2023
others
222
TimefoldAI
triceo
@@ -0,0 +1,27 @@ +## Description of the change + +> Description here + +## Related Issue + +Issue #ID
If you take a look on the right, you will see that Github allows linking a Github issue. I think this should be enough and we don't need to include it in the PR description as well. WDYT?
timefold-quickstarts
github_2023
others
222
TimefoldAI
triceo
@@ -0,0 +1,27 @@ +## Description of the change + +> Description here + +## Related Issue + +Issue #ID + +## Checklist + +### Development + +- [ ] The changes have been covered with tests, if necessary. +- [ ] You have a green build, with the exception of the flaky tests. +- [ ] UI and JS files are fully tested, and the...
```suggestion - [ ] UI and JS files are fully tested, the user interface works for all modules affected by your changes (e.g., solve and analyze buttons). ```
timefold-quickstarts
github_2023
others
222
TimefoldAI
triceo
@@ -0,0 +1,27 @@ +## Description of the change + +> Description here + +## Related Issue + +Issue #ID + +## Checklist + +### Development + +- [ ] The changes have been covered with tests, if necessary. +- [ ] You have a green build, with the exception of the flaky tests. +- [ ] UI and JS files are fully tested, and the...
```suggestion - [ ] The network calls work for all modules affected by your changes (e.g., solving a problem). ```
timefold-quickstarts
github_2023
others
222
TimefoldAI
triceo
@@ -0,0 +1,27 @@ +## Description of the change + +> Description here + +## Related Issue + +Issue #ID + +## Checklist + +### Development + +- [ ] The changes have been covered with tests, if necessary. +- [ ] You have a green build, with the exception of the flaky tests. +- [ ] UI and JS files are fully tested, and the...
```suggestion - [ ] The console messages are validated for all modules affected by your changes. ```
timefold-quickstarts
github_2023
others
222
TimefoldAI
triceo
@@ -0,0 +1,27 @@ +## Description of the change + +> Description here + +## Related Issue + +Issue #ID + +## Checklist + +### Development + +- [ ] The changes have been covered with tests, if necessary. +- [ ] You have a green build, with the exception of the flaky tests. +- [ ] UI and JS files are fully tested, and the...
```suggestion - [ ] This pull request includes an explanatory title and description. ```
timefold-quickstarts
github_2023
others
222
TimefoldAI
triceo
@@ -0,0 +1,27 @@ +## Description of the change + +> Description here + +## Related Issue + +Issue #ID + +## Checklist + +### Development + +- [ ] The changes have been covered with tests, if necessary. +- [ ] You have a green build, with the exception of the flaky tests. +- [ ] UI and JS files are fully tested, and the...
I'd remove the header. Merging will happen if code review is OK.
timefold-quickstarts
github_2023
others
222
TimefoldAI
triceo
@@ -0,0 +1,27 @@ +## Description of the change + +> Description here + +## Related Issue + +Issue #ID + +## Checklist + +### Development + +- [ ] The changes have been covered with tests, if necessary. +- [ ] You have a green build, with the exception of the flaky tests. +- [ ] UI and JS files are fully tested, and the...
What do you mean by this last point?