From abd8e918530726aa9ae56ae6a2fab1fc8a6a508b Mon Sep 17 00:00:00 2001 From: sime94 Date: Mon, 30 Sep 2024 15:28:31 +0200 Subject: [PATCH] bump to PR3496 --- pom.xml | 4 ++-- .../run/scenarios/LausitzSingleModeScenario.java | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index e6f09d2..b957e0e 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ - 2025.0-PR3486 + 2025.0-PR3496 @@ -144,7 +144,7 @@ once - @{argLine} -Xmx6500m -Djava.awt.headless=true -Dmatsim.preferLocalDtds=true + @{argLine} -Djava.awt.headless=true -Dmatsim.preferLocalDtds=true diff --git a/src/main/java/org/matsim/run/scenarios/LausitzSingleModeScenario.java b/src/main/java/org/matsim/run/scenarios/LausitzSingleModeScenario.java index 8005187..4dc5eb6 100644 --- a/src/main/java/org/matsim/run/scenarios/LausitzSingleModeScenario.java +++ b/src/main/java/org/matsim/run/scenarios/LausitzSingleModeScenario.java @@ -1,11 +1,11 @@ package org.matsim.run.scenarios; -import com.google.common.collect.Lists; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; import org.matsim.api.core.v01.population.*; +import org.matsim.application.prepare.population.CleanPopulation; import org.matsim.core.config.Config; import org.matsim.core.config.groups.ReplanningConfigGroup; import org.matsim.core.controler.Controler; @@ -65,7 +65,6 @@ public void prepareScenario(Scenario scenario) { // apply all scenario changes from base scenario class baseScenario.prepareScenario(scenario); -// TODO: replace code segment that selects, cleans routes and converts trips 2 legs with call of CleanPopulation PR3496 TripsToLegsAlgorithm trips2Legs = new TripsToLegsAlgorithm(new RoutingModeMainModeIdentifier()); for (Person person : scenario.getPopulation().getPersons().values()) { @@ -73,18 +72,14 @@ public void prepareScenario(Scenario scenario) { continue; } - Plan selected = person.getSelectedPlan(); - for (Plan plan : Lists.newArrayList(person.getPlans())) { - if (plan != selected) - person.removePlan(plan); - } + CleanPopulation.removeUnselectedPlans(person); for (Plan plan : person.getPlans()) { trips2Legs.run(plan); for (PlanElement el : plan.getPlanElements()) { if (el instanceof Leg leg) { - leg.setRoute(null); + CleanPopulation.removeRouteFromLeg(el); leg.setMode(mode); } }