diff --git a/.github/workflows/full-integration.yaml b/.github/workflows/full-integration.yaml index 57789d54a8c..c831df5ec61 100644 --- a/.github/workflows/full-integration.yaml +++ b/.github/workflows/full-integration.yaml @@ -1,6 +1,7 @@ name: full-integration on: + workflow_dispatch: schedule: - cron: '30 0 * * *' # daily at 0:30 UTC @@ -13,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Prepare git diff --git a/contribs/accessibility/pom.xml b/contribs/accessibility/pom.xml index 300f8fb1bd1..45d1f56723b 100644 --- a/contribs/accessibility/pom.xml +++ b/contribs/accessibility/pom.xml @@ -52,7 +52,7 @@ org.openstreetmap.osmosis osmosis-core - 0.48.3 + ${osmosis.version} @@ -65,7 +65,7 @@ org.openstreetmap.osmosis osmosis-xml - 0.48.3 + ${osmosis.version} org.matsim.contrib diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/scheduler/EmptyVehicleChargingScheduler.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/scheduler/EmptyVehicleChargingScheduler.java index f50d437a1a0..eea29745e80 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/scheduler/EmptyVehicleChargingScheduler.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/scheduler/EmptyVehicleChargingScheduler.java @@ -21,20 +21,23 @@ import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; +import org.matsim.contrib.drt.extension.edrt.schedule.EDrtTaskFactoryImpl; import org.matsim.contrib.drt.schedule.DrtStayTask; import org.matsim.contrib.drt.schedule.DrtTaskFactory; import org.matsim.contrib.dvrp.fleet.DvrpVehicle; import org.matsim.contrib.dvrp.schedule.Schedule; -import org.matsim.contrib.drt.extension.edrt.schedule.EDrtTaskFactoryImpl; import org.matsim.contrib.ev.charging.ChargingStrategy; import org.matsim.contrib.ev.charging.ChargingWithAssignmentLogic; -import org.matsim.contrib.evrp.EvDvrpVehicle; import org.matsim.contrib.ev.fleet.ElectricVehicle; import org.matsim.contrib.ev.infrastructure.Charger; import org.matsim.contrib.ev.infrastructure.ChargingInfrastructure; +import org.matsim.contrib.evrp.EvDvrpVehicle; import org.matsim.core.mobsim.framework.MobsimTimer; +import java.util.Comparator; +import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -43,23 +46,27 @@ public class EmptyVehicleChargingScheduler { private final MobsimTimer timer; private final EDrtTaskFactoryImpl taskFactory; - private final Map, Charger> linkToChargerMap; + private final Map, List> linkToChargersMap; public EmptyVehicleChargingScheduler(MobsimTimer timer, DrtTaskFactory taskFactory, ChargingInfrastructure chargingInfrastructure) { this.timer = timer; this.taskFactory = (EDrtTaskFactoryImpl)taskFactory; - linkToChargerMap = chargingInfrastructure.getChargers() + linkToChargersMap = chargingInfrastructure.getChargers() .values() .stream() - .collect(Collectors.toMap(c -> c.getLink().getId(), c -> c)); + .collect(Collectors.groupingBy(c -> c.getLink().getId())); } public void chargeVehicle(DvrpVehicle vehicle) { DrtStayTask currentTask = (DrtStayTask)vehicle.getSchedule().getCurrentTask(); Link currentLink = currentTask.getLink(); - Charger charger = linkToChargerMap.get(currentLink.getId()); - if (charger != null) { + List chargers = linkToChargersMap.get(currentLink.getId()); + if (chargers != null) { + Optional freeCharger = chargers.stream().filter(c -> c.getLogic().getPluggedVehicles().isEmpty()).findFirst(); + + // Empty charger or at least smallest queue charger + Charger charger = freeCharger.orElseGet(() -> chargers.stream().min(Comparator.comparingInt(e -> e.getLogic().getQueuedVehicles().size())).orElseThrow()); ElectricVehicle ev = ((EvDvrpVehicle)vehicle).getElectricVehicle(); if (!charger.getLogic().getChargingStrategy().isChargingCompleted(ev)) { chargeVehicleImpl(vehicle, charger); @@ -67,6 +74,8 @@ public void chargeVehicle(DvrpVehicle vehicle) { } } + + private void chargeVehicleImpl(DvrpVehicle vehicle, Charger charger) { Schedule schedule = vehicle.getSchedule(); DrtStayTask stayTask = (DrtStayTask)schedule.getCurrentTask(); diff --git a/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/FreeSpeedTravelTimeMatrix.java b/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/FreeSpeedTravelTimeMatrix.java index 6ee572bb03f..0adab8701df 100644 --- a/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/FreeSpeedTravelTimeMatrix.java +++ b/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/FreeSpeedTravelTimeMatrix.java @@ -33,7 +33,7 @@ */ public class FreeSpeedTravelTimeMatrix implements TravelTimeMatrix { public static FreeSpeedTravelTimeMatrix createFreeSpeedMatrix(Network dvrpNetwork, DvrpTravelTimeMatrixParams params, int numberOfThreads, - double qSimTimeStepSize) { + double qSimTimeStepSize) { return new FreeSpeedTravelTimeMatrix(dvrpNetwork, params, numberOfThreads, new QSimFreeSpeedTravelTime(qSimTimeStepSize)); } @@ -48,7 +48,7 @@ public FreeSpeedTravelTimeMatrix(Network dvrpNetwork, DvrpTravelTimeMatrixParams var routingParams = new TravelTimeMatrices.RoutingParams(dvrpNetwork, travelTime, travelDisutility, numberOfThreads); freeSpeedTravelTimeMatrix = TravelTimeMatrices.calculateTravelTimeMatrix(routingParams, centralNodes, 0); freeSpeedTravelTimeSparseMatrix = TravelTimeMatrices.calculateTravelTimeSparseMatrix(routingParams, params.maxNeighborDistance, - params.maxNeighborTravelTime, 0); + params.maxNeighborTravelTime, 0).orElse(null); } @Override @@ -56,9 +56,11 @@ public int getTravelTime(Node fromNode, Node toNode, double departureTime) { if (fromNode == toNode) { return 0; } - int time = freeSpeedTravelTimeSparseMatrix.get(fromNode, toNode); - if (time >= 0) {// value is present - return time; + if (freeSpeedTravelTimeSparseMatrix != null) { + int time = freeSpeedTravelTimeSparseMatrix.get(fromNode, toNode); + if (time >= 0) {// value is present + return time; + } } return freeSpeedTravelTimeMatrix.get(gridSystem.getZone(fromNode), gridSystem.getZone(toNode)); } diff --git a/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/TravelTimeMatrices.java b/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/TravelTimeMatrices.java index 792140c173d..dcea254ac6c 100644 --- a/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/TravelTimeMatrices.java +++ b/contribs/dvrp/src/main/java/org/matsim/contrib/zone/skims/TravelTimeMatrices.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.IntStream; import org.matsim.api.core.v01.network.Network; @@ -56,7 +57,7 @@ public static Matrix calculateTravelTimeMatrix(RoutingParams params, Map centralNodes, double departureTime, Matrix travelTimeMatrix, - LeastCostPathTree lcpTree) { + LeastCostPathTree lcpTree) { Node fromNode = centralNodes.get(fromZone); lcpTree.calculate(fromNode.getId().index(), departureTime, null, null); @@ -65,26 +66,31 @@ private static void computeForDepartureZone(Zone fromZone, Map centr int nodeIndex = toNode.getId().index(); OptionalTime currOptionalTime = lcpTree.getTime(nodeIndex); double currTime = currOptionalTime.orElseThrow(() -> new RuntimeException( - "Undefined Time. Reason could be that the dvrp network is not fully connected. Please check and/or clean.")); + "Undefined Time. Reason could be that the dvrp network is not fully connected. Please check and/or clean.")); double tt = currTime - departureTime; travelTimeMatrix.set(fromZone, toZone, tt); } } - public static SparseMatrix calculateTravelTimeSparseMatrix(RoutingParams params, double maxDistance, double maxTravelTime, double departureTime) { + public static Optional calculateTravelTimeSparseMatrix(RoutingParams params, double maxDistance, double maxTravelTime, + double departureTime) { SparseMatrix travelTimeMatrix = new SparseMatrix(); + if (maxDistance == 0 && maxTravelTime == 0) { + return Optional.empty(); + } + var nodes = params.routingNetwork.getNodes().values(); var counter = "DVRP free-speed TT sparse matrix: node "; Calculation calculation = (lcpTree, n) -> computeForDepartureNode(n, nodes, departureTime, travelTimeMatrix, lcpTree, maxDistance, - maxTravelTime); + maxTravelTime); calculate(params, nodes, calculation, counter); - return travelTimeMatrix; + return Optional.of(travelTimeMatrix); } private static void computeForDepartureNode(Node fromNode, Collection nodes, double departureTime, SparseMatrix sparseMatrix, - LeastCostPathTree lcpTree, double maxDistance, double maxTravelTime) { + LeastCostPathTree lcpTree, double maxDistance, double maxTravelTime) { lcpTree.calculate(fromNode.getId().index(), departureTime, null, null, - (nodeIndex, arrivalTime, travelCost, distance, departTime) -> distance >= maxDistance && arrivalTime >= departTime + maxTravelTime); + (nodeIndex, arrivalTime, travelCost, distance, departTime) -> distance >= maxDistance && arrivalTime >= departTime + maxTravelTime); List neighborNodes = new ArrayList<>(); for (Node toNode : nodes) { @@ -109,8 +115,8 @@ private interface Calculation { private static void calculate(RoutingParams params, Collection elements, Calculation calculation, String counterPrefix) { var trees = IntStream.range(0, params.numberOfThreads) - .mapToObj(i -> new LeastCostPathTree(new SpeedyGraph(params.routingNetwork), params.travelTime, params.travelDisutility)) - .toList(); + .mapToObj(i -> new LeastCostPathTree(new SpeedyGraph(params.routingNetwork), params.travelTime, params.travelDisutility)) + .toList(); var executorService = new ExecutorServiceWithResource<>(trees); var counter = new Counter(counterPrefix, " / " + elements.size()); diff --git a/contribs/dvrp/src/test/java/org/matsim/contrib/zone/skims/TravelTimeMatricesTest.java b/contribs/dvrp/src/test/java/org/matsim/contrib/zone/skims/TravelTimeMatricesTest.java index 380ab35182c..d60f34f7fa2 100644 --- a/contribs/dvrp/src/test/java/org/matsim/contrib/zone/skims/TravelTimeMatricesTest.java +++ b/contribs/dvrp/src/test/java/org/matsim/contrib/zone/skims/TravelTimeMatricesTest.java @@ -69,7 +69,7 @@ public void travelTimeSparseMatrix_maxDistance() { NetworkUtils.createAndAddLink(network, Id.createLinkId("CA"), nodeC, nodeA, 600, 15, 80, 1); double maxDistance = 300;// B->A->C and C->A->B are pruned by the limit - var matrix = TravelTimeMatrices.calculateTravelTimeSparseMatrix(routingParams(network), maxDistance, 0, 0); + var matrix = TravelTimeMatrices.calculateTravelTimeSparseMatrix(routingParams(network), maxDistance, 0, 0).orElseThrow(); assertThat(matrix.get(nodeA, nodeA)).isEqualTo(0); assertThat(matrix.get(nodeA, nodeB)).isEqualTo(10); @@ -97,7 +97,7 @@ public void travelTimeSparseMatrix_maxTravelTime() { // 20 s (max TT) corresponds to 300 m (max distance) in another test (see: travelTimeSparseMatrix_maxDistance()) double maxTravelTime = 20;// B->A->C and C->A->B are pruned by the limit - var matrix = TravelTimeMatrices.calculateTravelTimeSparseMatrix(routingParams(network), 0, maxTravelTime, 0); + var matrix = TravelTimeMatrices.calculateTravelTimeSparseMatrix(routingParams(network), 0, maxTravelTime, 0).orElseThrow(); assertThat(matrix.get(nodeA, nodeA)).isEqualTo(0); assertThat(matrix.get(nodeA, nodeB)).isEqualTo(10); diff --git a/contribs/hybridsim/pom.xml b/contribs/hybridsim/pom.xml index fe40487e7f4..6755af32f20 100644 --- a/contribs/hybridsim/pom.xml +++ b/contribs/hybridsim/pom.xml @@ -10,7 +10,7 @@ hybridsim - 3.24.4 + 3.25.0 1.59.0 diff --git a/contribs/minibus/src/test/java/org/matsim/contrib/minibus/integration/SubsidyTestIT.java b/contribs/minibus/src/test/java/org/matsim/contrib/minibus/integration/SubsidyTestIT.java index 07089958ca3..5b84b9f964c 100644 --- a/contribs/minibus/src/test/java/org/matsim/contrib/minibus/integration/SubsidyTestIT.java +++ b/contribs/minibus/src/test/java/org/matsim/contrib/minibus/integration/SubsidyTestIT.java @@ -105,8 +105,7 @@ public final void testSubsidyPControler() { // Check final iteration String actual = this.pStatsResults.get(2)[9]; // flaky (non-deterministic) test... allow multiple results - Assert.assertTrue("Number of budget (final iteration)", - List.of("174413625.6239444000", "174413625.7708889500", "174413625.7022777500").contains(actual)); + Assert.assertEquals("Number of budget (final iteration)", 174413625.6, Double.parseDouble(actual), 1); } @Override diff --git a/contribs/noise/pom.xml b/contribs/noise/pom.xml index 7eca456ed00..159b9e8947f 100644 --- a/contribs/noise/pom.xml +++ b/contribs/noise/pom.xml @@ -40,9 +40,9 @@ compile - org.openstreetmap.osmosis - osmosis-xml - 0.48.3 + org.openstreetmap.osmosis + osmosis-core + ${osmosis.version} @@ -51,6 +51,11 @@ xml-apis + + + org.openstreetmap.osmosis + osmosis-xml + ${osmosis.version} diff --git a/contribs/protobuf/pom.xml b/contribs/protobuf/pom.xml index 56b7e7b9e14..bf18c765bd6 100644 --- a/contribs/protobuf/pom.xml +++ b/contribs/protobuf/pom.xml @@ -11,7 +11,7 @@ protobuf - 3.24.4 + 3.25.0 diff --git a/contribs/vsp/pom.xml b/contribs/vsp/pom.xml index 99614d63e78..24b6b3e7b77 100644 --- a/contribs/vsp/pom.xml +++ b/contribs/vsp/pom.xml @@ -102,7 +102,7 @@ org.openstreetmap.osmosis osmosis-core - 0.48.3 + ${osmosis.version} @@ -115,22 +115,22 @@ org.openstreetmap.osmosis osmosis-xml - 0.48.3 + ${osmosis.version} org.openstreetmap.osmosis osmosis-tagfilter - 0.48.3 + ${osmosis.version} org.openstreetmap.osmosis osmosis-set - 0.48.3 + ${osmosis.version} org.openstreetmap.osmosis osmosis-areafilter - 0.48.3 + ${osmosis.version} org.matsim.contrib diff --git a/matsim/pom.xml b/matsim/pom.xml index 2b90c846d23..915d802b4ec 100644 --- a/matsim/pom.xml +++ b/matsim/pom.xml @@ -117,7 +117,7 @@ org.apache.maven.plugins maven-surefire-report-plugin - 3.2.1 + 3.2.2 @@ -203,7 +203,7 @@ com.github.luben zstd-jni - 1.5.5-6 + 1.5.5-10 jakarta.validation diff --git a/pom.xml b/pom.xml index 3582b5ca0c9..0e21cbfa639 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,7 @@ 2.21.1 29.2 + 0.49.1 1.19.0 7.0.0 2.15.3 @@ -123,7 +124,7 @@ org.apache.commons commons-text - 1.10.0 + 1.11.0 com.opencsv @@ -264,7 +265,7 @@ org.checkerframework checker-qual - 3.39.0 + 3.40.0 @@ -289,7 +290,7 @@ org.mockito mockito-core - 5.6.0 + 5.7.0 test @@ -382,12 +383,12 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.1 + 3.2.2 org.apache.maven.plugins maven-failsafe-plugin - 3.2.1 + 3.2.2 org.apache.maven.plugins @@ -412,7 +413,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.6.0 + 3.6.2 org.codehaus.mojo