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 | java | 353 | TimefoldAI | triceo | @@ -38,13 +38,12 @@ public class DemoDataGenerator {
// Audience tags
private static final List<String> AUDIENCE_TAGS = List.of("Programmers", "Analysts", "Managers");
// Content tags
- private static final List<String> CONTENT_TAGS =
- List.of("Timefold", "Constraints", "Metaheuristics", "... | Not very nice, is it? I recommend adding a new static method `toSet(T... items)`, which would do something like this under the hood:
var set = new LinkedHashSet<T>(items.length);
set.addAll(items);
return Collections.unmodifiableSet(set);
That way, you get reproducibility without sacrificing the rea... |
timefold-quickstarts | github_2023 | java | 344 | TimefoldAI | triceo | @@ -0,0 +1,611 @@
+package org.acme.conferencescheduling.domain;
+
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptySet;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+import ai.timefold.solver.core.api.domain.entity.PlanningEntity;
+import ai.tim... | This is an optimization which, although useful, probably doesn't need to be here.
This is a quickstart - let's not overcomplicate it.
(The original example was suffering from it a bit.) |
timefold-quickstarts | github_2023 | java | 344 | TimefoldAI | triceo | @@ -0,0 +1,208 @@
+package org.acme.conferencescheduling.rest;
+
+import java.util.Collection;
+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.DELETE;
+import jakart... | Do we intend to do anything about this TODO? |
timefold-quickstarts | github_2023 | java | 344 | TimefoldAI | triceo | @@ -0,0 +1,192 @@
+package org.acme.conferencescheduling.rest;
+
+import static java.util.Collections.emptySet;
+import static java.util.stream.Collectors.toSet;
+
+import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.... | Can we get some nice names for these tags? Themes could be "Optimization", "AI", ... Sectors could be colors. ("Green sector", "Blue sector", ...) Etc. |
timefold-quickstarts | github_2023 | java | 344 | TimefoldAI | triceo | @@ -0,0 +1,192 @@
+package org.acme.conferencescheduling.rest;
+
+import static java.util.Collections.emptySet;
+import static java.util.stream.Collectors.toSet;
+
+import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.... | Let's make this predictable. Give it a fixed seed. |
timefold-quickstarts | github_2023 | java | 344 | TimefoldAI | triceo | @@ -0,0 +1,537 @@
+package org.acme.conferencescheduling.solver;
+
+import static ai.timefold.solver.core.api.score.stream.ConstraintCollectors.compose;
+import static ai.timefold.solver.core.api.score.stream.ConstraintCollectors.countBi;
+import static ai.timefold.solver.core.api.score.stream.ConstraintCollectors.max;... | Although I understand that doing a different justification for each of these constraints would have been crazy, maybe the current granularity is lower than it ought to be?
At least `TalkTagJustification` would IMO be a good addition. |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -55,7 +55,7 @@ public Integer getPatientPreferredMaximumRoomCapacity() {
}
@JsonIgnore
- public Specialism getSpecialism() {
+ public String getSpecialism() { | I'm not sure how I feel about this. Two aspects:
- `Specialism` is a word I've never seen used anywhere else other than this quickstart. What is it supposed to mean, and can we find a better one?
- To me, `String` is not a data type. It carries no meaning, you cannot effectively use it in constraints. I consider th... |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -13,19 +15,20 @@ public class Department {
@PlanningId
private String id;
-
+ private Map<String, Integer> specialismsToPriority;
private String name;
private Integer minimumAge = null;
private Integer maximumAge = null;
-
private List<Room> rooms;
public Department() {
+ ... | Careful about `HashMap`s - if you ever iterate over them, they will introduce non-determinism in your solver. However, if you ever only `get(...)` on them, it's fine. |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -8,14 +8,14 @@ public class DepartmentSpecialism {
private String id;
private Department department;
- private Specialism specialism;
+ private String specialism;
private int priority; // AKA choice
public DepartmentSpecialism() {
}
- public DepartmentSpecialism(String id, D... | I don't understand. So we do have `DepartmentSpecialism`, but for some reason, `specialism` is still a `String` and we use it as `String` everywhere? |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -19,8 +19,8 @@ public class Patient {
private int age;
private Integer preferredMaximumRoomCapacity;
- private List<Equipment> requiredEquipments;
- private List<Equipment> preferredEquipments;
+ private List<String> requiredEquipments; | Same concerns on `Equipment` as on `Specialism`. |
timefold-quickstarts | github_2023 | others | 307 | TimefoldAI | triceo | @@ -0,0 +1,898 @@
+ARTICLE BENCHMARK DATA SET | Why is this file here, and should it be here?
No other quickstart carries its own data files. |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -0,0 +1,133 @@
+package org.acme.bedallocation.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.... | Is this ever used anywhere? I don't see it used in the constraints and if it's not in the constraints, it doesn't need to exist. |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -0,0 +1,44 @@
+package org.acme.bedallocation.domain;
+
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+import ai.timefold.solver.core.api.domain.lookup.PlanningId;
+
+@JsonIdentityInfo(scope = Specialism.class, generator = ObjectIdGenerators... | If `Specialism` is now a `String`, why does this exist? |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -0,0 +1,133 @@
+package org.acme.bedallocation.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.... | I'd prefer if we called this `BedPlan` or something like that.
`Schedule` says nothing, and it makes looking up this class among other quickstarts needlessly difficult. |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -52,7 +52,7 @@ public class DemoDataGenerator {
private final Random random = new Random(0);
/**
- * The dataset was generated based on the probability distributions found in the test dataset file overconstrained01.txt.
+ * The dataset was generated based on the probability distributions found in... | Maybe this entire comment doesn't apply anymore?
It references a file nobody will be able to find. |
timefold-quickstarts | github_2023 | java | 307 | TimefoldAI | triceo | @@ -0,0 +1,126 @@
+package org.acme.bedallocation.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.... | I'd be very careful about this pattern.
First of all - this will do some very heavy lifting every time it is called.
But more importantly, this means that every time it is called, the facts will be different instances of objects, and that will eventually lead to inefficiencies, worst case bugs.
Personally, I'd f... |
timefold-quickstarts | github_2023 | javascript | 165 | TimefoldAI | triceo | @@ -101,7 +101,7 @@ function depotPopupContent(depot, color) {
function customerPopupContent(customer) {
const arrival = customer.arrivalTime ? `<h6>Arrival at ${showTimeOnly(customer.arrivalTime)}.</h6>` : '';
return `<h5>${customer.name}</h5>
- <h6>Available from ${showTimeOnly(customer.readyTime)} to $... | ```suggestion
<h6>Available from ${showTimeOnly(customer.minStartTime)} to ${showTimeOnly(customer.maxEndTime)}.</h6>
``` |
timefold-quickstarts | github_2023 | java | 185 | TimefoldAI | triceo | @@ -9,11 +9,7 @@
import ai.timefold.solver.core.api.score.stream.Joiners;
import org.acme.schooltimetabling.domain.Lesson;
-import org.acme.schooltimetabling.solver.justifications.RoomConflictJustification;
-import org.acme.schooltimetabling.solver.justifications.StudentGroupConflictJustification;
-import org.acme.... | Please configure your IDE to not use * imports; that is a Solver convention. Enumerating imports is helpful for the JVM, as it doesn't need to load entire packages, and it is also helpful for the reviewer, to see what exactly is being used. |
timefold-quickstarts | github_2023 | java | 185 | TimefoldAI | triceo | @@ -2,9 +2,13 @@
import ai.timefold.solver.core.api.score.stream.ConstraintJustification;
+import org.acme.schooltimetabling.domain.Lesson;
import org.acme.schooltimetabling.domain.Room;
-public record RoomConflictJustification(Room room, long lessonId1, long lessonId2)
+public record RoomConflictJustification(... | As a point of consistency, we use this pattern instead:
```suggestion
this(room, lesson1, lesson2, "Room '%s' is used for lesson '%s' for student group '%s' and lesson '%s' for student group '%s' at '%s %s'".formatted(room, lesson1.getSubject(), lesson1.getStudentGroup(), lesson2.getSubject(), lesson2.getSt... |
timefold-quickstarts | github_2023 | java | 264 | TimefoldAI | zepfred | @@ -45,22 +42,21 @@ public class VehicleRouteDemoResource {
private static final LocalTime AFTERNOON_WINDOW_END = LocalTime.of(18, 0);
public enum DemoData {
- PHILADELPHIA(0, 60, 6, 2, LocalTime.of(7, 30),
+ PHILADELPHIA(0, 55, 6, LocalTime.of(7, 30), | Was the change to 55 made intentionally? |
timefold-quickstarts | github_2023 | java | 264 | TimefoldAI | zepfred | @@ -108,34 +108,34 @@ public String solve(VehicleRoutePlan problem) {
return jobId;
}
- @Operation(summary = "Request recommendations to the RecommendedFit API for a new customer.")
+ @Operation(summary = "Request recommendations to the RecommendedFit API for a new visit.")
@APIResponses(valu... | ```suggestion
.recommendFit(request.solution(), visit, v -> new VehicleRecommendation(v.getVehicle().getId(),
``` |
timefold-quickstarts | github_2023 | java | 264 | TimefoldAI | zepfred | @@ -108,34 +108,34 @@ public String solve(VehicleRoutePlan problem) {
return jobId;
}
- @Operation(summary = "Request recommendations to the RecommendedFit API for a new customer.")
+ @Operation(summary = "Request recommendations to the RecommendedFit API for a new visit.")
@APIResponses(valu... | ```suggestion
v.getVehicle().getVisits().indexOf(v)));
``` |
timefold-quickstarts | github_2023 | java | 264 | TimefoldAI | zepfred | @@ -149,11 +149,11 @@ public VehicleRoutePlan applyRecommendedFit(ApplyRecommendationRequest request)
.filter(v -> v.getId().equals(vehicleId))
.findFirst()
.orElseThrow(() -> new IllegalStateException("Vehicle %s not found".formatted(vehicleId)));
- Customer cu... | ```suggestion
.filter(v -> v.getId().equals(request.visitId()))
``` |
timefold-quickstarts | github_2023 | java | 285 | TimefoldAI | Christopher-Chianelli | @@ -46,14 +50,19 @@ class FoodPackagingConstraintProviderTest {
@Test
void dueDateTime() {
+ Line line = new Line("1", "line1", "operator A", DAY_START_TIME); | `dueDateTime` does not use `Line`:
```java
protected Constraint dueDateTime(ConstraintFactory factory) {
return factory.forEach(Job.class)
.filter(job -> job.getEndDateTime() != null && job.getDueDateTime().isBefore(job.getEndDateTime()))
.penalizeLong(HardMediumSoftLo... |
timefold-quickstarts | github_2023 | java | 285 | TimefoldAI | Christopher-Chianelli | @@ -63,14 +72,19 @@ void dueDateTime() {
@Test
void idealEndDateTime() {
+ Line line = new Line("1", "line1", "operator A", DAY_START_TIME); | Ditto:
```java
protected Constraint idealEndDateTime(ConstraintFactory factory) {
return factory.forEach(Job.class)
.filter(job -> job.getEndDateTime() != null && job.getIdealEndDateTime().isBefore(job.getEndDateTime()))
.penalizeLong(HardMediumSoftLongScore.ONE_MEDIUM,
... |
timefold-quickstarts | github_2023 | java | 227 | TimefoldAI | rsynek | @@ -22,6 +22,40 @@ public class VehicleRoutePlanResourceTest {
@Test
public void solveDemoDataUntilFeasible() {
+ VehicleRoutePlan solution = solveDemoData();
+ assertTrue(solution.getScore().isFeasible());
+ }
+
+ @Test
+ void analyze() { | Maybe split into two test methods, one of them does "shallow fetch". |
timefold-quickstarts | github_2023 | java | 227 | TimefoldAI | rsynek | @@ -22,6 +22,40 @@ public class VehicleRoutePlanResourceTest {
@Test
public void solveDemoDataUntilFeasible() {
+ VehicleRoutePlan solution = solveDemoData();
+ assertTrue(solution.getScore().isFeasible());
+ }
+
+ @Test
+ void analyze() {
+ VehicleRoutePlan solution = solveDem... | Can we at least check the difference between shallow and full result? |
timefold-quickstarts | github_2023 | javascript | 227 | TimefoldAI | rsynek | @@ -336,6 +337,116 @@ function renderTimelines(routePlan) {
}
}
+function analyze() {
+ new bootstrap.Modal("#scoreAnalysisModal").show()
+ const scoreAnalysisModalContent = $("#scoreAnalysisModalContent");
+ scoreAnalysisModalContent.children().remove();
+ if (loadedRoutePlan.score == null || loade... | Consistency: we should picked either the `function (...) { }` or `(...) => { }` syntax, but not mix both of them. |
timefold-quickstarts | github_2023 | javascript | 227 | TimefoldAI | rsynek | @@ -336,6 +337,116 @@ function renderTimelines(routePlan) {
}
}
+function analyze() {
+ new bootstrap.Modal("#scoreAnalysisModal").show()
+ const scoreAnalysisModalContent = $("#scoreAnalysisModalContent");
+ scoreAnalysisModalContent.children().remove();
+ if (loadedRoutePlan.score == null || loade... | This might possibly go into a separate function. |
timefold-quickstarts | github_2023 | javascript | 227 | TimefoldAI | rsynek | @@ -336,6 +337,116 @@ function renderTimelines(routePlan) {
}
}
+function analyze() { | Please consider breaking this long function into shorter ones to increase the readability. |
timefold-quickstarts | github_2023 | java | 227 | TimefoldAI | rsynek | @@ -179,6 +183,21 @@ public VehicleRoutePlan terminateSolving(
return getRoutePlan(jobId);
}
+ @Operation(summary = "Submit a route plan to analyze its score.")
+ @APIResponses(value = {
+ @APIResponse(responseCode = "202", | This is a synchronous call that returns immediately; wouldn't be returning 200 more appropriate?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202 |
timefold-quickstarts | github_2023 | java | 227 | TimefoldAI | rsynek | @@ -0,0 +1,15 @@
+package org.acme.vehiclerouting.solver.justifications;
+
+import ai.timefold.solver.core.api.score.stream.ConstraintJustification;
+
+import org.acme.vehiclerouting.domain.Vehicle;
+
+import java.time.Duration;
+
+public record MinimizeTravelTimeJustification(Vehicle vehicle, String description) imple... | This is how the result looks like:
"Vehicle '1' total travel time is 'PT5H44M7S'."
While the ISO duration format is nice in API, it's not so user-friendly in the UI.
Option A) format to show hours and minutes
Option B) make the record return only the vehicle (or even vehicleId) and the travel time duration; for... |
timefold-quickstarts | github_2023 | java | 227 | TimefoldAI | rsynek | @@ -0,0 +1,15 @@
+package org.acme.vehiclerouting.solver.justifications;
+
+import ai.timefold.solver.core.api.score.stream.ConstraintJustification;
+
+import java.time.Duration;
+
+public record MinimizeTravelTimeJustification(String vehicleName, long totalDrivingTimeSeconds,
+ String description) implements Co... | Nitpick: if `toSecondsPart() > 0` add one minute. |
timefold-quickstarts | github_2023 | java | 227 | TimefoldAI | triceo | @@ -0,0 +1,11 @@
+package org.acme.vehiclerouting.domain.jackson;
+
+import ai.timefold.solver.core.api.score.analysis.ScoreAnalysis;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+
+public class VRPScoreAnalysisJacksonModule extends SimpleModule { | AFAIK modules can be registered as a resource, so jackson will read them from there.
I suggest we do it like this, to show people the proper way.
See `META-INF/resources` in `timefold-solver/persistence`. |
timefold-quickstarts | github_2023 | others | 226 | TimefoldAI | zepfred | @@ -101,12 +105,13 @@ class TimeTableConstraintProvider : ConstraintProvider {
lesson1.timeslot?.endTime,
lesson2.timeslot?.startTime
)
- !between.isNegative && between.compareTo(Duration.ofMinutes(30)) <= 0
+ !between.isNegative &... | Nice! |
timefold-quickstarts | github_2023 | others | 223 | TimefoldAI | rsynek | @@ -143,6 +143,26 @@ <h5>
</div>
</div>
</div>
+ <div class="col mb-4">
+ <div class="card">
+ <div class="card-header">
+ <h5>
+ <i class="fas fa-truck"></i>
+ ... | As we no longer target a specific sub-case, I would keep the description general:
"field service technicians" -> "vehicles"
and perhaps also:
"visits" -> "customers"
as it matches the domain class name. |
timefold-quickstarts | github_2023 | others | 223 | TimefoldAI | rsynek | @@ -0,0 +1,115 @@
+= Vehicle Routing with time windows and capacity planning (Java, Quarkus, Maven)
+
+Find the most efficient routes for a fleet of vehicles.
+
+image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/screenshot/quarkus-vehicle-routing-screenshot.png[] | The image does not seem to exists (there are two separate screenshots for each VRP sub-case). Let's take a new one and then replace the existing two. |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | rsynek | @@ -0,0 +1,151 @@
+package org.acme.vehiclerouting.domain;
+
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.stream.Stream;
+
+import ai.timefold.solver.core.api.domain.solution.PlanningEntityCollectionProperty;
+import ai.timefold.solver.core.api.domain.solution.PlanningScore;
+import ai.tim... | I know this was implemented like that already before, but we could take this opportunity to fix it.
Conceptually, it's wrong: soft score should not serve as the source of driving time statistics. It works because there is only a single soft constraint. QS in a way teach users good habits and this is not an example o... |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | rsynek | @@ -0,0 +1,51 @@
+package org.acme.vehiclerouting.domain.geo;
+
+import org.acme.vehiclerouting.domain.Location;
+
+public class HaversineDistanceCalculator implements DistanceCalculator {
+
+ private static final int EARTH_RADIUS_IN_KM = 6371;
+ private static final int TWICE_EARTH_RADIUS_IN_KM = 2 * EARTH_RADIU... | I set this value very optimistically; if we spend the majority of the driving time in cities, 50 is more realistic. |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | rsynek | @@ -0,0 +1,51 @@
+package org.acme.vehiclerouting.domain.geo;
+
+import org.acme.vehiclerouting.domain.Location;
+
+public class HaversineDistanceCalculator implements DistanceCalculator {
+
+ private static final int EARTH_RADIUS_IN_KM = 6371;
+ private static final int TWICE_EARTH_RADIUS_IN_KM = 2 * EARTH_RADIU... | As we discussed the distance vs. driving time, consider moving this method outside the distance calculator to make it easier for users to switch to optimizing the distance. |
timefold-quickstarts | github_2023 | others | 223 | TimefoldAI | rsynek | @@ -0,0 +1,203 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Vehicle Routing - Timefold Quarkus</title>
+ <link rel="style... | Here we talk about a capacity...(see more below) |
timefold-quickstarts | github_2023 | others | 223 | TimefoldAI | rsynek | @@ -0,0 +1,203 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <title>Vehicle Routing - Timefold Quarkus</title>
+ <link rel="style... | ...and here about time windows.
Let's try to unify the description. |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | rsynek | @@ -0,0 +1,39 @@
+package org.acme.vehiclerouting.domain.geo;
+
+import org.acme.vehiclerouting.domain.Location;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class HaversineDistanceCalculatorTest {
+
+ private final DistanceCalculator distanceCalculator = new HaversineDistanceCalcu... | What is the motivation for this additional test? |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | rsynek | @@ -0,0 +1,48 @@
+package org.acme.vehiclerouting.domain.geo;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import org.acme.vehiclerouting.domain.Location;
+
+public interface DistanceCalculator {
+
+ /**
+ * Calculate the dist... | The `Location` uses seconds, so here, in this method, we already decide it's seconds and not meters.
What if we did this initialization in the `VehicleRoutePlan` and left the `DistanceCalculator` to only calculate distance? |
timefold-quickstarts | github_2023 | others | 223 | TimefoldAI | triceo | @@ -136,6 +137,14 @@ image::build/quickstarts-showcase/src/main/resources/META-INF/resources/screensh
* link:use-cases/vehicle-routing-time-windows/README.adoc[Run quarkus-vehicle-routing-time-windows] (Java, Maven, Quarkus)
+=== Vehicle Routing with capacity and time windows | I'd call this just "Vehicle routing". |
timefold-quickstarts | github_2023 | others | 223 | TimefoldAI | triceo | @@ -136,6 +137,14 @@ image::build/quickstarts-showcase/src/main/resources/META-INF/resources/screensh
* link:use-cases/vehicle-routing-time-windows/README.adoc[Run quarkus-vehicle-routing-time-windows] (Java, Maven, Quarkus)
+=== Vehicle Routing with capacity and time windows
+
+Find the most efficient routes for ... | ```suggestion
Find the most efficient routes for vehicles to reach customers, taking into account vehicle capacity and time windows when customers are available. Sometimes also called "CVRPTW".
``` |
timefold-quickstarts | github_2023 | others | 223 | TimefoldAI | triceo | @@ -143,6 +143,26 @@ <h5>
</div>
</div>
</div>
+ <div class="col mb-4">
+ <div class="card">
+ <div class="card-header">
+ <h5>
+ <i class="fas fa-truck"></i>
+ ... | See suggested phrasing above. |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | triceo | @@ -0,0 +1,31 @@
+package org.acme.vehiclerouting.domain;
+
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonIdentityInfo(scope = Depot.class, generator = ObjectIdGenerators.PropertyGene... | I'm wondering... why not `record`? |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | triceo | @@ -0,0 +1,56 @@
+package org.acme.vehiclerouting.domain.geo;
+
+import org.acme.vehiclerouting.domain.Location;
+
+/**
+ * Calculates the driving time (in seconds) between two locations by calculating their Haversine distance in meters
+ * assuming average speed {@link #AVERAGE_SPEED_KMPH}.
+ */
+public class Haversin... | Since this class has no instance fields, maybe we make it a singleton? |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | triceo | @@ -0,0 +1,225 @@
+package org.acme.vehiclerouting.rest;
+
+import java.time.Duration;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.List;
+import java.util.PrimitiveIterator;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import... | The length of this line suggests to me that your IDE is not configured properly.
(Quickstarts don't have automated formatting via Maven plugin.) |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | triceo | @@ -0,0 +1,225 @@
+package org.acme.vehiclerouting.rest;
+
+import java.time.Duration;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.List;
+import java.util.PrimitiveIterator;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import... | I'm thinking... `var`? The methoud could arguably use it, but maybe for consistency with the rest of the code, we don't? |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | triceo | @@ -0,0 +1,225 @@
+package org.acme.vehiclerouting.rest;
+
+import java.time.Duration;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.List;
+import java.util.PrimitiveIterator;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+import... | For readability, we've lately been moving towards the `"maxDemand (%s) ...".formatted(maxDemand)` pattern. |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | triceo | @@ -0,0 +1,25 @@
+package org.acme.vehiclerouting.domain.geo;
+
+import org.acme.vehiclerouting.domain.Location;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class HaversineDrivingTimeCalculatorTest {
+
+ private final DrivingTimeCalculator drivingTimeCalculator = new HaversineDriv... | Lovely! |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | rsynek | @@ -0,0 +1,161 @@
+package org.acme.vehiclerouting.domain;
+
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.stream.Stream;
+
+import ai.timefold.solver.core.api.domain.solution.PlanningEntityCollectionProperty;
+import ai.timefold.solver.core.api.domain.solution.PlanningScore;
+import ai.tim... | I would even add one more sentence to explain that optimizing travel time optimizes the distance too, as a side effect, but in case there is a faster route, the travel time takes precedence (highway vs. some local road). |
timefold-quickstarts | github_2023 | java | 223 | TimefoldAI | triceo | @@ -174,8 +215,9 @@ public VehicleRoutePlan build(DemoData demoData) {
.limit(demoData.customerCount)
.collect(Collectors.toList());
- return new VehicleRoutePlan(name, demoData.southWestCorner, demoData.northEastCorner, tomorrowAt(demoData.vehicleStartTime), tomorrowAt(LocalT... | I think your formatting is still wrong; in this case, lines 219 and 220 should be indented, not aligned to the first argument on line 218. |
timefold-quickstarts | github_2023 | others | 139 | TimefoldAI | triceo | @@ -0,0 +1,641 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# School timetabling kotlin notebook\n",
+ "\n",
+ "This Kotlin Notebook solves the school timetabling problem with [Timefold](https://timefold.ai], the open source planning solver AI.\n",
+ "\n",
+ " {
ingredientMap.put(new Product(productId++, ingredient + " and " + ingredientB + " " + PRODUCT_VARIATION_LIST.get(2)), Set.of(ingredient, ingredientB));
ingredientMap.put(new Product(productId++, ingredient ... | ```suggestion
List<Product> products = new ArrayList<>(ingredientMap.keySet());
``` |
timefold-quickstarts | github_2023 | others | 184 | TimefoldAI | triceo | @@ -18,25 +17,25 @@ repositories {
}
dependencies {
+ implementation platform("ai.timefold.solver:timefold-solver-bom:${timefoldVersion}")
+
implementation "org.springframework.boot:spring-boot-starter-web"
- implementation "org.springframework.boot:spring-boot-starter-data-rest"
- implementation "org... | If you're upgrading versions of these components, please do it consistently with the other School Timetabling quickstart. We want them to be truly identical, except for the places where they can not be for obvious reasons.
(Please remember to test the quickstart's UI after modifying these dependency versions.)
In gen... |
timefold-quickstarts | github_2023 | others | 193 | TimefoldAI | triceo | @@ -143,7 +142,24 @@ Many examples in desktop technology.
image::build/quickstarts-showcase/src/main/resources/META-INF/resources/screenshot/timefold-solver-examples-screenshot.png[]
-* https://timefold.ai[Download]
+[[run]]
+== Run the application | The section is H3, so shouldn't this be H4?
```suggestion
==== Run the application
```
|
timefold-quickstarts | github_2023 | others | 194 | TimefoldAI | triceo | @@ -4,9 +4,10 @@ plugins {
}
def timefoldVersion = "999-SNAPSHOT"
-def logbackVersion = "1.4.11"
-def junitJupiterVersion = "5.10.0"
+def logbackVersion = "1.4.14"
+def junitJupiterVersion = "5.10.1"
def assertjVersion = "3.24.2"
+def jacksonAnnotationVersion = "2.15.3" | ```suggestion
``` |
timefold-quickstarts | github_2023 | others | 186 | TimefoldAI | triceo | @@ -9,16 +9,18 @@ import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSoftScore
import ai.timefold.solver.core.api.solver.SolverStatus
@PlanningSolution
-class TimeTable {
+class Timetable { | Nice detail, well spotted. |
timefold-quickstarts | github_2023 | others | 186 | TimefoldAI | triceo | @@ -0,0 +1,447 @@
+package org.acme.kotlin.schooltimetabling.rest
+
+import jakarta.ws.rs.GET
+import jakarta.ws.rs.Path
+import jakarta.ws.rs.PathParam
+import jakarta.ws.rs.core.MediaType
+import jakarta.ws.rs.core.Response
+import org.acme.kotlin.schooltimetabling.domain.Lesson
+import org.acme.kotlin.schooltimetabl... | This is very verbose. Some later calls take even 5 lines.
Maybe by static importing `DayOfWeek` values, we can get this to fit on one line? |
timefold-quickstarts | github_2023 | others | 186 | TimefoldAI | triceo | @@ -0,0 +1,255 @@
+package org.acme.kotlin.schooltimetabling.rest
+
+import ai.timefold.solver.core.api.score.analysis.ScoreAnalysis
+import ai.timefold.solver.core.api.score.buildin.hardsoft.HardSoftScore
+import ai.timefold.solver.core.api.solver.ScoreAnalysisFetchPolicy
+import ai.timefold.solver.core.api.solver.Sol... | Please configure your IDE to never use `*` imports.
(One of our little rules; makes reviews easier, and creates less classloading work for the JVM.) |
timefold-quickstarts | github_2023 | others | 186 | TimefoldAI | triceo | @@ -48,6 +56,13 @@ class TimeTableConstraintProvider : ConstraintProvider {
Joiners.equal(Lesson::teacher)
)
.penalize(HardSoftScore.ONE_HARD)
+ .justifyWith({ lesson1: Lesson, lesson2: Lesson?, score: HardSoftScore? ->
+ TeacherConflictJustification(... | In the interest of brevity, I'd put this on one line. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -12,9 +12,12 @@
public class TimeTableConstraintProvider implements ConstraintProvider {
+ private static final int MAX_GAP_MINUTES = 30;
+
+ //TODO --> tool detected this as long statement, it is technically not : FP | Please remove the comment. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -70,21 +73,23 @@ Constraint teacherRoomStability(ConstraintFactory constraintFactory) {
.asConstraint("Teacher room stability");
}
- Constraint teacherTimeEfficiency(ConstraintFactory constraintFactory) {
- // A teacher prefers to teach sequential lessons and dislikes gaps between l... | Please remove the comment. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -70,21 +73,23 @@ Constraint teacherRoomStability(ConstraintFactory constraintFactory) {
.asConstraint("Teacher room stability");
}
- Constraint teacherTimeEfficiency(ConstraintFactory constraintFactory) {
- // A teacher prefers to teach sequential lessons and dislikes gaps between l... | Please remove the comment. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -31,6 +31,7 @@ public class MaintenanceSchedule {
// Ignored by Timefold, used by the UI to display solve or stop solving button
private SolverStatus solverStatus;
+ //TODO --> Never used Constructor. | Please remove the comment. The constructor is required for Timefold to function, even though it seems unused. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -42,16 +43,17 @@ public MaintenanceSchedule(WorkCalendar workCalendar,
this.jobList = jobList;
}
- @ValueRangeProvider
- public List<LocalDate> createStartDateList() {
- return workCalendar.getFromDate().datesUntil(workCalendar.getToDate())
- // Skip weekends. Does not wor... | Why was this removed? I do not see it being replaced by anything. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -35,14 +35,14 @@ public enum DemoData {
FIRENZE(77, 6, 2, 1, 2, 25,
new Location(43.751466, 11.177210), new Location(43.809291, 11.290195));
- private int customerCount;
- private int vehicleCount;
- private int depotCount;
- private int minDemand;
- pri... | Please use `private final`, not `final private`. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -48,41 +48,24 @@ public enum DemoData {
PHILADELPHIA(60, 6, 2, LocalTime.of(7, 30),
new Location(39.7656099067391, -76.83782328143754),
new Location(40.77636644354855, -74.9300739430771)),
- HARTFORT(50, 6, 2, LocalTime.of(7, 30),
+ HARTFORD(50, 6, 2, LocalTim... | Please remove the comment. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -16,6 +16,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.data.domain.Sort;
+// TODO --> unutilised abstraction --> main file : FP | Please remove the comment. |
timefold-quickstarts | github_2023 | java | 170 | TimefoldAI | triceo | @@ -11,6 +11,7 @@
@Transactional
public class TimeTableRepository {
+ // TODO --> SINGLETON_TIME_TABLE_ID is public : deficient encapsulation --> TP | Please remove the comment. |
timefold-quickstarts | github_2023 | others | 177 | TimefoldAI | triceo | @@ -2,7 +2,7 @@
Find the most efficient routes for a fleet of vehicles.
-image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/screenshot/quarkus-vehicle-routing-screenshot.png[]
+image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/screenshot/quarkus-vehicle-routin... | ```suggestion
image::../../build/quickstarts-showcase/src/main/resources/META-INF/resources/screenshot/quarkus-vehicle-routing-time-windows-screenshot.png[]
``` |
timefold-quickstarts | github_2023 | java | 142 | TimefoldAI | rsynek | @@ -55,4 +66,79 @@ public void solveDemoDataUntilFeasible() {
assertNotNull(solution.getLessons().get(0).getTimeslot());
assertTrue(solution.getScore().isFeasible());
}
+
+ @Test
+ public void analyze() {
+ Timetable testTimetable = given()
+ .when().get("/demo-data/SM... | Since the test operates on the client side, we don't need these classes.
```suggestion
``` |
timefold-quickstarts | github_2023 | javascript | 142 | TimefoldAI | rsynek | @@ -218,6 +222,36 @@ function solve() {
"text");
}
+function analyze() {
+ new bootstrap.Modal("#scoreAnalysisModal").show() | Consider more friendly message in case the data set has not been solved yet. As of now, the message starts with "{"details":"Error id c9e674b0-daca-4829-8db8-326753a24402-2, org.jboss.resteasy.spi.UnhandledException ..." and only later, if one reads carefully, they learn what the root cause is.
For unexpected excep... |
timefold-quickstarts | github_2023 | others | 113 | TimefoldAI | rsynek | @@ -87,30 +64,17 @@ jobs:
git merge -s ours --no-edit ${{ github.event.inputs.stableBranch }}
git checkout ${{ github.event.inputs.releaseBranch }}-bump
git merge --squash ${{ github.event.inputs.releaseBranch }}
- git commit -m "chore: release version ${{ github.event.inputs.v... | ```suggestion
- name: Put back the 999-SNAPSHOT version on the release branch
``` |
timefold-quickstarts | github_2023 | others | 94 | TimefoldAI | rsynek | @@ -1,5 +1,4 @@
-/target
-/local | Any idea where does the /local come from? |
timefold-quickstarts | github_2023 | java | 53 | TimefoldAI | triceo | @@ -52,71 +62,129 @@ public VehicleRoutePlanResource(SolverManager<VehicleRoutePlan, String> solverMa
this.solutionManager = solutionManager;
}
+ @Operation(summary = "List the job IDs of all submitted route plans.")
+ @APIResponses(value = {
+ @APIResponse(responseCode = "200", descrip... | You could declare constructors that do the same thing. |
timefold-quickstarts | github_2023 | java | 53 | TimefoldAI | triceo | @@ -52,71 +62,129 @@ public VehicleRoutePlanResource(SolverManager<VehicleRoutePlan, String> solverMa
this.solutionManager = solutionManager;
}
+ @Operation(summary = "List the job IDs of all submitted route plans.")
+ @APIResponses(value = {
+ @APIResponse(responseCode = "200", descrip... | This has inefficiency built into it. The input is a set, the output is a list. Also, it is self-inflicted - nobody is forcing us to return a list. If this has to run in a web app which is exposed to some actual load, this will kill that web app.
And on top of that, it's done via a stream, which will do this ineffici... |
timefold-quickstarts | github_2023 | java | 53 | TimefoldAI | triceo | @@ -102,23 +103,45 @@ public String solve(Timetable problem) {
@Produces(MediaType.APPLICATION_JSON)
@Path("{jobId}")
public Timetable getTimeTable(
- @Parameter(description = "The job ID returned by the POST method.") @PathParam("jobId") String jobId,
- @QueryParam("retrieve") Retr... | This is a massive obfuscation of *quickstart* code. I wouldn't add these. |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,28 @@
+package org.acme.vehiclerouting.domain;
+
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.JsonIdentityReference;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+
+@JsonIdentityInfo(... | Does @JsonIdentityReference do anything? The Location is serialized as a json array |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,72 @@
+package org.acme.vehiclerouting.domain;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonFormat(shape... | Is the comment still valid? atan2 smells like haversine, but comment says euclidean distance |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,170 @@
+package org.acme.vehiclerouting.domain;
+
+import java.util.List;
+import java.util.stream.Stream;
+
+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.solu... | this can be a local field in the constructor, no need for a global field |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,45 @@
+package org.acme.vehiclerouting.domain.geo;
+
+import org.acme.vehiclerouting.domain.Location;
+
+public class HaversineDistanceCalculator implements DistanceCalculator {
+
+ private static final int EARTH_RADIUS_IN_KM = 6371;
+ private static final int TWICE_EARTH_RADIUS_IN_KM = 2 * EARTH_RADIU... | If it overwrite the bulk method, it can do the locationToCartesian once for every location, instead of doing it n times for n locations. With 10k locations, I believe this could make a noticable difference. We should measure don't guess. |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,42 @@
+package org.acme.vehiclerouting.solver;
+
+import org.acme.vehiclerouting.domain.Customer;
+import org.acme.vehiclerouting.domain.Vehicle;
+import ai.timefold.solver.core.api.score.buildin.hardsoftlong.HardSoftLongScore;
+import ai.timefold.solver.core.api.score.stream.Constraint;
+import ai.timefold.... | nitpick: order method calls same order a method declarations (hard before soft) |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,42 @@
+package org.acme.vehiclerouting.solver;
+
+import org.acme.vehiclerouting.domain.Customer;
+import org.acme.vehiclerouting.domain.Vehicle;
+import ai.timefold.solver.core.api.score.buildin.hardsoftlong.HardSoftLongScore;
+import ai.timefold.solver.core.api.score.stream.Constraint;
+import ai.timefold.... | constraint name vs method name:
- distanceFromPreviousStandstill
- totalDistance
I'd argue neither, maybe: minimizeTravelTime? |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,185 @@
+package org.acme.vehiclerouting.domain;
+
+import java.time.Duration;
+import java.time.LocalDateTime;
+
+import ai.timefold.solver.core.api.domain.entity.PlanningEntity;
+import ai.timefold.solver.core.api.domain.variable.InverseRelationShadowVariable;
+import ai.timefold.solver.core.api.domain.vari... | We want to standarize on String id's for all classes that have one in the quickstarts.
Motivation: much more user friendly if you curl in your own json dataset |
timefold-quickstarts | github_2023 | java | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,55 @@
+package org.acme.vehiclerouting.domain;
+
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonFormat(shape... | It's not clear that the Long of drivingTime is in seconds.
Proposal A) Add a javadoc on this field that it's in seconds
Proposal B) change field name to drivingTimeInSecondsMap
Proposal C) change Long to Duration.
Which of these are clear in the Swagger open API? |
timefold-quickstarts | github_2023 | others | 35 | TimefoldAI | ge0ffrey | @@ -0,0 +1,36 @@
+########################
+# 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 native... | (code style) Not consistent with the other quickstarts: those use white lines to make it a bit more readable |
timefold-quickstarts | github_2023 | others | 43 | TimefoldAI | rsynek | @@ -48,6 +48,11 @@ jobs:
distribution: 'temurin'
cache: 'maven'
+ - name: Set up Maven
+ uses: stCarolas/setup-maven@v4.5
+ with:
+ maven-version: 3.9.3 | Is the maintenance cost (upgrading the maven version over all the release yaml files) worth the MAVEN_ARGS support?
Alternative: use just any env var ( that does not clash with any other ) and use its value in the maven command. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.