diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleConfigGroup.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleConfigGroup.java similarity index 92% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleConfigGroup.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleConfigGroup.java index ed216a6fcf0..444b0e8f1c0 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleConfigGroup.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleConfigGroup.java @@ -16,7 +16,7 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; import java.util.Map; import java.util.TreeMap; @@ -34,11 +34,14 @@ public class BicycleConfigGroup extends ConfigGroup { private static final String INPUT_COMFORT = "marginalUtilityOfComfort_m"; private static final String INPUT_INFRASTRUCTURE = "marginalUtilityOfInfrastructure_m"; private static final String INPUT_GRADIENT = "marginalUtilityOfGradient_m_100m"; + + public static enum BicycleScoringType {legBased, linkBased}; private String networkAttFile = null; private double marginalUtilityOfComfort; private double marginalUtilityOfInfrastructure; private double marginalUtilityOfGradient; + private BicycleScoringType bicycleScoringType = BicycleScoringType.legBased; public BicycleConfigGroup() { super(GROUP_NAME); @@ -127,4 +130,12 @@ public void setMarginalUtilityOfGradient_m_100m(final double value) { public double getMarginalUtilityOfGradient_m_100m() { return this.marginalUtilityOfGradient; } + + public void setBicycleScoringType(final BicycleScoringType value) { + this.bicycleScoringType = value; + } + + public BicycleScoringType getBicycleScoringType() { + return this.bicycleScoringType; + } } \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLabels.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLabels.java index 0c9ab130c56..48a42e24d1a 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLabels.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLabels.java @@ -35,5 +35,4 @@ public final class BicycleLabels { private BicycleLabels() { // Don't allow to create instances of this class } - -} +} \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLegScoring.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLegScoring.java new file mode 100644 index 00000000000..ee770778238 --- /dev/null +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLegScoring.java @@ -0,0 +1,73 @@ +/* *********************************************************************** * + * project: org.matsim.* * + * BicycleLegScoring.java * + * * + * *********************************************************************** * + * * + * copyright : (C) 2007 by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** */ + +package org.matsim.contrib.bicycle; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.network.Link; +import org.matsim.api.core.v01.network.Network; +import org.matsim.api.core.v01.population.Leg; +import org.matsim.core.population.routes.NetworkRoute; +import org.matsim.core.scoring.functions.CharyparNagelLegScoring; +import org.matsim.core.scoring.functions.ScoringParameters; + +/** + * @author dziemke + */ +public class BicycleLegScoring extends CharyparNagelLegScoring { + // private static final Logger LOG = Logger.getLogger(BicycleLegScoring.class); + + private final double marginalUtilityOfInfrastructure_m; + private final double marginalUtilityOfComfort_m; + private final double marginalUtilityOfGradient_m_100m; + + public BicycleLegScoring(final ScoringParameters params, Network network, BicycleConfigGroup bicycleConfigGroup) { + super(params, network); + + this.marginalUtilityOfInfrastructure_m = bicycleConfigGroup.getMarginalUtilityOfInfrastructure_m(); + this.marginalUtilityOfComfort_m = bicycleConfigGroup.getMarginalUtilityOfComfort_m(); + this.marginalUtilityOfGradient_m_100m = bicycleConfigGroup.getMarginalUtilityOfGradient_m_100m(); + } + + protected double calcLegScore(final double departureTime, final double arrivalTime, final Leg leg) { + // Get leg score from regular CharyparNagelLegScoring + double legScore = super.calcLegScore(departureTime, arrivalTime, leg); + // LOG.warn("----- legScore = " + legScore); + + NetworkRoute networkRoute = (NetworkRoute) leg.getRoute(); + + List> linkIds = new ArrayList<>(); + linkIds.addAll(networkRoute.getLinkIds()); + linkIds.add(networkRoute.getEndLinkId()); + + // Iterate over all links of the route + for (Id linkId : linkIds) { + double scoreOnLink = BicycleUtilityUtils.computeLinkBasedScore(network.getLinks().get(linkId), + marginalUtilityOfComfort_m, marginalUtilityOfInfrastructure_m, marginalUtilityOfGradient_m_100m); + // LOG.warn("----- link = " + linkId + " -- scoreOnLink = " + scoreOnLink); + legScore += scoreOnLink; + } + return legScore; + } +} \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleScoring.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLinkScoring.java similarity index 51% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleScoring.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLinkScoring.java index 216bc8c7af1..1027b94c89a 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleScoring.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleLinkScoring.java @@ -16,7 +16,7 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; import org.apache.log4j.Logger; import org.matsim.api.core.v01.Id; @@ -26,31 +26,46 @@ import org.matsim.api.core.v01.events.VehicleEntersTrafficEvent; import org.matsim.api.core.v01.events.VehicleLeavesTrafficEvent; import org.matsim.api.core.v01.network.Link; -import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.bicycle.MotorizedInteractionEvent; -import org.matsim.contrib.bicycle.MotorizedInteractionEventHandler; import org.matsim.core.events.algorithms.Vehicle2DriverEventHandler; +import org.matsim.core.gbl.Gbl; import org.matsim.core.scoring.SumScoringFunction; +import org.matsim.core.scoring.functions.ModeUtilityParameters; +import org.matsim.core.scoring.functions.ScoringParameters; import org.matsim.vehicles.Vehicle; /** * @author dziemke + * + * This is an alternative to BicycleLegScoring. Currently yields slightly different scores than BicyleLegScoring. + * This link-based scoring should be used when true times spent on an individual link are relevant + * and for the scoring of the interaction with motorized traffic. */ -public class BicycleScoring implements SumScoringFunction.ArbitraryEventScoring, MotorizedInteractionEventHandler { - private static final Logger LOG = Logger.getLogger(BicycleScoring.class); +public class BicycleLinkScoring implements SumScoringFunction.ArbitraryEventScoring, MotorizedInteractionEventHandler { + private static final Logger LOG = Logger.getLogger(BicycleLinkScoring.class); + + protected final ScoringParameters params; private Scenario scenario; - private BicycleTravelDisutility bicycleTravelDisutility; - private Vehicle2DriverEventHandler delegate = new Vehicle2DriverEventHandler(); + private Vehicle2DriverEventHandler vehicle2Driver = new Vehicle2DriverEventHandler(); private Id previousLink; private double previousLinkRelativePosition; private double previousLinkEnterTime; private double score; private int carCountOnLink; - public BicycleScoring(Scenario scenario, BicycleTravelTime bicycleTravelTime, BicycleTravelDisutilityFactory bicycleTravelDisutilityFactory) { - this.scenario = scenario; - this.bicycleTravelDisutility = (BicycleTravelDisutility) bicycleTravelDisutilityFactory.createTravelDisutility(bicycleTravelTime); + private final double marginalUtilityOfInfrastructure_m; + private final double marginalUtilityOfComfort_m; + private final double marginalUtilityOfGradient_m_100m; + + private static int ccc=0 ; + + public BicycleLinkScoring(final ScoringParameters params, Scenario scenario, BicycleConfigGroup bicycleConfigGroup) { + this.params = params; + this.scenario = scenario; + + this.marginalUtilityOfInfrastructure_m = bicycleConfigGroup.getMarginalUtilityOfInfrastructure_m(); + this.marginalUtilityOfComfort_m = bicycleConfigGroup.getMarginalUtilityOfComfort_m(); + this.marginalUtilityOfGradient_m_100m = bicycleConfigGroup.getMarginalUtilityOfGradient_m_100m(); } @Override public void finish() {} @@ -63,11 +78,10 @@ public double getScore() { @Override public void handleEvent(Event event) { if (event instanceof VehicleEntersTrafficEvent) { -// LOG.warn(event.toString()); VehicleEntersTrafficEvent vehEvent = (VehicleEntersTrafficEvent) event; // Establish connection between driver and vehicle - delegate.handleEvent(vehEvent); + vehicle2Driver.handleEvent(vehEvent); // No LinkEnterEvent on first link of a leg previousLink = vehEvent.getLinkId(); @@ -77,7 +91,6 @@ public void handleEvent(Event event) { } if (event instanceof VehicleLeavesTrafficEvent) { -// LOG.warn(event.toString()); VehicleLeavesTrafficEvent vehEvent = (VehicleLeavesTrafficEvent) event; Id vehId = vehEvent.getVehicleId(); @@ -86,12 +99,11 @@ public void handleEvent(Event event) { calculateScoreForPreviousLink(vehEvent.getLinkId(), enterTime, vehId, travelTime, previousLinkRelativePosition); // End connection between driver and vehicle - delegate.handleEvent(vehEvent); + vehicle2Driver.handleEvent(vehEvent); } if (event instanceof LinkEnterEvent) { - // This only works because setPassLinkEventsToPerson is activated (via ScoringFunctionsForPopulation) + // This only works since ScoringFunctionsForPopulation passes link events to persons; quite new; dz, june'18 // Otherwise ArbitraryEventScoring only handles events that are instance of HasPersonId, which is not the case for LinkEnterEvents -// LOG.warn(event.toString()); LinkEnterEvent linkEnterEvent = (LinkEnterEvent) event; Id vehId = linkEnterEvent.getVehicleId(); @@ -103,34 +115,66 @@ public void handleEvent(Event event) { carCountOnLink = 0; previousLinkRelativePosition = 0.; previousLinkEnterTime = linkEnterEvent.getTime(); - - } + } } private void calculateScoreForPreviousLink(Id linkId, Double enterTime, Id vehId, double travelTime, double relativeLinkEnterPosition) { if (relativeLinkEnterPosition != 1.0) { - Link link = scenario.getNetwork().getLinks().get(linkId); - Person person = scenario.getPopulation().getPersons().get(delegate.getDriverOfVehicle(vehId)); - Vehicle vehicle = scenario.getVehicles().getVehicles().get(vehId); + // Link link = scenario.getNetwork().getLinks().get(linkId); + // Person person = scenario.getPopulation().getPersons().get(vehicle2Driver.getDriverOfVehicle(vehId)); + // Vehicle vehicle = scenario.getVehicles().getVehicles().get(vehId); double carScoreOffset = -(this.carCountOnLink * 0.04); this.score += carScoreOffset; - LOG.warn("----- link = " + linkId + " -- car score offset = " + carScoreOffset); + // LOG.warn("----- link = " + linkId + " -- car score offset = " + carScoreOffset); + + double scoreOnLink = BicycleUtilityUtils.computeLinkBasedScore(scenario.getNetwork().getLinks().get(linkId), + marginalUtilityOfComfort_m, marginalUtilityOfInfrastructure_m, marginalUtilityOfGradient_m_100m); + // LOG.warn("----- link = " + linkId + " -- scoreOnLink = " + scoreOnLink); + this.score += scoreOnLink; - this.score += bicycleTravelDisutility.getTravelDisutilityBasedOnTTime(link, enterTime, person, vehicle, travelTime); -// LOG.warn("score = " + score + " -- linkId = " + link.getId() + " -- enterTime = " + enterTime + " -- personId = " + person.getId() + " -- travelTime = " + travelTime); + double timeDistanceBasedScoreComponent = computeTimeDistanceBasedScoreComponent(travelTime, scenario.getNetwork().getLinks().get(linkId).getLength()); + // LOG.warn("----- link = " + linkId + " -- timeDistanceBasedScoreComponent = " + timeDistanceBasedScoreComponent); + this.score += timeDistanceBasedScoreComponent; } else { - // If agent was already at the end of the link and thus did not travel on it, do nothing + double timeDistanceBasedScoreComponent = computeTimeDistanceBasedScoreComponent(travelTime, 0.); + this.score += timeDistanceBasedScoreComponent; } - // TODO Use relative position in a more sophisticated way. } + + + // Copied and adapted from CharyparNagelLegScoring + protected double computeTimeDistanceBasedScoreComponent(double travelTime, double dist) { + double tmpScore = 0.0; + ModeUtilityParameters modeParams = this.params.modeParams.get("bicycle"); + if (modeParams == null) { + throw new RuntimeException("no scoring parameters are defined for bicycle") ; + } + tmpScore += travelTime * modeParams.marginalUtilityOfTraveling_s; + if (modeParams.marginalUtilityOfDistance_m != 0.0 || modeParams.monetaryDistanceCostRate != 0.0) { + if ( Double.isNaN(dist) ) { + if ( ccc<10 ) { + ccc++ ; + Logger.getLogger(this.getClass()).warn("distance is NaN. Will make score of this plan NaN. Possible reason: Simulation does not report " + + "a distance for this trip. Possible reason for that: mode is teleported and router does not " + + "write distance into plan. Needs to be fixed or these plans will die out.") ; + if ( ccc==10 ) { + Logger.getLogger(this.getClass()).warn(Gbl.FUTURE_SUPPRESSED) ; + } + } + } + tmpScore += modeParams.marginalUtilityOfDistance_m * dist; + tmpScore += modeParams.monetaryDistanceCostRate * this.params.marginalUtilityOfMoney * dist; + } + tmpScore += modeParams.constant; + return tmpScore; + } + @Override public void handleEvent(MotorizedInteractionEvent event) { -// LOG.info("event received from link " + event.getLinkId()); if (event.getLinkId().equals(previousLink)) { -// LOG.warn("USED: Event from link " + event.getLinkId()); this.carCountOnLink++; } } diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleModule.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleModule.java similarity index 53% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleModule.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleModule.java index 55c43b47ede..4593513ec34 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleModule.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleModule.java @@ -16,24 +16,9 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; -import org.matsim.api.core.v01.Id; -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.network.Link; -import org.matsim.contrib.bicycle.BicycleUtils; -import org.matsim.contrib.bicycle.MotorizedInteractionEngine; -import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.controler.AbstractModule; -import org.matsim.core.mobsim.qsim.qnetsimengine.ConfigurableQNetworkFactory; -import org.matsim.core.mobsim.qsim.qnetsimengine.QNetworkFactory; -import org.matsim.core.mobsim.qsim.qnetsimengine.QVehicle; -import org.matsim.core.mobsim.qsim.qnetsimengine.linkspeedcalculator.DefaultLinkSpeedCalculator; -import org.matsim.core.mobsim.qsim.qnetsimengine.linkspeedcalculator.LinkSpeedCalculator; -import org.matsim.vehicles.VehicleType; - -import com.google.inject.Provides; -import com.google.inject.Singleton; /** * @author smetzler, dziemke @@ -46,32 +31,16 @@ public void install() { bind(BicycleTravelTime.class).asEagerSingleton(); addTravelTimeBinding("bicycle").to(BicycleTravelTime.class); bind(BicycleTravelDisutilityFactory.class).asEagerSingleton(); - addTravelDisutilityFactoryBinding("bicycle").to(BicycleTravelDisutilityFactory.class); - this.bindScoringFunctionFactory().toInstance(new BicycleScoringFunctionFactory()); + addTravelDisutilityFactoryBinding("bicycle").to(BicycleTravelDisutilityFactory.class); + bindScoringFunctionFactory().toInstance(new BicycleScoringFunctionFactory()); + // The following leads to "Tried proxying org.matsim.core.scoring.ScoringFunctionsForPopulation to support a circular dependency, but it is not an interface." +// bindScoringFunctionFactory().to(BicycleScoringFunctionFactory.class); if (considerMotorizedInteraction) { addMobsimListenerBinding().to(MotorizedInteractionEngine.class); } } - @Singleton @Provides - QNetworkFactory provideQNetworkFactory(Scenario scenario, EventsManager eventsManager) { - ConfigurableQNetworkFactory qNetworkFactory = new ConfigurableQNetworkFactory(eventsManager, scenario) ; - qNetworkFactory.setLinkSpeedCalculator(new LinkSpeedCalculator(){ - LinkSpeedCalculator delegate = new DefaultLinkSpeedCalculator() ; - @Override public double getMaximumVelocity(QVehicle vehicle, Link link, double time) { - if ( vehicle.getVehicle().getType().getId().equals( Id.create("bicycle", VehicleType.class) ) ) { -// return vehicle.getMaximumVelocity(); // return the same as vehicleType.getMaximumVelocity() -// return vehicle.getVehicle().getType().getMaximumVelocity(); - return BicycleUtils.getSpeed("bicycle"); - } else { - return delegate.getMaximumVelocity(vehicle, link, time) ; - } - } - }); - return qNetworkFactory; - } - public void setConsiderMotorizedInteraction(boolean considerMotorizedInteraction) { this.considerMotorizedInteraction = considerMotorizedInteraction; } diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicyclePrepareForSimImpl.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicyclePrepareForSimImpl.java similarity index 99% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicyclePrepareForSimImpl.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicyclePrepareForSimImpl.java index fb1c4b7e7e7..413228d113e 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicyclePrepareForSimImpl.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicyclePrepareForSimImpl.java @@ -16,7 +16,7 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; import java.util.HashSet; import java.util.Set; diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleScoringFunctionFactory.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleScoringFunctionFactory.java similarity index 68% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleScoringFunctionFactory.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleScoringFunctionFactory.java index 8da43e60d58..a99f0940d6f 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleScoringFunctionFactory.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleScoringFunctionFactory.java @@ -17,20 +17,17 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.bicycle.MotorizedInteractionEvent; -import org.matsim.contrib.bicycle.MotorizedInteractionEventHandler; +import org.matsim.contrib.bicycle.BicycleConfigGroup.BicycleScoringType; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.scoring.ScoringFunction; import org.matsim.core.scoring.ScoringFunctionFactory; -//import org.matsim.core.scoring.ScoringFunctionsForPopulation; import org.matsim.core.scoring.SumScoringFunction; import org.matsim.core.scoring.functions.CharyparNagelActivityScoring; import org.matsim.core.scoring.functions.CharyparNagelAgentStuckScoring; -import org.matsim.core.scoring.functions.CharyparNagelLegScoring; import org.matsim.core.scoring.functions.ScoringParameters; import org.matsim.core.scoring.functions.ScoringParametersForPerson; @@ -41,51 +38,49 @@ */ public class BicycleScoringFunctionFactory implements ScoringFunctionFactory { @Inject ScoringParametersForPerson parameters; - -// @Inject ScoringFunctionsForPopulation scoringFunctionsForPopulation; - @Inject Scenario scenario; @Inject BicycleTravelTime bicycleTravelTime; - @Inject BicycleTravelDisutilityFactory bicycleTravelDisutilityFactory; @Inject EventsManager eventsManager; - - + @Override - public ScoringFunction createNewScoringFunction(Person person) { + public ScoringFunction createNewScoringFunction(Person person) { SumScoringFunction sumScoringFunction = new SumScoringFunction(); final ScoringParameters params = parameters.getScoringParameters(person); - // No leg scoring here as it would only double-count - // sumScoringFunction.addScoringFunction(new CharyparNagelLegScoring(params, scenario.getNetwork())); sumScoringFunction.addScoringFunction(new CharyparNagelActivityScoring(params)) ; sumScoringFunction.addScoringFunction(new CharyparNagelAgentStuckScoring(params)); -// scoringFunctionsForPopulation.setPassLinkEventsToPerson(true); - // yyyyyy this is the ONLY place where we need to make ScoringFunctionsForPopulation public. Somehow, - // this would imply to me that we should attach this switch to something else. kai, sep'17 - // (now always switched on. kai, apr'18) - - BicycleScoring bicycleScoring = new BicycleScoring(scenario, bicycleTravelTime, bicycleTravelDisutilityFactory); - sumScoringFunction.addScoringFunction(bicycleScoring); - - CarCounter carCounter = new CarCounter(bicycleScoring); - eventsManager.addHandler(carCounter); + BicycleConfigGroup bicycleConfigGroup = (BicycleConfigGroup) scenario.getConfig().getModule("bicycle"); + BicycleScoringType bicycleScoringType = bicycleConfigGroup.getBicycleScoringType(); + if (bicycleScoringType == BicycleScoringType.legBased) { + sumScoringFunction.addScoringFunction(new BicycleLegScoring(params, scenario.getNetwork(), bicycleConfigGroup)); + } else if (bicycleScoringType == BicycleScoringType.linkBased) { + BicycleLinkScoring bicycleLinkScoring = new BicycleLinkScoring(params, scenario, bicycleConfigGroup); + sumScoringFunction.addScoringFunction(bicycleLinkScoring); + + CarCounter carCounter = new CarCounter(bicycleLinkScoring); + eventsManager.addHandler(carCounter); + } else { + throw new IllegalArgumentException("Bicycle scoring type " + bicycleScoringType + " not known."); + } + return sumScoringFunction; } + private class CarCounter implements MotorizedInteractionEventHandler { - private BicycleScoring bicycleScoring; + private BicycleLinkScoring bicycleLinkScoring; - public CarCounter(BicycleScoring bicycleScoring) { - this.bicycleScoring = bicycleScoring; + public CarCounter(BicycleLinkScoring bicycleLinkScoring) { + this.bicycleLinkScoring = bicycleLinkScoring; } @Override public void handleEvent(MotorizedInteractionEvent event) { - bicycleScoring.handleEvent(event); + bicycleLinkScoring.handleEvent(event); } } -} +} \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleUtils.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleSpeedUtils.java similarity index 78% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleUtils.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleSpeedUtils.java index cc5181b74c0..2d8a122104e 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleUtils.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleSpeedUtils.java @@ -19,15 +19,20 @@ package org.matsim.contrib.bicycle; /** - * @author amit, dziemke + * This is just an intermediate solution until + * https://matsim.atlassian.net/browse/MATSIM-700 + * is fixed. + * + * @author dziemke based on amit */ -public class BicycleUtils { - +@Deprecated +public class BicycleSpeedUtils { public static double getSpeed(final String travelMode){ double speed; - switch (travelMode) { - case "bicycle": speed = 4.17; break; - default: throw new RuntimeException("No speed is set for travel mode "+travelMode+ "."); + if (travelMode == "bicycle") { + speed = 20.0/3.6; + } else { + throw new RuntimeException("No speed is set for travel mode " + travelMode + "."); } return speed; } diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutility.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutility.java new file mode 100644 index 00000000000..448daec6e27 --- /dev/null +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutility.java @@ -0,0 +1,165 @@ +/* *********************************************************************** * + * project: org.matsim.* * + * * + * *********************************************************************** * + * * + * copyright : (C) 2008 by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** */ +package org.matsim.contrib.bicycle; + +import java.util.Random; + +import org.apache.log4j.Logger; +import org.matsim.api.core.v01.network.Link; +import org.matsim.api.core.v01.population.Person; +import org.matsim.core.config.groups.PlanCalcScoreConfigGroup; +import org.matsim.core.config.groups.PlansCalcRouteConfigGroup; +import org.matsim.core.gbl.MatsimRandom; +import org.matsim.core.router.util.TravelDisutility; +import org.matsim.core.router.util.TravelTime; +import org.matsim.vehicles.Vehicle; + +/** + * @author smetzler, dziemke + * based on RandomizingTimeDistanceTravelDisutility and adding more components + */ +public class BicycleTravelDisutility implements TravelDisutility { + private static final Logger LOG = Logger.getLogger(BicycleTravelDisutility.class); + + private final double marginalCostOfTime_s; + private final double marginalCostOfDistance_m; + private final double marginalCostOfInfrastructure_m; + private final double marginalCostOfComfort_m; + private final double marginalCostOfGradient_m_100m; + + private final double normalization; + private final double sigma; + + private final Random random; + + private final TravelTime timeCalculator; + + // "cache" of the random value + private double normalRndLink; + private double logNormalRndDist; + private double logNormalRndInf; + private double logNormalRndComf; + private double logNormalRndGrad; + private Person prevPerson; + + + BicycleTravelDisutility(BicycleConfigGroup bicycleConfigGroup, PlanCalcScoreConfigGroup cnScoringGroup, + PlansCalcRouteConfigGroup plansCalcRouteConfigGroup, TravelTime timeCalculator, double normalization) { + final PlanCalcScoreConfigGroup.ModeParams bicycleParams = cnScoringGroup.getModes().get("bicycle"); + if (bicycleParams == null) { + throw new NullPointerException("Bicycle is not part of the valid mode parameters " + cnScoringGroup.getModes().keySet()); + } + + this.marginalCostOfDistance_m = -(bicycleParams.getMonetaryDistanceRate() * cnScoringGroup.getMarginalUtilityOfMoney()) + - bicycleParams.getMarginalUtilityOfDistance(); + this.marginalCostOfTime_s = -(bicycleParams.getMarginalUtilityOfTraveling() / 3600.0) + cnScoringGroup.getPerforming_utils_hr() / 3600.0; + + this.marginalCostOfInfrastructure_m = -(bicycleConfigGroup.getMarginalUtilityOfInfrastructure_m()); + this.marginalCostOfComfort_m = -(bicycleConfigGroup.getMarginalUtilityOfComfort_m()); + this.marginalCostOfGradient_m_100m = -(bicycleConfigGroup.getMarginalUtilityOfGradient_m_100m()); + + this.timeCalculator = timeCalculator; + + this.normalization = normalization; + this.sigma = plansCalcRouteConfigGroup.getRoutingRandomness(); + this.random = sigma != 0 ? MatsimRandom.getLocalInstance() : null; + } + + @Override + public double getLinkTravelDisutility(Link link, double time, Person person, Vehicle vehicle) { + double travelTime = timeCalculator.getLinkTravelTime(link, time, person, vehicle); + + String surface = (String) link.getAttributes().getAttribute(BicycleLabels.SURFACE); + String type = (String) link.getAttributes().getAttribute("type"); + String cyclewaytype = (String) link.getAttributes().getAttribute(BicycleLabels.CYCLEWAY); + + double distance = link.getLength(); + + double travelTimeDisutility = marginalCostOfTime_s * travelTime; + double distanceDisutility = marginalCostOfDistance_m * distance; + + double comfortFactor = BicycleUtilityUtils.getComfortFactor(surface, type); + double comfortDisutility = marginalCostOfComfort_m * (1. - comfortFactor) * distance; + + double infrastructureFactor = BicycleUtilityUtils.getInfrastructureFactor(type, cyclewaytype); + double infrastructureDisutility = marginalCostOfInfrastructure_m * (1. - infrastructureFactor) * distance; + + double gradientFactor = BicycleUtilityUtils.getGradientFactor(link); + double gradientDisutility = marginalCostOfGradient_m_100m * gradientFactor * distance; + +// LOG.warn("link = " + link.getId() + "-- travelTime = " + travelTime + " -- distance = " + distance + " -- comfortFactor = " +// + comfortFactor + " -- infraFactor = "+ infrastructureFactor + " -- gradient = " + gradientFactor); + + // TODO Gender + // TODO Activity + // TODO Other influence factors + + // randomize if applicable: + if (sigma != 0.) { + if (person==null) { + throw new RuntimeException("you cannot use the randomzing travel disutility without person. If you need this without a person, set" + + "sigma to zero.") ; + } + normalRndLink = 0.05 * random.nextGaussian(); + if (person != prevPerson) { + prevPerson = person; + + logNormalRndDist = Math.exp(sigma * random.nextGaussian()); + logNormalRndInf = Math.exp(sigma * random.nextGaussian()); + logNormalRndComf = Math.exp(sigma * random.nextGaussian()); + logNormalRndGrad = Math.exp(sigma * random.nextGaussian()); + logNormalRndDist *= normalization; + logNormalRndInf *= normalization; + logNormalRndComf *= normalization; + logNormalRndGrad *= normalization; + // this should be a log-normal distribution with sigma as the "width" parameter. Instead of figuring out the "location" + // parameter mu, I rather just normalize (which should be the same, see next). kai, nov'13 + + /* The argument is something like this:
    + *
  • exp( mu + sigma * Z) with Z = Gaussian generates lognormal with mu and sigma. + *
  • The mean of this is exp( mu + sigma^2/2 ) . + *
  • If we set mu=0, the expectation value is exp( sigma^2/2 ) . + *
  • So in order to set the expectation value to one (which is what we want), we need to divide by exp( sigma^2/2 ) . + *
+ * Should be tested. kai, jan'14 */ + } + } else { + normalRndLink = 1.; + logNormalRndDist = 1.; + logNormalRndInf = 1.; + logNormalRndComf = 1.; + logNormalRndGrad = 1.; + } + +// LOG.warn("Person = " + person.getId() + " / link = " + link.getId() + " / ttD = " + travelTimeDisutility + " / dD = "+ distanceDisutility +// + " / infD = " + infrastructureDisutility + " / comfD = " + comfortDisutility + " / gradD = " + gradientDisutility + " / rnd = " + normalRndLink +// + " / rndDist = " + logNormalRndDist + " / rndInf = " + logNormalRndInf + " / rndComf = " + logNormalRndComf + " / rndGrad = " + logNormalRndGrad); + double disutility = (1 + normalRndLink) * travelTimeDisutility + logNormalRndDist * distanceDisutility + logNormalRndInf * infrastructureDisutility + + logNormalRndComf * comfortDisutility + logNormalRndGrad * gradientDisutility; +// double disutility = travelTimeDisutility + logNormalRndDist * distanceDisutility + (1 + normalRndLink) * logNormalRndInf * infrastructureDisutility +// + (1 + normalRndLink) * logNormalRndComf * comfortDisutility + (1 + normalRndLink) * logNormalRndGrad * gradientDisutility; +// LOG.warn("Disutility = " + disutility); + return disutility; + } + + @Override + public double getLinkMinimumTravelDisutility(Link link) { + return 0; + } +} \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelDisutilityFactory.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutilityFactory.java similarity index 74% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelDisutilityFactory.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutilityFactory.java index 39b7928eb56..b50eced3e6d 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelDisutilityFactory.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutilityFactory.java @@ -16,11 +16,13 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; -import org.matsim.api.core.v01.network.Network; +import org.apache.log4j.Logger; +//import org.matsim.api.core.v01.Scenario; import org.matsim.core.config.groups.PlanCalcScoreConfigGroup; import org.matsim.core.config.groups.PlansCalcRouteConfigGroup; +//import org.matsim.core.router.costcalculators.RandomizingTimeDistanceTravelDisutilityFactory; import org.matsim.core.router.costcalculators.TravelDisutilityFactory; import org.matsim.core.router.util.TravelDisutility; import org.matsim.core.router.util.TravelTime; @@ -31,14 +33,26 @@ * @author smetzler, dziemke */ public class BicycleTravelDisutilityFactory implements TravelDisutilityFactory { + private static final Logger LOG = Logger.getLogger(BicycleTravelDisutilityFactory.class); @Inject BicycleConfigGroup bicycleConfigGroup; @Inject PlanCalcScoreConfigGroup cnScoringGroup; @Inject PlansCalcRouteConfigGroup plansCalcRouteConfigGroup; - @Inject Network network; // TODO only needed as long as network mode filtering kicks out attributes; remove when possible, dz, sep'17 + + private static int normalisationWrnCnt = 0; @Override public TravelDisutility createTravelDisutility(TravelTime timeCalculator) { - return new BicycleTravelDisutility(bicycleConfigGroup, cnScoringGroup, plansCalcRouteConfigGroup, timeCalculator, network); + double sigma = plansCalcRouteConfigGroup.getRoutingRandomness(); + + double normalization = 1; + if ( sigma != 0. ) { + normalization = 1. / Math.exp(sigma * sigma / 2); + if (normalisationWrnCnt < 10) { + normalisationWrnCnt++; + LOG.info(" sigma: " + sigma + "; resulting normalization: " + normalization); + } + } + return new BicycleTravelDisutility(bicycleConfigGroup, cnScoringGroup, plansCalcRouteConfigGroup, timeCalculator, normalization); } } \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutilityV2.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutilityV2.java new file mode 100644 index 00000000000..f114fe30791 --- /dev/null +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelDisutilityV2.java @@ -0,0 +1,107 @@ +/* *********************************************************************** * + * project: org.matsim.* * + * * + * *********************************************************************** * + * * + * copyright : (C) 2008 by the members listed in the COPYING, * + * LICENSE and WARRANTY file. * + * email : info at matsim dot org * + * * + * *********************************************************************** * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * See also COPYING, LICENSE and WARRANTY file * + * * + * *********************************************************************** */ +package org.matsim.contrib.bicycle; + +import org.apache.log4j.Logger; +import org.matsim.api.core.v01.network.Link; +import org.matsim.api.core.v01.network.Network; +import org.matsim.api.core.v01.population.Person; +import org.matsim.core.config.groups.PlanCalcScoreConfigGroup; +import org.matsim.core.router.util.TravelDisutility; +import org.matsim.vehicles.Vehicle; + +/** + * @author smetzler, dziemke + */ +public class BicycleTravelDisutilityV2 implements TravelDisutility { + private static final Logger LOG = Logger.getLogger(BicycleTravelDisutilityV2.class); + + private final double marginalCostOfInfrastructure_m; + private final double marginalCostOfComfort_m; + private final double marginalCostOfGradient_m_100m; + + private final Network network; + + private final TravelDisutility timeDistanceDisutility; + + + BicycleTravelDisutilityV2(Network network, TravelDisutility timeDistanceDisutility, BicycleConfigGroup bicycleConfigGroup, PlanCalcScoreConfigGroup cnScoringGroup) { + this.timeDistanceDisutility = timeDistanceDisutility; + + final PlanCalcScoreConfigGroup.ModeParams bicycleParams = cnScoringGroup.getModes().get("bicycle"); + if (bicycleParams == null) { + throw new NullPointerException("Bicycle is not part of the valid mode parameters " + cnScoringGroup.getModes().keySet()); + } + + this.marginalCostOfInfrastructure_m = -(bicycleConfigGroup.getMarginalUtilityOfInfrastructure_m()); + this.marginalCostOfComfort_m = -(bicycleConfigGroup.getMarginalUtilityOfComfort_m()); + this.marginalCostOfGradient_m_100m = -(bicycleConfigGroup.getMarginalUtilityOfGradient_m_100m()); + + // TODO Needed as long as network mode filtering kicks out attributes; remove when possible, dz, sep'17 + // Also see comments in BicycleTravelDisutilityFactory + this.network = network; + } + + + @Override + public double getLinkTravelDisutility(Link link, double time, Person person, Vehicle vehicle) { + // TODO Needed as long as network mode filtering kicks out attributes; remove when possible, dz, sep'17 + Link linkWithAttributes = network.getLinks().get(link.getId()); + + String surface = (String) linkWithAttributes.getAttributes().getAttribute(BicycleLabels.SURFACE); + String type = (String) linkWithAttributes.getAttributes().getAttribute("type"); + String cyclewaytype = (String) linkWithAttributes.getAttributes().getAttribute(BicycleLabels.CYCLEWAY); + + double distance = linkWithAttributes.getLength(); + + double comfortFactor = BicycleUtilityUtils.getComfortFactor(surface, type); + double comfortDisutility = marginalCostOfComfort_m * (1. - comfortFactor) * distance; + + double infrastructureFactor = BicycleUtilityUtils.getInfrastructureFactor(type, cyclewaytype); + double infrastructureDisutility = marginalCostOfInfrastructure_m * (1. - infrastructureFactor) * distance; + + double gradientFactor = BicycleUtilityUtils.getGradientFactor(linkWithAttributes); + double gradientDisutility = marginalCostOfGradient_m_100m * gradientFactor * distance; + +// LOG.warn("link = " + link.getId() + "-- travelTime = " + travelTime + " -- distance = " + distance + " -- comfortFactor = " +// + comfortFactor + " -- infraFactor = "+ infrastructureFactor + " -- gradient = " + gradientFactor); + + // TODO Gender + // TODO Activity + // TODO Other influence factors + + double linkTimeDistanceDisutility = timeDistanceDisutility.getLinkTravelDisutility(link, time, person, vehicle); + + // New idea + double logNormalRnd = (double) person.getAttributes().getAttribute("logNormalRnd"); + // + + LOG.warn("person = " + person.getId() + " / link = " + linkWithAttributes.getId() + " / infrastructureDisutility = " + infrastructureDisutility + " / comfortDisutility = " + + comfortDisutility + " / gradientDisutility = " + gradientDisutility + " / randomfactor = " + logNormalRnd); + double disutility = linkTimeDistanceDisutility + logNormalRnd * (infrastructureDisutility + comfortDisutility + gradientDisutility); + LOG.warn("---------- disutility = " + disutility); + return disutility; + } + + + @Override + public double getLinkMinimumTravelDisutility(Link link) { + return 0; + } +} \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelTime.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelTime.java similarity index 95% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelTime.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelTime.java index 8bf02f4f6a2..4513f5c7fe5 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelTime.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleTravelTime.java @@ -16,12 +16,10 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; import org.matsim.api.core.v01.network.Link; import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.bicycle.BicycleLabels; -import org.matsim.contrib.bicycle.BicycleUtils; import org.matsim.core.router.util.TravelTime; import org.matsim.vehicles.Vehicle; @@ -40,8 +38,11 @@ public double getLinkTravelTime(Link link, double time, Person person, Vehicle v double cyclingInfrastructureSpeed = computeMinimumCyclingInfrastructureSpeed(type, cycleway, minimumSpeedForDedicatedCyclingInfrastructure); double infrastructureSpeed = Math.max(link.getFreespeed(), cyclingInfrastructureSpeed); - - double vehicleLinkSpeed = Math.min(infrastructureSpeed, BicycleUtils.getSpeed("bicycle")); + + // This is not yet available, but might be at some point, see https://matsim.atlassian.net/browse/MATSIM-700 + // double bicycleVelocity = vehicle.getType().getMaximumVelocity() + // ... until then, use this workaround: + double vehicleLinkSpeed = Math.min(infrastructureSpeed, BicycleSpeedUtils.getSpeed("bicycle")); double gradientSpeed = computeGradientSpeed(link, vehicleLinkSpeed); diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelDisutility.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleUtilityUtils.java similarity index 51% rename from contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelDisutility.java rename to contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleUtilityUtils.java index 8d3aa85be97..97c90472b68 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleTravelDisutility.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/BicycleUtilityUtils.java @@ -1,9 +1,9 @@ /* *********************************************************************** * - * project: org.matsim.* * + * project: org.matsim.* * * * * *********************************************************************** * * * - * copyright : (C) 2008 by the members listed in the COPYING, * + * copyright : (C) 2014 by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * @@ -16,117 +16,35 @@ * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; +package org.matsim.contrib.bicycle; -import java.util.Random; - -import org.apache.log4j.Logger; import org.matsim.api.core.v01.network.Link; -import org.matsim.api.core.v01.network.Network; -import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.bicycle.BicycleLabels; -import org.matsim.core.config.groups.PlanCalcScoreConfigGroup; -import org.matsim.core.config.groups.PlansCalcRouteConfigGroup; -import org.matsim.core.gbl.MatsimRandom; -import org.matsim.core.router.util.TravelDisutility; -import org.matsim.core.router.util.TravelTime; -import org.matsim.vehicles.Vehicle; /** - * @author smetzler, dziemke + * @author dziemke */ -public class BicycleTravelDisutility implements TravelDisutility { - private static final Logger LOG = Logger.getLogger(BicycleTravelDisutility.class); - - private final double marginalCostOfTime_s; - private final double marginalCostOfDistance_m; - private final double marginalCostOfInfrastructure_m; - private final double marginalCostOfComfort_m; - private final double marginalCostOfGradient_m_100m; - private final double sigma; - private final TravelTime timeCalculator; - private final Network network; - - private static int normalisationWrnCnt = 0; - - BicycleTravelDisutility(BicycleConfigGroup bicycleConfigGroup, PlanCalcScoreConfigGroup cnScoringGroup, - PlansCalcRouteConfigGroup plansCalcRouteConfigGroup, TravelTime timeCalculator, Network network) { - final PlanCalcScoreConfigGroup.ModeParams bicycleParams = cnScoringGroup.getModes().get("bicycle"); - if (bicycleParams == null) { - throw new NullPointerException("Bicycle is not part of the valid mode parameters " + cnScoringGroup.getModes().keySet()); - } - - this.marginalCostOfDistance_m = -(bicycleParams.getMonetaryDistanceRate() * cnScoringGroup.getMarginalUtilityOfMoney()) - - bicycleParams.getMarginalUtilityOfDistance(); - this.marginalCostOfTime_s = -(bicycleParams.getMarginalUtilityOfTraveling() / 3600.0) + cnScoringGroup.getPerforming_utils_hr() / 3600.0; - - this.marginalCostOfInfrastructure_m = -(bicycleConfigGroup.getMarginalUtilityOfInfrastructure_m()); - this.marginalCostOfComfort_m = -(bicycleConfigGroup.getMarginalUtilityOfComfort_m()); - this.marginalCostOfGradient_m_100m = -(bicycleConfigGroup.getMarginalUtilityOfGradient_m_100m()); - - // Does not seem to be implemented yet - // this.sigma = plansCalcRouteConfigGroup.getRoutingRandomness(); - this.sigma = 0.2; - //this.sigma = 0.0; - - this.timeCalculator = timeCalculator; - - // TODO only needed as long as network mode filtering kicks out attributes; remove when possible, dz, sep'17 - this.network = network; - } - - @Override - public double getLinkTravelDisutility(Link link, double time, Person person, Vehicle vehicle) { - Link linkWithAttributes = network.getLinks().get(link.getId()); - double travelTime = timeCalculator.getLinkTravelTime(linkWithAttributes, time, person, vehicle); - return getTravelDisutilityBasedOnTTime(linkWithAttributes, time, person, vehicle, travelTime); - } - - public double getTravelDisutilityBasedOnTTime(Link link, double enterTime, Person person, Vehicle vehicle, double travelTime) { +public class BicycleUtilityUtils { + + public static double computeLinkBasedScore(Link link, double marginalUtilityOfComfort_m, + double marginalUtilityOfInfrastructure_m, double marginalUtilityOfGradient_m_100m) { String surface = (String) link.getAttributes().getAttribute(BicycleLabels.SURFACE); String type = (String) link.getAttributes().getAttribute("type"); String cyclewaytype = (String) link.getAttributes().getAttribute(BicycleLabels.CYCLEWAY); double distance = link.getLength(); - double travelTimeDisutility = marginalCostOfTime_s * travelTime; - double distanceDisutility = marginalCostOfDistance_m * distance; + double comfortFactor = BicycleUtilityUtils.getComfortFactor(surface, type); + double comfortDisutility = marginalUtilityOfComfort_m * (1. - comfortFactor) * distance; - double comfortFactor = getComfortFactor(surface, type); - double comfortDisutility = marginalCostOfComfort_m * (1. - comfortFactor) * distance; + double infrastructureFactor = BicycleUtilityUtils.getInfrastructureFactor(type, cyclewaytype); + double infrastructureDisutility = marginalUtilityOfInfrastructure_m * (1. - infrastructureFactor) * distance; - double infrastructureFactor = getInfrastructureFactor(type, cyclewaytype); - double infrastructureDisutility = marginalCostOfInfrastructure_m * (1. - infrastructureFactor) * distance; - - double gradientFactor = getGradientFactor(link); - double gradientDisutility = marginalCostOfGradient_m_100m * gradientFactor * distance; - -// LOG.warn("link = " + link.getId() + "-- travelTime = " + travelTime + " -- distance = " + distance + " -- comfortFactor = " -// + comfortFactor + " -- infraFactor = "+ infrastructureFactor + " -- gradient = " + gradientFactor); - - // TODO Gender - // TODO Activity - // TODO Other influence factors - - double normalization = 1; - if (sigma != 0.) { - normalization = 1. / Math.exp(this.sigma * this.sigma / 2); - if (normalisationWrnCnt < 10) { - normalisationWrnCnt++; - LOG.info("Sigma = " + this.sigma + " -- resulting normalization: " + normalization); - } - } - Random random2 = MatsimRandom.getLocalInstance(); // Make sure that stream of random variables is reproducible. dz, aug'17 - double logNormalRnd = Math.exp(sigma * random2.nextGaussian()); - logNormalRnd *= normalization; - -// LOG.warn("link = " + link.getId() + " -- travelTimeDisutility = " + travelTimeDisutility + " -- distanceDisutility = "+ distanceDisutility -// + " -- infrastructureDisutility = " + infrastructureDisutility + " -- comfortDisutility = " -// + comfortDisutility + " -- gradientDisutility = " + gradientDisutility + " -- randomfactor = " + logNormalRnd); - return (travelTimeDisutility + logNormalRnd * (distanceDisutility + infrastructureDisutility + comfortDisutility + gradientDisutility)); + double gradientFactor = BicycleUtilityUtils.getGradientFactor(link); + double gradientDisutility = marginalUtilityOfGradient_m_100m * gradientFactor * distance; + return (infrastructureDisutility + comfortDisutility + gradientDisutility); } - - private double getGradientFactor(Link link) { + + public static double getGradientFactor(Link link) { double gradient = 0.; Double fromNodeZ = link.getFromNode().getCoord().getZ(); Double toNodeZ = link.getToNode().getCoord().getZ(); @@ -138,8 +56,8 @@ private double getGradientFactor(Link link) { return gradient; } - // TODO combine this with speeds - private double getComfortFactor(String surface, String type) { + // TODO Combine this with speeds? + public static double getComfortFactor(String surface, String type) { double comfortFactor = 1.0; if (surface != null) { switch (surface) { @@ -187,7 +105,7 @@ private double getComfortFactor(String surface, String type) { return comfortFactor; } - private double getInfrastructureFactor(String type, String cyclewaytype) { + public static double getInfrastructureFactor(String type, String cyclewaytype) { double infrastructureFactor = 1.0; if (type != null) { if (type.equals("trunk")) { @@ -236,9 +154,4 @@ private double getInfrastructureFactor(String type, String cyclewaytype) { } return infrastructureFactor; } - - @Override - public double getLinkMinimumTravelDisutility(Link link) { - return 0; - } } \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleEquil.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleEquil.java deleted file mode 100644 index 33339a66684..00000000000 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/BicycleEquil.java +++ /dev/null @@ -1,76 +0,0 @@ -/* *********************************************************************** * - * project: org.matsim.* * - * * - * *********************************************************************** * - * * - * copyright : (C) 2008 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** */ -package org.matsim.contrib.bicycle.run; - -import org.matsim.api.core.v01.Id; -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.TransportMode; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.core.config.groups.QSimConfigGroup; -import org.matsim.core.controler.Controler; -import org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting; -import org.matsim.core.scenario.ScenarioUtils; -import org.matsim.vehicles.VehicleType; -import org.matsim.vehicles.VehicleUtils; - -/** - * @author dziemke - */ -public class BicycleEquil { - - public static void main(String[] args) { - // This works when the data is stored under "/matsim/contribs/bicycle/src/main/resurces/bicycle_example" - Config config = ConfigUtils.loadConfig("../../../shared-svn/studies/countries/de/berlin-bike/equil/config-a-motor.xml", new BicycleConfigGroup()); - new BicycleEquil().run(config); - } - - public void run(Config config) { -// config.plansCalcRoute().setInsertingAccessEgressWalk(true); - config.global().setNumberOfThreads(1); - config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); - config.controler().setLastIteration(10); - - // New, yet to be applied - config.plansCalcRoute().setRoutingRandomness(0.2); - // - - Scenario scenario = ScenarioUtils.loadScenario(config); - - VehicleType car = VehicleUtils.getFactory().createVehicleType(Id.create(TransportMode.car, VehicleType.class)); - car.setMaximumVelocity(60.0/3.6); - car.setPcuEquivalents(1.0); - scenario.getVehicles().addVehicleType(car); - - VehicleType bicycle = VehicleUtils.getFactory().createVehicleType(Id.create("bicycle", VehicleType.class)); - bicycle.setMaximumVelocity(30.0/3.6); - bicycle.setPcuEquivalents(0.25); - scenario.getVehicles().addVehicleType(bicycle); - - scenario.getConfig().qsim().setVehiclesSource(QSimConfigGroup.VehiclesSource.modeVehicleTypesFromVehiclesData); - - Controler controler = new Controler(scenario); - - BicycleModule bicycleModule = new BicycleModule(); - bicycleModule.setConsiderMotorizedInteraction(true); - controler.addOverridingModule(bicycleModule); - - controler.run(); - } -} \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/RunBicycleExample.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/RunBicycleExample.java index d7a2f261722..621eba9a427 100644 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/RunBicycleExample.java +++ b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/RunBicycleExample.java @@ -18,12 +18,21 @@ * *********************************************************************** */ package org.matsim.contrib.bicycle.run; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.Scenario; import org.matsim.api.core.v01.TransportMode; +import org.matsim.contrib.bicycle.BicycleConfigGroup; +import org.matsim.contrib.bicycle.BicycleModule; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; +import org.matsim.core.config.groups.PlanCalcScoreConfigGroup.ActivityParams; +import org.matsim.core.config.groups.PlanCalcScoreConfigGroup.ModeParams; import org.matsim.core.config.groups.QSimConfigGroup; +import org.matsim.core.config.groups.StrategyConfigGroup.StrategySettings; import org.matsim.core.controler.Controler; import org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting; import org.matsim.core.scenario.ScenarioUtils; @@ -34,40 +43,102 @@ * @author dziemke */ public class RunBicycleExample { + private static final Logger LOG = Logger.getLogger(RunBicycleExample.class); public static void main(String[] args) { - // This works when the data is stored under "/matsim/contribs/bicycle/src/main/resurces/bicycle_example" - Config config = ConfigUtils.loadConfig("bicycle_example/config.xml", new BicycleConfigGroup()); - new RunBicycleExample().run(config); + Config config; + if (args.length == 1) { + LOG.info("A user-specified config.xml file was provided. Using it..."); + config = ConfigUtils.loadConfig(args[0], new BicycleConfigGroup()); + fillConfigWithBicycleStandardValues(config); + } else if (args.length == 0) { + LOG.info("No config.xml file was provided. Using 'standard' example files given in this contrib's resources folder."); + // Setting the context like this works when the data is stored under "/matsim/contribs/bicycle/src/main/resources/bicycle_example" + config = ConfigUtils.createConfig("bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + fillConfigWithBicycleStandardValues(config); + + config.network().setInputFile("network_lane.xml"); // Modify this + config.plans().setInputFile("population_1200.xml"); + } else { + throw new RuntimeException("More than one argument was provided. There is no procedure for this situation. Thus aborting!" + + " Provide either (1) only a suitable config file or (2) no argument at all to run example with given example of resources folder."); + } + config.controler().setLastIteration(100); // Modify if motorized interaction is used + boolean considerMotorizedInteraction = false; + + new RunBicycleExample().run(config, considerMotorizedInteraction); } - public void run(Config config) { -// config.plansCalcRoute().setInsertingAccessEgressWalk(true); + public void run(Config config, boolean considerMotorizedInteraction) { config.global().setNumberOfThreads(1); config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); - config.controler().setLastIteration(0); - // New, yet to be applied - config.plansCalcRoute().setRoutingRandomness(0.2); - // + config.plansCalcRoute().setRoutingRandomness(3.); Scenario scenario = ScenarioUtils.loadScenario(config); VehicleType car = VehicleUtils.getFactory().createVehicleType(Id.create(TransportMode.car, VehicleType.class)); - car.setMaximumVelocity(60.0/3.6); - car.setPcuEquivalents(1.0); scenario.getVehicles().addVehicleType(car); VehicleType bicycle = VehicleUtils.getFactory().createVehicleType(Id.create("bicycle", VehicleType.class)); - bicycle.setMaximumVelocity(30.0/3.6); - bicycle.setPcuEquivalents(0.0); + bicycle.setMaximumVelocity(20.0/3.6); + bicycle.setPcuEquivalents(0.25); scenario.getVehicles().addVehicleType(bicycle); scenario.getConfig().qsim().setVehiclesSource(QSimConfigGroup.VehiclesSource.modeVehicleTypesFromVehiclesData); Controler controler = new Controler(scenario); - controler.addOverridingModule(new BicycleModule()); + BicycleModule bicycleModule = new BicycleModule(); + if (considerMotorizedInteraction) { + bicycleModule.setConsiderMotorizedInteraction(true); + } + controler.addOverridingModule(bicycleModule); controler.run(); } + + public static void fillConfigWithBicycleStandardValues(Config config) { + config.controler().setWriteEventsInterval(1); + + BicycleConfigGroup bicycleConfigGroup = (BicycleConfigGroup) config.getModules().get(BicycleConfigGroup.GROUP_NAME); + bicycleConfigGroup.addParam("marginalUtilityOfInfrastructure_m", "-0.0002"); + bicycleConfigGroup.addParam("marginalUtilityOfComfort_m", "-0.0002"); + bicycleConfigGroup.addParam("marginalUtilityOfGradient_m_100m", "-0.02"); + + List mainModeList = new ArrayList<>(); + mainModeList.add("bicycle"); + mainModeList.add(TransportMode.car); + config.qsim().setMainModes(mainModeList); + + config.strategy().setMaxAgentPlanMemorySize(5); + { + StrategySettings strategySettings = new StrategySettings(); + strategySettings.setStrategyName("ChangeExpBeta"); + strategySettings.setWeight(0.8); + config.strategy().addStrategySettings(strategySettings); + }{ + StrategySettings strategySettings = new StrategySettings(); + strategySettings.setStrategyName("ReRoute"); + strategySettings.setWeight(0.2); + config.strategy().addStrategySettings(strategySettings); + } + + ActivityParams homeActivity = new ActivityParams("home"); + homeActivity.setTypicalDuration(12*60*60); + config.planCalcScore().addActivityParams(homeActivity); + + ActivityParams workActivity = new ActivityParams("work"); + workActivity.setTypicalDuration(8*60*60); + config.planCalcScore().addActivityParams(workActivity); + + ModeParams bicycle = new ModeParams("bicycle"); + bicycle.setConstant(0.); + bicycle.setMarginalUtilityOfDistance(-0.0004); // util/m + bicycle.setMarginalUtilityOfTraveling(-6.0); // util/h + bicycle.setMonetaryDistanceRate(0.); + config.planCalcScore().addModeParams(bicycle); + + config.plansCalcRoute().setNetworkModes(mainModeList); + } } \ No newline at end of file diff --git a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/package-info.java b/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/package-info.java deleted file mode 100644 index fcee53310b9..00000000000 --- a/contribs/bicycle/src/main/java/org/matsim/contrib/bicycle/run/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * @author dziemke - */ -package org.matsim.contrib.bicycle.run; \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/4_cycleway_bikeObjectAtt.xml b/contribs/bicycle/src/main/resources/bicycle_example/4_cycleway_bikeObjectAtt.xml deleted file mode 100644 index 21b714c4236..00000000000 --- a/contribs/bicycle/src/main/resources/bicycle_example/4_cycleway_bikeObjectAtt.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - primary - - - lane - primary - - - lane - primary - - - lane - primary - - - primary - - - primary - - - primary - - - lane - primary - - - lane - primary - - - lane - primary - - - lane - primary - - - lane - primary - - - lane - primary - - - primary - - - primary - - - primary - - - lane - primary - - - lane - primary - - - lane - primary - - - primary - - - primary - - - primary - - - primary - - \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/4_cycleway_network.xml b/contribs/bicycle/src/main/resources/bicycle_example/4_cycleway_network.xml deleted file mode 100644 index 8eb49e4d1ec..00000000000 --- a/contribs/bicycle/src/main/resources/bicycle_example/4_cycleway_network.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_cobblestone.xml b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_cobblestone.xml new file mode 100644 index 00000000000..bf4718c7862 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_cobblestone.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_gradient.xml b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_gradient.xml new file mode 100644 index 00000000000..603dba3350d --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_gradient.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_gradient_lane.xml b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_gradient_lane.xml new file mode 100644 index 00000000000..454bb2f2e8f --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_gradient_lane.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_lane.xml b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_lane.xml new file mode 100644 index 00000000000..93fd00aac1d --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_lane.xml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_normal.xml b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_normal.xml new file mode 100644 index 00000000000..f503110eea4 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_normal.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_pedestrian.xml b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_pedestrian.xml new file mode 100644 index 00000000000..8a1d873e82d --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/alternative_nw/network_pedestrian.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/config.xml b/contribs/bicycle/src/main/resources/bicycle_example/config.xml deleted file mode 100644 index 0fa51dffadd..00000000000 --- a/contribs/bicycle/src/main/resources/bicycle_example/config.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/network_cobblestone.xml b/contribs/bicycle/src/main/resources/bicycle_example/network_cobblestone.xml new file mode 100644 index 00000000000..7d039ec2186 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/network_cobblestone.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + cobblestone + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/network_gradient.xml b/contribs/bicycle/src/main/resources/bicycle_example/network_gradient.xml new file mode 100644 index 00000000000..0bfd67f84f6 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/network_gradient.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/network_gradient_lane.xml b/contribs/bicycle/src/main/resources/bicycle_example/network_gradient_lane.xml new file mode 100644 index 00000000000..7bc3845b489 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/network_gradient_lane.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/network_lane.xml b/contribs/bicycle/src/main/resources/bicycle_example/network_lane.xml new file mode 100644 index 00000000000..13f9ef58348 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/network_lane.xml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + lane + + + + + primary + lane + + + + + primary + lane + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/network_normal.xml b/contribs/bicycle/src/main/resources/bicycle_example/network_normal.xml new file mode 100644 index 00000000000..954397ac5c7 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/network_normal.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/network_pedestrian.xml b/contribs/bicycle/src/main/resources/bicycle_example/network_pedestrian.xml new file mode 100644 index 00000000000..c82c937ea8a --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/network_pedestrian.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + primary + + + + + primary + + + + + primary + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + pedestrian + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + primary + + + + + + + \ No newline at end of file diff --git a/contribs/bicycle/src/main/resources/bicycle_example/population_1200.xml b/contribs/bicycle/src/main/resources/bicycle_example/population_1200.xml new file mode 100644 index 00000000000..d9c5928bf71 --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/population_1200.xml @@ -0,0 +1,21610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contribs/bicycle/src/main/resources/bicycle_example/population_20.xml b/contribs/bicycle/src/main/resources/bicycle_example/population_20.xml deleted file mode 100644 index 1efce162a03..00000000000 --- a/contribs/bicycle/src/main/resources/bicycle_example/population_20.xml +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contribs/bicycle/src/main/resources/bicycle_example/population_3.xml b/contribs/bicycle/src/main/resources/bicycle_example/population_3.xml new file mode 100644 index 00000000000..9b2b3417ddd --- /dev/null +++ b/contribs/bicycle/src/main/resources/bicycle_example/population_3.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contribs/bicycle/src/test/java/org/matsim/contrib/bicycle/run/BicycleTest.java b/contribs/bicycle/src/test/java/org/matsim/contrib/bicycle/run/BicycleTest.java index 18b66752a2c..8f437522535 100644 --- a/contribs/bicycle/src/test/java/org/matsim/contrib/bicycle/run/BicycleTest.java +++ b/contribs/bicycle/src/test/java/org/matsim/contrib/bicycle/run/BicycleTest.java @@ -19,14 +19,23 @@ package org.matsim.contrib.bicycle.run; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.apache.log4j.Logger; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; +import org.matsim.api.core.v01.Id; +import org.matsim.api.core.v01.Scenario; +import org.matsim.api.core.v01.population.Person; +import org.matsim.contrib.bicycle.BicycleConfigGroup; +import org.matsim.contrib.bicycle.BicycleConfigGroup.BicycleScoringType; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; +import org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting; +import org.matsim.core.population.PopulationUtils; +import org.matsim.core.population.io.PopulationReader; +import org.matsim.core.scenario.ScenarioUtils; import org.matsim.testcases.MatsimTestUtils; import org.matsim.utils.eventsfilecomparison.EventsFileComparator; @@ -34,29 +43,235 @@ * @author dziemke */ public class BicycleTest { - private static final Logger log = Logger.getLogger(BicycleTest.class); + private static final Logger LOG = Logger.getLogger(BicycleTest.class); @Rule public MatsimTestUtils utils = new MatsimTestUtils(); - - @Ignore - // After several alterations in bicycle code, this test needs to be redone + @Test - public final void test() { + public void testNormal() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); - // This works when the data is stored under "/matsim/contribs/bicycle/src/main/resources/bicycle_example" - Config config = ConfigUtils.loadConfig("bicycle_example/config.xml", new BicycleConfigGroup()); + // Normal network + config.network().setInputFile("network_normal.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); config.controler().setOutputDirectory(utils.getOutputDirectory()); + config.controler().setLastIteration(0); + + new RunBicycleExample().run(config, false); + + LOG.info("Checking MATSim events file ..."); + final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; + final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; + assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); - try { - new RunBicycleExample().run(config); - } catch (Exception e) { - e.printStackTrace(); - Assert.fail("Something did not work") ; + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + for (Id personId : scenarioReference.getPopulation().getPersons().keySet()) { + double scoreReference = scenarioReference.getPopulation().getPersons().get(personId).getSelectedPlan().getScore(); + double scoreCurrent = scenarioCurrent.getPopulation().getPersons().get(personId).getSelectedPlan().getScore(); + Assert.assertEquals("Scores of persons " + personId + " are different", scoreReference, scoreCurrent, MatsimTestUtils.EPSILON); } + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); + } + + @Test + public void testCobblestone() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); + + // Links 4-8 and 13-17 have cobblestones + config.network().setInputFile("network_cobblestone.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); + config.controler().setOutputDirectory(utils.getOutputDirectory()); + config.controler().setLastIteration(0); + + new RunBicycleExample().run(config, false); - log.info("Checking MATSim events file ..."); + LOG.info("Checking MATSim events file ..."); final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); + + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); + } + + @Test + public void testPedestrian() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); + + // Links 4-8 and 13-17 are pedestrian zones + config.network().setInputFile("network_pedestrian.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); + config.controler().setOutputDirectory(utils.getOutputDirectory()); + config.controler().setLastIteration(0); + + new RunBicycleExample().run(config, false); + + LOG.info("Checking MATSim events file ..."); + final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; + final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; + assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); + + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); + } + + @Test + public void testLane() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); + + // Links 2-4/8-10 and 11-13/17-19 have cycle lanes (cycleway=lane) + config.network().setInputFile("network_lane.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); + config.controler().setOutputDirectory(utils.getOutputDirectory()); + config.controler().setLastIteration(0); + + new RunBicycleExample().run(config, false); + + LOG.info("Checking MATSim events file ..."); + final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; + final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; + assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); + + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); + } + + @Test + public void testGradient() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); + + // Nodes 5-9 have a z-coordinate > 0, i.e. the links leading to those nodes have a slope + config.network().setInputFile("network_gradient.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); + config.controler().setOutputDirectory(utils.getOutputDirectory()); + config.controler().setLastIteration(0); + + new RunBicycleExample().run(config, false); + + LOG.info("Checking MATSim events file ..."); + final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; + final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; + assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); + + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); + } + + @Test + public void testGradientLane() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); + + // Nodes 5-9 have a z-coordinate > 0, i.e. the links leading to those nodes have a slope + // and links 4-5 and 13-14 have cycle lanes + config.network().setInputFile("network_gradient_lane.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); + config.controler().setOutputDirectory(utils.getOutputDirectory()); + config.controler().setLastIteration(0); + + new RunBicycleExample().run(config, false); + + LOG.info("Checking MATSim events file ..."); + final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; + final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; + assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); + + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); + } + + @Test + public void testNormal10It() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); + + // Normal network + config.network().setInputFile("network_normal.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); + config.controler().setOutputDirectory(utils.getOutputDirectory()); + // 10 iterations + config.controler().setLastIteration(10); + + new RunBicycleExample().run(config, false); + + LOG.info("Checking MATSim events file ..."); + final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; + final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; + assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); + + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); + } + + @Test + public void testMotorizedInteraction() { + Config config = ConfigUtils.createConfig("./src/main/resources/bicycle_example/"); + config.addModule(new BicycleConfigGroup()); + RunBicycleExample.fillConfigWithBicycleStandardValues(config); + + // Normal network + config.network().setInputFile("network_normal.xml"); + config.plans().setInputFile("population_1200.xml"); + config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); + config.controler().setOutputDirectory(utils.getOutputDirectory()); + config.controler().setLastIteration(10); + + // Activate link-based scoring + BicycleConfigGroup bicycleConfigGroup = (BicycleConfigGroup) config.getModules().get("bicycle"); + bicycleConfigGroup.setBicycleScoringType(BicycleScoringType.linkBased); + + // Interaction with motor vehicles + new RunBicycleExample().run(config, true); + + LOG.info("Checking MATSim events file ..."); + final String eventsFilenameReference = utils.getInputDirectory() + "output_events.xml.gz"; + final String eventsFilenameNew = utils.getOutputDirectory() + "output_events.xml.gz"; + assertEquals("Different event files.", EventsFileComparator.compareAndReturnInt(eventsFilenameReference, eventsFilenameNew), 0); + + Scenario scenarioReference = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + Scenario scenarioCurrent = ScenarioUtils.createScenario(ConfigUtils.createConfig()); + new PopulationReader(scenarioReference).readFile(utils.getInputDirectory() + "output_plans.xml.gz"); + new PopulationReader(scenarioCurrent).readFile(utils.getOutputDirectory() + "output_plans.xml.gz"); + assertTrue("Populations are different", PopulationUtils.equalPopulation(scenarioReference.getPopulation(), scenarioCurrent.getPopulation())); } } \ No newline at end of file diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/test/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/test/output_events.xml.gz deleted file mode 100644 index 9cd0366784f..00000000000 Binary files a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/test/output_events.xml.gz and /dev/null differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testCobblestone/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testCobblestone/output_events.xml.gz new file mode 100644 index 00000000000..fc08bc77a13 Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testCobblestone/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testCobblestone/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testCobblestone/output_plans.xml.gz new file mode 100644 index 00000000000..b5949ebb27e Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testCobblestone/output_plans.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradient/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradient/output_events.xml.gz new file mode 100644 index 00000000000..c3246b01aaa Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradient/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradient/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradient/output_plans.xml.gz new file mode 100644 index 00000000000..0672414010c Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradient/output_plans.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradientLane/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradientLane/output_events.xml.gz new file mode 100644 index 00000000000..c32a76833c6 Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradientLane/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradientLane/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradientLane/output_plans.xml.gz new file mode 100644 index 00000000000..bcb2bd8da3e Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testGradientLane/output_plans.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testLane/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testLane/output_events.xml.gz new file mode 100644 index 00000000000..98e9f33b0ab Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testLane/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testLane/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testLane/output_plans.xml.gz new file mode 100644 index 00000000000..731d08e37bb Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testLane/output_plans.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testMotorizedInteraction/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testMotorizedInteraction/output_events.xml.gz new file mode 100644 index 00000000000..89d4794ed00 Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testMotorizedInteraction/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testMotorizedInteraction/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testMotorizedInteraction/output_plans.xml.gz new file mode 100644 index 00000000000..e646f9ebcfd Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testMotorizedInteraction/output_plans.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal/output_events.xml.gz new file mode 100644 index 00000000000..2639e8f3e6c Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal/output_plans.xml.gz new file mode 100644 index 00000000000..fb3b02955b6 Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal/output_plans.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal10It/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal10It/output_events.xml.gz new file mode 100644 index 00000000000..1862bc573ab Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal10It/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal10It/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal10It/output_plans.xml.gz new file mode 100644 index 00000000000..cd72e83f545 Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testNormal10It/output_plans.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testPedestrian/output_events.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testPedestrian/output_events.xml.gz new file mode 100644 index 00000000000..5a503c6c666 Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testPedestrian/output_events.xml.gz differ diff --git a/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testPedestrian/output_plans.xml.gz b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testPedestrian/output_plans.xml.gz new file mode 100644 index 00000000000..1ce4b8e9f82 Binary files /dev/null and b/contribs/bicycle/test/input/org/matsim/contrib/bicycle/run/BicycleTest/testPedestrian/output_plans.xml.gz differ diff --git a/examples/scenarios/equil/network.xml b/examples/scenarios/equil/network.xml old mode 100755 new mode 100644 diff --git a/matsim/src/main/java/org/matsim/core/config/groups/PlanCalcScoreConfigGroup.java b/matsim/src/main/java/org/matsim/core/config/groups/PlanCalcScoreConfigGroup.java index 09a52458a6f..0add77db1b1 100644 --- a/matsim/src/main/java/org/matsim/core/config/groups/PlanCalcScoreConfigGroup.java +++ b/matsim/src/main/java/org/matsim/core/config/groups/PlanCalcScoreConfigGroup.java @@ -1555,5 +1555,4 @@ public void setWriteExperiencedPlans(boolean writeExperiencedPlans) { } } - -} +} \ No newline at end of file