From ed2904838443b7ebaab18c9339c91439cab011df Mon Sep 17 00:00:00 2001 From: Tarek Chouaki Date: Wed, 18 Sep 2024 19:55:26 +0200 Subject: [PATCH] chore: update MATSim version (#257) * chore: update MATSim version --- .github/workflows/maven.yml | 4 +-- .../emissions/RunComputeEmissionsGrid.java | 2 +- .../emissions/RunExportEmissionsNetwork.java | 2 +- .../core/scenario/RunInsertVehicles.java | 11 +++---- .../eqasim/core/scenario/SpatialUtils.java | 8 ++--- .../scenario/cutter/RunScenarioCutter.java | 5 +-- .../cutter/extent/ShapeScenarioExtent.java | 10 +++--- .../modes/drt/utils/AdaptConfigForDrt.java | 31 ++++++++++--------- .../AccessEgressStopSelectorParams.java | 2 +- .../config/FeederDrtConfigGroup.java | 2 +- .../ExportAbstractAccessItemsToShapefile.java | 4 +-- .../tools/ExportActivitiesToShapefile.java | 4 +-- .../ExportNetworkRoutesToGeopackage.java | 6 ++-- .../core/tools/ExportNetworkToGeopackage.java | 6 ++-- .../core/tools/ExportNetworkToShapefile.java | 4 +-- .../tools/ExportTransitLinesToShapefile.java | 4 +-- .../tools/ExportTransitStopsToShapefile.java | 4 +-- .../test/java/org/eqasim/TestEmissions.java | 2 +- .../TestSpecialModeChoiceCases.java | 17 ++++++++++ .../corsica_drt/RunCorsicaDrtSimulation.java | 11 ++++--- .../los_angeles/preparation/LATract.java | 8 ++--- pom.xml | 11 ++++--- .../san_francisco/preparation/SFTract.java | 8 ++--- .../eqasim/sao_paulo/preparation/SPTract.java | 8 ++--- 24 files changed, 97 insertions(+), 77 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4c1bce047..267fd405f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -13,9 +13,9 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v1 with: - java-version: 17 + java-version: 21 - name: Build with Maven run: mvn test -B -Dmatsim.preferLocalDtds=true diff --git a/core/src/main/java/org/eqasim/core/components/emissions/RunComputeEmissionsGrid.java b/core/src/main/java/org/eqasim/core/components/emissions/RunComputeEmissionsGrid.java index e9b5030f4..985339266 100644 --- a/core/src/main/java/org/eqasim/core/components/emissions/RunComputeEmissionsGrid.java +++ b/core/src/main/java/org/eqasim/core/components/emissions/RunComputeEmissionsGrid.java @@ -3,6 +3,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.eqasim.core.misc.ClassUtils; import org.eqasim.core.simulation.EqasimConfigurator; +import org.geotools.api.feature.simple.SimpleFeature; import org.locationtech.jts.geom.Geometry; import org.matsim.api.core.v01.network.Network; import org.matsim.contrib.emissions.analysis.EmissionGridAnalyzer; @@ -14,7 +15,6 @@ import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.utils.gis.ShapeFileReader; -import org.opengis.feature.simple.SimpleFeature; public class RunComputeEmissionsGrid { diff --git a/core/src/main/java/org/eqasim/core/components/emissions/RunExportEmissionsNetwork.java b/core/src/main/java/org/eqasim/core/components/emissions/RunExportEmissionsNetwork.java index c61902a74..5440ce735 100644 --- a/core/src/main/java/org/eqasim/core/components/emissions/RunExportEmissionsNetwork.java +++ b/core/src/main/java/org/eqasim/core/components/emissions/RunExportEmissionsNetwork.java @@ -9,6 +9,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.eqasim.core.misc.ClassUtils; import org.eqasim.core.simulation.EqasimConfigurator; +import org.geotools.api.feature.simple.SimpleFeature; import org.locationtech.jts.geom.Coordinate; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.network.Link; @@ -30,7 +31,6 @@ import org.matsim.core.utils.geometry.geotools.MGC; import org.matsim.core.utils.gis.PolylineFeatureFactory; import org.matsim.core.utils.gis.ShapeFileWriter; -import org.opengis.feature.simple.SimpleFeature; public class RunExportEmissionsNetwork { diff --git a/core/src/main/java/org/eqasim/core/scenario/RunInsertVehicles.java b/core/src/main/java/org/eqasim/core/scenario/RunInsertVehicles.java index e94d4b0ce..d5f5f16bc 100644 --- a/core/src/main/java/org/eqasim/core/scenario/RunInsertVehicles.java +++ b/core/src/main/java/org/eqasim/core/scenario/RunInsertVehicles.java @@ -14,11 +14,7 @@ import org.matsim.core.population.io.PopulationReader; import org.matsim.core.population.io.PopulationWriter; import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.vehicles.MatsimVehicleWriter; -import org.matsim.vehicles.Vehicle; -import org.matsim.vehicles.VehicleUtils; -import org.matsim.vehicles.Vehicles; -import org.matsim.vehicles.VehiclesFactory; +import org.matsim.vehicles.*; public class RunInsertVehicles { @@ -26,13 +22,14 @@ static public void insertVehicles(Config config, Scenario scenario) { Vehicles vehicles = scenario.getVehicles(); VehiclesFactory factory = vehicles.getFactory(); - vehicles.addVehicleType(VehicleUtils.getDefaultVehicleType()); + VehicleType vehicleType = VehicleUtils.createVehicleType(Id.create("defaultVehicleType", VehicleType.class)); + vehicles.addVehicleType(vehicleType); for (Person person : scenario.getPopulation().getPersons().values()) { Map> personVehicles = new HashMap<>(); for (String mode : config.routing().getNetworkModes()) { Vehicle vehicle = factory.createVehicle(Id.createVehicleId(person.getId().toString() + ":" + mode), - VehicleUtils.getDefaultVehicleType()); + vehicleType); vehicles.addVehicle(vehicle); personVehicles.put(mode, vehicle.getId()); diff --git a/core/src/main/java/org/eqasim/core/scenario/SpatialUtils.java b/core/src/main/java/org/eqasim/core/scenario/SpatialUtils.java index 38eb9296f..ff1abde35 100644 --- a/core/src/main/java/org/eqasim/core/scenario/SpatialUtils.java +++ b/core/src/main/java/org/eqasim/core/scenario/SpatialUtils.java @@ -6,15 +6,15 @@ import java.util.LinkedList; import java.util.List; -import org.geotools.data.DataStore; -import org.geotools.data.DataStoreFinder; +import org.geotools.api.data.DataStore; +import org.geotools.api.data.DataStoreFinder; +import org.geotools.api.data.SimpleFeatureSource; +import org.geotools.api.feature.simple.SimpleFeature; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureIterator; -import org.geotools.data.simple.SimpleFeatureSource; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.MultiPolygon; import org.locationtech.jts.geom.Polygon; -import org.opengis.feature.simple.SimpleFeature; public class SpatialUtils { static public Polygon loadPolygon(URL url, String attribute, String value) throws IOException { diff --git a/core/src/main/java/org/eqasim/core/scenario/cutter/RunScenarioCutter.java b/core/src/main/java/org/eqasim/core/scenario/cutter/RunScenarioCutter.java index 8595f2a86..4dcdf1db9 100644 --- a/core/src/main/java/org/eqasim/core/scenario/cutter/RunScenarioCutter.java +++ b/core/src/main/java/org/eqasim/core/scenario/cutter/RunScenarioCutter.java @@ -33,6 +33,7 @@ import org.eqasim.core.simulation.mode_choice.AbstractEqasimExtension; import org.eqasim.core.simulation.termination.EqasimTerminationModule; import org.matsim.api.core.v01.Scenario; +import org.matsim.contribs.discrete_mode_choice.modules.DiscreteModeChoiceModule; import org.matsim.core.config.CommandLine; import org.matsim.core.config.CommandLine.ConfigurationException; import org.matsim.core.config.Config; @@ -111,7 +112,7 @@ static public void main(String[] args) throws ConfigurationException, IOExceptio // Cut population Injector populationCutterInjector = new InjectorBuilder(scenario) // .addOverridingModules(configurator.getModules().stream() - .filter(module -> !(module instanceof AbstractEqasimExtension)).toList()) // + .filter(module -> !(module instanceof AbstractEqasimExtension) && !(module instanceof DiscreteModeChoiceModule)).toList()) // .addOverridingModule( new PopulationCutterModule(extent, numberOfThreads, 40, cmd.getOption("events-path"))) // .addOverridingModule(new CutterTravelTimeModule(travelTime)) // @@ -169,7 +170,7 @@ static public void main(String[] args) throws ConfigurationException, IOExceptio // Final routing Injector routingInjector = new InjectorBuilder(scenario) // .addOverridingModules(configurator.getModules().stream() - .filter(module -> !(module instanceof AbstractEqasimExtension)).toList()) // + .filter(module -> !(module instanceof AbstractEqasimExtension) && !(module instanceof DiscreteModeChoiceModule)).toList()) // .addOverridingModule(new PopulationRouterModule(numberOfThreads, 100, false)) // .addOverridingModule(new CutterTravelTimeModule(travelTime)) // .addOverridingModule(new TimeInterpretationModule()) // diff --git a/core/src/main/java/org/eqasim/core/scenario/cutter/extent/ShapeScenarioExtent.java b/core/src/main/java/org/eqasim/core/scenario/cutter/extent/ShapeScenarioExtent.java index fec65495d..db14a1285 100644 --- a/core/src/main/java/org/eqasim/core/scenario/cutter/extent/ShapeScenarioExtent.java +++ b/core/src/main/java/org/eqasim/core/scenario/cutter/extent/ShapeScenarioExtent.java @@ -9,12 +9,13 @@ import java.util.List; import java.util.Optional; -import org.geotools.data.DataStore; -import org.geotools.data.DataStoreFinder; +import org.geotools.api.data.DataStore; +import org.geotools.api.data.DataStoreFinder; +import org.geotools.api.data.SimpleFeatureReader; +import org.geotools.api.data.SimpleFeatureSource; +import org.geotools.api.feature.simple.SimpleFeature; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureIterator; -import org.geotools.data.simple.SimpleFeatureReader; -import org.geotools.data.simple.SimpleFeatureSource; import org.geotools.geopkg.FeatureEntry; import org.geotools.geopkg.GeoPackage; import org.locationtech.jts.geom.Coordinate; @@ -25,7 +26,6 @@ import org.locationtech.jts.geom.Point; import org.locationtech.jts.geom.Polygon; import org.matsim.api.core.v01.Coord; -import org.opengis.feature.simple.SimpleFeature; public class ShapeScenarioExtent implements ScenarioExtent { private final GeometryFactory factory = new GeometryFactory(); diff --git a/core/src/main/java/org/eqasim/core/simulation/modes/drt/utils/AdaptConfigForDrt.java b/core/src/main/java/org/eqasim/core/simulation/modes/drt/utils/AdaptConfigForDrt.java index ab4843506..45f680412 100644 --- a/core/src/main/java/org/eqasim/core/simulation/modes/drt/utils/AdaptConfigForDrt.java +++ b/core/src/main/java/org/eqasim/core/simulation/modes/drt/utils/AdaptConfigForDrt.java @@ -1,14 +1,11 @@ package org.eqasim.core.simulation.modes.drt.utils; -import java.io.File; import java.net.MalformedURLException; import java.nio.file.Path; import java.util.*; -import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.DoubleStream; import java.util.stream.IntStream; -import java.util.stream.Stream; import org.eqasim.core.components.config.EqasimConfigGroup; import org.eqasim.core.misc.ClassUtils; @@ -17,7 +14,9 @@ import org.eqasim.core.simulation.mode_choice.constraints.leg_time.LegTimeConstraintConfigGroup; import org.eqasim.core.simulation.mode_choice.constraints.leg_time.LegTimeConstraintModule; import org.eqasim.core.simulation.mode_choice.constraints.leg_time.LegTimeConstraintSingleLegConfigGroup; -import org.matsim.contrib.drt.analysis.zonal.DrtZonalSystemParams; +import org.matsim.contrib.common.zones.systems.grid.square.SquareGridZoneSystemParams; +import org.matsim.contrib.drt.analysis.zonal.DrtZoneSystemParams; +import org.matsim.contrib.drt.optimizer.constraints.DefaultDrtOptimizationConstraintsSet; import org.matsim.contrib.drt.optimizer.insertion.DrtInsertionSearchParams; import org.matsim.contrib.drt.optimizer.insertion.extensive.ExtensiveInsertionSearchParams; import org.matsim.contrib.drt.optimizer.rebalancing.RebalancingParams; @@ -40,7 +39,7 @@ public class AdaptConfigForDrt { - public static void adapt(Config config, Map vehiclesPathByDrtMode, Map operationalSchemes, Map drtUtilityEstimators, Map drtCostModels, Map addLegTimeConstraint, String qsimEndtime, String modeAvailability) throws MalformedURLException { + public static void adapt(Config config, Map vehiclesPathByDrtMode, Map operationalSchemes, Map drtUtilityEstimators, Map drtCostModels, Map addLegTimeConstraint, String qsimEndtime, String modeAvailability) { if(!config.getModules().containsKey(DvrpConfigGroup.GROUP_NAME)) { config.addModule(new DvrpConfigGroup()); } @@ -69,25 +68,27 @@ public static void adapt(Config config, Map vehiclesPathByDrtMod drtConfigGroup.mode = drtMode; drtConfigGroup.operationalScheme = DrtConfigGroup.OperationalScheme.valueOf(operationalSchemes.get(drtMode)); drtConfigGroup.stopDuration = 15.0; - drtConfigGroup.maxWaitTime = 600; - drtConfigGroup.maxTravelTimeAlpha = 1.5; - drtConfigGroup.maxTravelTimeBeta = 300.0; + DefaultDrtOptimizationConstraintsSet defaultDrtOptimizationConstraintsSet = (DefaultDrtOptimizationConstraintsSet) drtConfigGroup.addOrGetDrtOptimizationConstraintsParams().addOrGetDefaultDrtOptimizationConstraintsSet(); + defaultDrtOptimizationConstraintsSet.maxWaitTime = 600; + defaultDrtOptimizationConstraintsSet.maxTravelTimeAlpha= 1.5; + defaultDrtOptimizationConstraintsSet.maxTravelTimeBeta = 300.0; drtConfigGroup.vehiclesFile = vehiclesPathByDrtMode.get(drtMode); DrtInsertionSearchParams searchParams = new ExtensiveInsertionSearchParams(); - drtConfigGroup.addDrtInsertionSearchParams(searchParams); + drtConfigGroup.setDrtInsertionSearchParams(searchParams); RebalancingParams rebalancingParams = new RebalancingParams(); rebalancingParams.interval =1800; rebalancingParams.addParameterSet(new PlusOneRebalancingStrategyParams()); drtConfigGroup.addParameterSet(rebalancingParams); - DrtZonalSystemParams drtZonalSystemParams = new DrtZonalSystemParams(); - drtZonalSystemParams.zonesGeneration = DrtZonalSystemParams.ZoneGeneration.GridFromNetwork; - drtZonalSystemParams.cellSize = 500.0; - drtZonalSystemParams.targetLinkSelection = DrtZonalSystemParams.TargetLinkSelection.mostCentral; - drtConfigGroup.addParameterSet(drtZonalSystemParams); + DrtZoneSystemParams drtZonalSystemParams = new DrtZoneSystemParams(); + drtZonalSystemParams.targetLinkSelection = DrtZoneSystemParams.TargetLinkSelection.mostCentral; + SquareGridZoneSystemParams squareGridZoneSystemParams = new SquareGridZoneSystemParams(); + squareGridZoneSystemParams.cellSize = 500; + drtZonalSystemParams.addParameterSet(squareGridZoneSystemParams); + drtConfigGroup.addParameterSet(drtZonalSystemParams); multiModeDrtConfigGroup.addParameterSet(drtConfigGroup); // Set up choice model @@ -146,7 +147,7 @@ public static Map> extractDrtInfo(String[] drtModeNa Map resultingMap; if(drtModeNames.length == currentElements.length) { - resultingMap = IntStream.range(0, drtModeNames.length).boxed().collect(Collectors.toMap(integer -> drtModeNames[integer], (Function) integer -> currentElements[integer])); + resultingMap = IntStream.range(0, drtModeNames.length).boxed().collect(Collectors.toMap(integer -> drtModeNames[integer], integer -> currentElements[integer])); } else { if(currentElements.length != 1) { throw new IllegalStateException(String.format("When the number of provided drt mode names is not equal to the number of provided %s," + diff --git a/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/AccessEgressStopSelectorParams.java b/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/AccessEgressStopSelectorParams.java index 8629dd4f6..3ce8b16a8 100644 --- a/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/AccessEgressStopSelectorParams.java +++ b/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/AccessEgressStopSelectorParams.java @@ -2,7 +2,7 @@ import jakarta.validation.constraints.NotNull; import org.eqasim.core.simulation.modes.feeder_drt.router.access_egress_selector.ClosestAccessEgressStopSelectorParameterSet; -import org.matsim.contrib.util.ReflectiveConfigGroupWithConfigurableParameterSets; +import org.matsim.contrib.common.util.ReflectiveConfigGroupWithConfigurableParameterSets; import org.matsim.core.config.ReflectiveConfigGroup; public class AccessEgressStopSelectorParams extends ReflectiveConfigGroupWithConfigurableParameterSets { diff --git a/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/FeederDrtConfigGroup.java b/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/FeederDrtConfigGroup.java index 1df2e2359..6317df05c 100644 --- a/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/FeederDrtConfigGroup.java +++ b/core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/config/FeederDrtConfigGroup.java @@ -2,8 +2,8 @@ import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; +import org.matsim.contrib.common.util.ReflectiveConfigGroupWithConfigurableParameterSets; import org.matsim.contrib.dvrp.run.Modal; -import org.matsim.contrib.util.ReflectiveConfigGroupWithConfigurableParameterSets; public class FeederDrtConfigGroup extends ReflectiveConfigGroupWithConfigurableParameterSets implements Modal { public static final String GROUP_NAME = "feederDrt"; diff --git a/core/src/main/java/org/eqasim/core/simulation/modes/transit_with_abstract_access/utils/ExportAbstractAccessItemsToShapefile.java b/core/src/main/java/org/eqasim/core/simulation/modes/transit_with_abstract_access/utils/ExportAbstractAccessItemsToShapefile.java index 70e06110a..7aaa8cd57 100644 --- a/core/src/main/java/org/eqasim/core/simulation/modes/transit_with_abstract_access/utils/ExportAbstractAccessItemsToShapefile.java +++ b/core/src/main/java/org/eqasim/core/simulation/modes/transit_with_abstract_access/utils/ExportAbstractAccessItemsToShapefile.java @@ -3,6 +3,7 @@ import org.eqasim.core.simulation.modes.transit_with_abstract_access.abstract_access.AbstractAccessItem; import org.eqasim.core.simulation.modes.transit_with_abstract_access.abstract_access.AbstractAccessesFileReader; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.CommandLine; import org.matsim.core.config.Config; @@ -12,8 +13,7 @@ import org.matsim.core.utils.gis.PointFeatureFactory; import org.matsim.core.utils.gis.ShapeFileWriter; import org.matsim.pt.transitSchedule.api.TransitScheduleReader; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.feature.simple.SimpleFeature; import java.util.Collection; import java.util.LinkedList; diff --git a/core/src/main/java/org/eqasim/core/tools/ExportActivitiesToShapefile.java b/core/src/main/java/org/eqasim/core/tools/ExportActivitiesToShapefile.java index f370aa77a..abbf2d556 100644 --- a/core/src/main/java/org/eqasim/core/tools/ExportActivitiesToShapefile.java +++ b/core/src/main/java/org/eqasim/core/tools/ExportActivitiesToShapefile.java @@ -1,5 +1,6 @@ package org.eqasim.core.tools; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; import org.locationtech.jts.geom.Coordinate; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.population.Activity; @@ -13,8 +14,7 @@ import org.matsim.core.utils.geometry.geotools.MGC; import org.matsim.core.utils.gis.PointFeatureFactory; import org.matsim.core.utils.gis.ShapeFileWriter; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.feature.simple.SimpleFeature; import java.util.*; import java.util.stream.Collectors; diff --git a/core/src/main/java/org/eqasim/core/tools/ExportNetworkRoutesToGeopackage.java b/core/src/main/java/org/eqasim/core/tools/ExportNetworkRoutesToGeopackage.java index 44a836138..01b01a25a 100644 --- a/core/src/main/java/org/eqasim/core/tools/ExportNetworkRoutesToGeopackage.java +++ b/core/src/main/java/org/eqasim/core/tools/ExportNetworkRoutesToGeopackage.java @@ -2,6 +2,7 @@ import org.eqasim.core.misc.ClassUtils; import org.eqasim.core.simulation.EqasimConfigurator; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; import org.geotools.feature.DefaultFeatureCollection; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; @@ -25,9 +26,8 @@ import org.matsim.core.router.TripStructureUtils; import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.geometry.geotools.MGC; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeatureType; import java.io.File; import java.io.IOException; diff --git a/core/src/main/java/org/eqasim/core/tools/ExportNetworkToGeopackage.java b/core/src/main/java/org/eqasim/core/tools/ExportNetworkToGeopackage.java index 0aca42735..710057fef 100644 --- a/core/src/main/java/org/eqasim/core/tools/ExportNetworkToGeopackage.java +++ b/core/src/main/java/org/eqasim/core/tools/ExportNetworkToGeopackage.java @@ -6,6 +6,7 @@ import java.util.HashSet; import java.util.LinkedList; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; import org.geotools.feature.DefaultFeatureCollection; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; @@ -20,9 +21,8 @@ import org.matsim.core.network.NetworkUtils; import org.matsim.core.network.io.MatsimNetworkReader; import org.matsim.core.utils.geometry.geotools.MGC; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeatureType; public class ExportNetworkToGeopackage { public static void main(String[] args) throws Exception { diff --git a/core/src/main/java/org/eqasim/core/tools/ExportNetworkToShapefile.java b/core/src/main/java/org/eqasim/core/tools/ExportNetworkToShapefile.java index f30fb7c78..0b8f697f2 100644 --- a/core/src/main/java/org/eqasim/core/tools/ExportNetworkToShapefile.java +++ b/core/src/main/java/org/eqasim/core/tools/ExportNetworkToShapefile.java @@ -5,6 +5,7 @@ import java.util.HashSet; import java.util.LinkedList; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; import org.locationtech.jts.geom.Coordinate; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.network.Network; @@ -14,8 +15,7 @@ import org.matsim.core.utils.geometry.geotools.MGC; import org.matsim.core.utils.gis.PolylineFeatureFactory; import org.matsim.core.utils.gis.ShapeFileWriter; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.feature.simple.SimpleFeature; public class ExportNetworkToShapefile { public static void main(String[] args) throws Exception { diff --git a/core/src/main/java/org/eqasim/core/tools/ExportTransitLinesToShapefile.java b/core/src/main/java/org/eqasim/core/tools/ExportTransitLinesToShapefile.java index 18d993d2a..e08622b41 100644 --- a/core/src/main/java/org/eqasim/core/tools/ExportTransitLinesToShapefile.java +++ b/core/src/main/java/org/eqasim/core/tools/ExportTransitLinesToShapefile.java @@ -4,6 +4,7 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.BooleanUtils; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; import org.locationtech.jts.geom.Coordinate; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.IdSet; @@ -22,8 +23,7 @@ import org.matsim.pt.transitSchedule.api.TransitLine; import org.matsim.pt.transitSchedule.api.TransitRoute; import org.matsim.pt.transitSchedule.api.TransitScheduleReader; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.feature.simple.SimpleFeature; public class ExportTransitLinesToShapefile { public static void main(String[] args) throws Exception { diff --git a/core/src/main/java/org/eqasim/core/tools/ExportTransitStopsToShapefile.java b/core/src/main/java/org/eqasim/core/tools/ExportTransitStopsToShapefile.java index 1f42f3c9b..cdabf19b8 100644 --- a/core/src/main/java/org/eqasim/core/tools/ExportTransitStopsToShapefile.java +++ b/core/src/main/java/org/eqasim/core/tools/ExportTransitStopsToShapefile.java @@ -3,6 +3,7 @@ import java.util.Collection; import java.util.LinkedList; +import org.geotools.api.referencing.crs.CoordinateReferenceSystem; import org.locationtech.jts.geom.Coordinate; import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.CommandLine; @@ -14,8 +15,7 @@ import org.matsim.core.utils.gis.ShapeFileWriter; import org.matsim.pt.transitSchedule.api.TransitScheduleReader; import org.matsim.pt.transitSchedule.api.TransitStopFacility; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.geotools.api.feature.simple.SimpleFeature; public class ExportTransitStopsToShapefile { public static void main(String[] args) throws Exception { diff --git a/core/src/test/java/org/eqasim/TestEmissions.java b/core/src/test/java/org/eqasim/TestEmissions.java index 21dddcb9d..bef761534 100644 --- a/core/src/test/java/org/eqasim/TestEmissions.java +++ b/core/src/test/java/org/eqasim/TestEmissions.java @@ -69,7 +69,7 @@ import org.matsim.vehicles.VehicleType; import org.matsim.vehicles.VehicleUtils; import org.matsim.vehicles.Vehicles; -import org.opengis.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeature; public class TestEmissions { diff --git a/core/src/test/java/org/eqasim/mode_choice/TestSpecialModeChoiceCases.java b/core/src/test/java/org/eqasim/mode_choice/TestSpecialModeChoiceCases.java index 4824019e5..fd80f894e 100644 --- a/core/src/test/java/org/eqasim/mode_choice/TestSpecialModeChoiceCases.java +++ b/core/src/test/java/org/eqasim/mode_choice/TestSpecialModeChoiceCases.java @@ -3,6 +3,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.io.File; +import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -13,6 +15,7 @@ import java.util.Set; import java.util.stream.Collectors; +import org.apache.commons.io.FileUtils; import org.eqasim.core.components.config.EqasimConfigGroup; import org.eqasim.core.components.raptor.EqasimRaptorConfigGroup; import org.eqasim.core.misc.InjectorBuilder; @@ -21,6 +24,7 @@ import org.eqasim.core.simulation.mode_choice.EqasimModeChoiceModule; import org.eqasim.core.simulation.mode_choice.parameters.ModeParameters; import org.eqasim.core.simulation.termination.EqasimTerminationModule; +import org.junit.After; import org.junit.Test; import org.matsim.api.core.v01.Coord; import org.matsim.api.core.v01.Id; @@ -42,6 +46,8 @@ import org.matsim.core.config.CommandLine.ConfigurationException; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; +import org.matsim.core.controler.AbstractModule; +import org.matsim.core.controler.OutputDirectoryHierarchy; import org.matsim.core.population.PopulationUtils; import org.matsim.core.router.RoutingModule; import org.matsim.core.router.RoutingRequest; @@ -54,6 +60,11 @@ import com.google.inject.Singleton; public class TestSpecialModeChoiceCases { + @After + public void tearDown() throws IOException { + FileUtils.deleteDirectory(new File("simulation_output")); + } + @Test public void testOrdinaryTour() throws ConfigurationException, NoFeasibleChoiceException { List trips = new LinkedList<>(); @@ -171,6 +182,12 @@ static private Set findChains(List trips, int sa .addOverridingModule(new EqasimModeChoiceModule()) // .addOverridingModule(new StaticModeAvailabilityModule()) // .addOverridingModule(new TimeInterpretationModule()) // + .addOverridingModule(new AbstractModule() { + @Override + public void install() { + bind(OutputDirectoryHierarchy.class).toInstance(new OutputDirectoryHierarchy(scenario.getConfig())); + } + }) .build(); DiscreteModeChoiceModel model = injector.getInstance(DiscreteModeChoiceModel.class); diff --git a/examples/src/main/java/org/eqasim/examples/corsica_drt/RunCorsicaDrtSimulation.java b/examples/src/main/java/org/eqasim/examples/corsica_drt/RunCorsicaDrtSimulation.java index d8227abee..f8cbf32e4 100644 --- a/examples/src/main/java/org/eqasim/examples/corsica_drt/RunCorsicaDrtSimulation.java +++ b/examples/src/main/java/org/eqasim/examples/corsica_drt/RunCorsicaDrtSimulation.java @@ -16,6 +16,7 @@ import org.eqasim.ile_de_france.IDFConfigurator; import org.eqasim.ile_de_france.mode_choice.IDFModeChoiceModule; import org.matsim.api.core.v01.Scenario; +import org.matsim.contrib.drt.optimizer.constraints.DefaultDrtOptimizationConstraintsSet; import org.matsim.contrib.drt.optimizer.insertion.DrtInsertionSearchParams; import org.matsim.contrib.drt.optimizer.insertion.selective.SelectiveInsertionSearchParams; import org.matsim.contrib.drt.routing.DrtRoute; @@ -75,13 +76,15 @@ static public void main(String[] args) throws ConfigurationException { drtConfig.mode = "drt"; drtConfig.operationalScheme = OperationalScheme.door2door; drtConfig.stopDuration = 15.0; - drtConfig.maxWaitTime = 3600.0; - drtConfig.maxTravelTimeAlpha = 3.0; - drtConfig.maxTravelTimeBeta = 3600.0; + DefaultDrtOptimizationConstraintsSet defaultDrtOptimizationConstraintsSet = new DefaultDrtOptimizationConstraintsSet(); + defaultDrtOptimizationConstraintsSet.maxWaitTime = 3600; + defaultDrtOptimizationConstraintsSet.maxTravelTimeAlpha = 3; + defaultDrtOptimizationConstraintsSet.maxTravelTimeBeta = 3600; + drtConfig.addOrGetDrtOptimizationConstraintsParams().addParameterSet(defaultDrtOptimizationConstraintsSet); drtConfig.vehiclesFile = Resources.getResource("corsica_drt/drt_vehicles.xml").toString(); DrtInsertionSearchParams searchParams = new SelectiveInsertionSearchParams(); - drtConfig.addDrtInsertionSearchParams(searchParams); + drtConfig.setDrtInsertionSearchParams(searchParams); multiModeDrtConfig.addParameterSet(drtConfig); DrtConfigs.adjustMultiModeDrtConfig(multiModeDrtConfig, config.scoring(), config.routing()); diff --git a/los_angeles/src/main/java/org/eqasim/los_angeles/preparation/LATract.java b/los_angeles/src/main/java/org/eqasim/los_angeles/preparation/LATract.java index fadbb78a3..f5bb31098 100644 --- a/los_angeles/src/main/java/org/eqasim/los_angeles/preparation/LATract.java +++ b/los_angeles/src/main/java/org/eqasim/los_angeles/preparation/LATract.java @@ -7,17 +7,17 @@ import java.util.HashSet; import java.util.Set; -import org.geotools.data.DataStore; -import org.geotools.data.DataStoreFinder; +import org.geotools.api.data.DataStore; +import org.geotools.api.data.DataStoreFinder; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureIterator; -import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.api.data.SimpleFeatureSource; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.matsim.api.core.v01.Coord; -import org.opengis.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeature; public class LATract { private final static GeometryFactory factory = new GeometryFactory(); diff --git a/pom.xml b/pom.xml index 5e99b6aa5..ff665c764 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,9 @@ - 17 - 17 - 2025.0-PR3223 + 21 + 21 + 2025.0-PR3483 @@ -48,7 +48,7 @@ org.geotools gt-geopkg - 29.0 + 31.3 @@ -79,7 +79,7 @@ commons-io commons-io - 2.7 + 2.16.1 @@ -136,6 +136,7 @@ org.apache.maven.plugins maven-source-plugin + 3.2.1 attach-sources diff --git a/san_francisco/src/main/java/org/eqasim/san_francisco/preparation/SFTract.java b/san_francisco/src/main/java/org/eqasim/san_francisco/preparation/SFTract.java index acc75bf87..500e471af 100644 --- a/san_francisco/src/main/java/org/eqasim/san_francisco/preparation/SFTract.java +++ b/san_francisco/src/main/java/org/eqasim/san_francisco/preparation/SFTract.java @@ -7,17 +7,17 @@ import java.util.HashSet; import java.util.Set; -import org.geotools.data.DataStore; -import org.geotools.data.DataStoreFinder; +import org.geotools.api.data.DataStore; +import org.geotools.api.data.DataStoreFinder; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureIterator; -import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.api.data.SimpleFeatureSource; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.matsim.api.core.v01.Coord; -import org.opengis.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeature; public class SFTract { private final static GeometryFactory factory = new GeometryFactory(); diff --git a/sao_paulo/src/main/java/org/eqasim/sao_paulo/preparation/SPTract.java b/sao_paulo/src/main/java/org/eqasim/sao_paulo/preparation/SPTract.java index 1a1610477..cad7f2404 100644 --- a/sao_paulo/src/main/java/org/eqasim/sao_paulo/preparation/SPTract.java +++ b/sao_paulo/src/main/java/org/eqasim/sao_paulo/preparation/SPTract.java @@ -7,17 +7,17 @@ import java.util.HashSet; import java.util.Set; -import org.geotools.data.DataStore; -import org.geotools.data.DataStoreFinder; +import org.geotools.api.data.DataStore; +import org.geotools.api.data.DataStoreFinder; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureIterator; -import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.api.data.SimpleFeatureSource; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.matsim.api.core.v01.Coord; -import org.opengis.feature.simple.SimpleFeature; +import org.geotools.api.feature.simple.SimpleFeature; public class SPTract { private final static GeometryFactory factory = new GeometryFactory();