Skip to content

Commit

Permalink
remove links and facility ids from plans
Browse files Browse the repository at this point in the history
  • Loading branch information
GregorRyb committed Nov 7, 2024
1 parent c1b030f commit 4b9174a
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
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.population.Activity;
import org.matsim.api.core.v01.population.PlanElement;
import org.matsim.application.MATSimApplication;
import org.matsim.core.config.Config;
import org.matsim.core.config.groups.ReplanningConfigGroup;
Expand Down Expand Up @@ -93,7 +95,6 @@ protected Config prepareConfig(Config config) {
}
case bikeTeleportedStandardMatsim -> {
log.info("Simulating assuming bikes are teleported, this is the default in the input config");

}

default -> throw new IllegalStateException("Unexpected value: " + bike);
Expand All @@ -109,6 +110,16 @@ protected void prepareScenario(Scenario scenario) {
if (bike == BicycleHandling.onNetworkWithStandardMatsim || bike == BicycleHandling.onNetworkWithBicycleContrib) {
for (Person person: scenario.getPopulation().getPersons().values()) {
PopulationUtils.resetRoutes(person.getSelectedPlan());

for (PlanElement planElement:person.getSelectedPlan().getPlanElements()) {
if (planElement instanceof Activity activity) {
activity.setLinkId(null);
activity.setFacilityId(null);

}
}


}
}

Expand Down

0 comments on commit 4b9174a

Please sign in to comment.