fix(javaTest): preserve historical arrival timing
This commit is contained in:
@@ -54,6 +54,8 @@ public final class HistoricalDispatchSimulationReportWriter {
|
||||
.filter(cell -> cell.getValue() == 1 || cell.getValue() == 2).count());
|
||||
value.put("fullMapSha256", dataset.getFullMapSha256());
|
||||
value.put("plannerVersion", "GridPathPlanner-BFS/full-grid-v1");
|
||||
value.put("arrivalTimingPolicy",
|
||||
"create_date-relative-gap/acceleration-no-truncation");
|
||||
value.put("pathInfoUsedForPlanning", false);
|
||||
value.put("inputCount", result.getTaskResults().size());
|
||||
value.put("acceleration", result.getAcceleration());
|
||||
|
||||
@@ -100,8 +100,10 @@ public final class HistoricalDispatchSimulator {
|
||||
events, traversedEdges);
|
||||
verifyLedger(ledger, invariants);
|
||||
|
||||
boolean awaitingFutureArrival = active.isEmpty() && clearanceMoves.isEmpty()
|
||||
&& queue.readyAt(now).isEmpty();
|
||||
if (watchdog.observe(terminal.size(),
|
||||
businessProgress || clearanceProgress.moved,
|
||||
businessProgress || clearanceProgress.moved || awaitingFutureArrival,
|
||||
clearanceProgress.completed)) {
|
||||
invariants.deadlock();
|
||||
throw new IllegalStateException("simulation made no physical progress at tick "
|
||||
@@ -349,7 +351,7 @@ public final class HistoricalDispatchSimulator {
|
||||
reservations, events);
|
||||
continue;
|
||||
}
|
||||
Instant decisionTime = Instant.EPOCH.plusMillis(now + tick);
|
||||
Instant decisionTime = Instant.EPOCH.plusMillis(now);
|
||||
TrafficVehicleSnapshot frozen = new TrafficVehicleSnapshot(vehicleId,
|
||||
Long.toString(vehicle.getBootId()), tick + 1, tick + 1,
|
||||
decisionTime, from, to,
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class SimulationClock {
|
||||
private static final long MAX_SOURCE_GAP_MILLIS = 30L * 60L * 1000L;
|
||||
private final int acceleration;
|
||||
private final Map<LocalDateTime, Long> arrivals;
|
||||
|
||||
@@ -33,7 +32,7 @@ public final class SimulationClock {
|
||||
for (LocalDateTime arrival : ordered) {
|
||||
if (previous != null) {
|
||||
long sourceGap = Duration.between(previous, arrival).toMillis();
|
||||
simulationMillis += Math.min(sourceGap, MAX_SOURCE_GAP_MILLIS) / acceleration;
|
||||
simulationMillis += sourceGap / acceleration;
|
||||
}
|
||||
converted.put(arrival, simulationMillis);
|
||||
previous = arrival;
|
||||
|
||||
Reference in New Issue
Block a user