diff --git a/.gitignore b/.gitignore index 69937618..f33076c4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ hs_err_pid* /.project /.classpath /target/ -/output/ +output* /bin/ /.idea/ diff --git a/README.md b/README.md index db063f41..92cb5dd8 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ This repository provides an open MATSim transport model for Berlin, provided by Currently, there are two versions of the MATSim Open Berlin model: -#### 10pct scenario (scenarios/berlin-v5.2-10pct) +##### 10pct scenario (scenarios/berlin-v5.2-10pct) This scenario contains a 10pct sample of the Greater Berlin population; road capacities are accordingly reduced. The scenario is calibrated taking into consideration the traffic counts, modal split and mode-specific trip distance distributions. -#### 1pct scenario (scenarios/berlin-v5.2-1pct) +##### 1pct scenario (scenarios/berlin-v5.2-1pct) This scenario contains a 1pct sample of the Greater Berlin population; road capacities are accordingly reduced. This scenario was not (!) calibrated and should only be used for testing purposes or pre-studies! @@ -33,12 +33,13 @@ Go to https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/d 1. Get these files into VIA. This can be achieved in various ways; one is to open VIA and then drag the files from a file browser into VIA. 1. Run VIA and enjoy. -### Downloading the repository +### Downloading the repository alternative 1: Download ZIP 1. Click on `Clone or download` and then on `Download ZIP`. 1. Unzip the repository. +1. Go to "Run the MATSim Berlin scenario" below. -### Cloning the repository +### Downloading the repository alternative 2: Clone the repository ##### Initial stuff (needs to be done once) @@ -61,8 +62,8 @@ This will update your repository to the newest version. ### Run the MATSim Berlin scenario (Requires either cloning or downloading the repository.) -#### ... using a runnable jar file (coming soon!) -1. There should be a file directly in the `matsim-berlin` directory with name approximately as `matsim-berlin-5.2-SNAPSHOT-jar-with-dependencies.jar`. +##### ... using a runnable jar file +1. There should be a file directly in the `matsim-berlin` directory with name approximately as `matsim-berlin-5.2-jar-with-dependencies.jar`. 1. Double-click on that file (in a file system browser). A simple GUI should open. 1. In the GUI, click on the "Choose" button for configuration file. Navigate to one of the `scenario` directories and load one of the configuration files. 1. Increase memory in the GUI. @@ -70,7 +71,7 @@ This will update your repository to the newest version. 1. "Open" the output directory. You can drag files into VIA as was already done above. 1. "Edit..." (in the GUI) the config file. Re-run MATSim. -#### ... using an IDE, e.g. Eclipse, IntelliJ +##### ... using an IDE, e.g. Eclipse, IntelliJ 1. Set up the project in your IDE. 1. Make sure the project is configured as maven project. 1. Run the JAVA class `src/main/java/org/matsim/run/RunBerlinScenario.java`. diff --git a/matsim-berlin-5.2-jar-with-dependencies.jar b/matsim-berlin-5.2-jar-with-dependencies.jar new file mode 100644 index 00000000..e069d02f Binary files /dev/null and b/matsim-berlin-5.2-jar-with-dependencies.jar differ diff --git a/src/main/java/org/matsim/run/KNRunBerlinScenario.java b/src/main/java/org/matsim/run/KNRunBerlinScenario.java deleted file mode 100644 index fa2a9db6..00000000 --- a/src/main/java/org/matsim/run/KNRunBerlinScenario.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.matsim.run; - -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.TransportMode; -import org.matsim.api.core.v01.network.Link; -import org.matsim.api.core.v01.population.Person; -import org.matsim.contrib.analysis.kai.KaiAnalysisListener; -import org.matsim.contrib.common.diversitygeneration.planselectors.DiversityGeneratingPlansRemover; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.core.config.groups.PlanCalcScoreConfigGroup; -import org.matsim.core.config.groups.PlansCalcRouteConfigGroup; -import org.matsim.core.config.groups.StrategyConfigGroup; -import org.matsim.core.config.groups.StrategyConfigGroup.StrategySettings; -import org.matsim.core.controler.AbstractModule; -import org.matsim.core.controler.Controler; -import org.matsim.core.gbl.Gbl; -import org.matsim.core.replanning.strategies.DefaultPlanStrategiesModule; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.matsim.core.config.groups.PlanCalcScoreConfigGroup.*; -import static org.matsim.core.config.groups.PlansCalcRouteConfigGroup.*; -import static org.matsim.core.replanning.strategies.DefaultPlanStrategiesModule.*; - -class KNRunBerlinScenario { - private enum MyScenario { bln1pct, bln10pct, equil } ; - private static MyScenario myScenario = MyScenario.bln1pct ; - - public static void main(String[] args) { - String configFileName = "scenarios/berlin-v5.1-10pct/input/berlin-v5.1-10pct.config.xml" ; -// String configFileName = "scenarios/berlin-v5.0-1pct-2018-06-18/input/berlin-5.1_config.xml"; -// String configFileName = "scenarios/berlin-v5.0-1pct/input/berlin-5.1_config_reduced.xml"; - - // "overridingConfig.xml" is taken as an argument now which was hard-coded in there. Amit July'18 -// final RunBerlinScenario berlin = new RunBerlinScenario( configFileName); - final RunBerlinScenario berlin = new RunBerlinScenario( configFileName, "overridingConfig.xml" ); - - final Config config = berlin.prepareConfig() ; - - config.global().setNumberOfThreads( 6 ); - config.qsim().setNumberOfThreads( 6 ); - config.parallelEventHandling().setNumberOfThreads( 1 ); - - config.controler().setLastIteration( 100 ); - - config.strategy().setFractionOfIterationsToDisableInnovation( 0.8 ); - // 50 w/ 500 - // 20 w/ 100 - - - - // config.controler().setWritePlansInterval( 10 ); - config.controler().setOutputDirectory( "./output" ); - config.controler().setRunId( null ); - config.planCalcScore().setWriteExperiencedPlans( true ); -// { -// final StrategySettings stratSets = new StrategySettings() ; -// stratSets.setStrategyName( DefaultStrategy.ChangeSingleTripMode ); -// stratSets.setWeight( 0.2 ); -// stratSets.setSubpopulation( "person" ); -// config.strategy().addStrategySettings( stratSets ); -// -// config.changeMode().setModes( config.subtourModeChoice().getModes() ); -// } -// for ( StrategySettings settings : config.strategy().getStrategySettings() ) { -// if ( settings.getStrategyName().equals( DefaultStrategy.SubtourModeChoice ) ) { -// settings.setWeight( 0.0 ); -// } -// } - // config.transit().setUsingTransitInMobsim( false ); - - switch( myScenario ) { - case bln1pct: - case bln10pct: - break; - case equil: - config.global().setNumberOfThreads( 1 ); - config.qsim().setNumberOfThreads( 1 ); - config.parallelEventHandling().setNumberOfThreads( 1 ); - - config.network().setInputFile( "../../equil/network.xml" ); -// config.plans().setInputFile( "../../equil/plans100.xml" ); - config.plans().setInputFile( "../../equil/plans2000.xml.gz" ); - config.plans().setInputPersonAttributeFile( null ); - - config.qsim().setFlowCapFactor( 1.0 ); - config.qsim().setStorageCapFactor( 1.0 ); - - config.transit().setUseTransit( false ); - { - final ModeRoutingParams modeRoutingParams = new ModeRoutingParams( TransportMode.pt ) ; - modeRoutingParams.setTeleportedModeFreespeedFactor(3. ); - config.plansCalcRoute().addModeRoutingParams( modeRoutingParams ); - } - { -// final ModeParams params = config.planCalcScore().getScoringParametersPerSubpopulation().get( "person" ).getModes().get( TransportMode.pt ); - final ModeParams params = config.planCalcScore().getModes().get( TransportMode.pt ); - params.setMarginalUtilityOfDistance( -0.0001 ); // yyyy should rather be a distance cost rate - } - { - final ActivityParams params = config.planCalcScore().getActivityParams( "work_28800.0" );; - Gbl.assertNotNull( params ); - params.setOpeningTime( 8*3600. ); - params.setLatestStartTime( 8*3600. ); - } - config.planCalcScore().setLateArrival_utils_hr( -6 ); -// { -// final ActivityParams actParams = new ActivityParams( "w" ) ; -// actParams.setTypicalDuration( 8.*3600. ); -// actParams.setOpeningTime( 6.*3600. ); -// actParams.setClosingTime( 18.*3600. ); -// config.planCalcScore().getScoringParametersPerSubpopulation().get("person").addActivityParams( actParams ); -// } -// { -// final ActivityParams actParams = new ActivityParams( "h" ) ; -// actParams.setTypicalDuration( 16.*3600. ); -// config.planCalcScore().getScoringParametersPerSubpopulation().get("person").addActivityParams( actParams ); -// } - break; - } - - final Scenario scenario = berlin.prepareScenario() ; - - switch ( myScenario ) { - case bln1pct: - case bln10pct: - break; - case equil: - for ( Link link : scenario.getNetwork().getLinks().values() ) { - final Set allowedModes = new HashSet<>( link.getAllowedModes() ) ; - allowedModes.add( "freight") ; - allowedModes.add( "ride") ; - link.setAllowedModes( allowedModes ) ; - } - for ( Person person : scenario.getPopulation().getPersons().values() ) { - person.getAttributes().putAttribute( config.plans().getSubpopulationAttributeName(), "person" ) ; - - final String objectId = person.getId().toString() ; - final String attribute = config.plans().getSubpopulationAttributeName() ; - scenario.getPopulation().getPersonAttributes().putAttribute( objectId, attribute, "person" ) ; - } - break; - } - - List overridingModules = new ArrayList<>() ; - -// overridingModules.add( new AbstractModule() { -// @Override public void install() { -// DiversityGeneratingPlansRemover.Builder builder = new DiversityGeneratingPlansRemover.Builder() ; -// final double ccc = 0.03 ; -// builder.setSameLocationPenalty( ccc ) ; -// builder.setSameActivityTypePenalty( ccc ) ; -// builder.setSameActivityEndTimePenalty( ccc ) ; -// builder.setSameModePenalty( ccc ) ; -// builder.setSameRoutePenalty( ccc ) ; -//// builder.setStageActivityTypes( tripRouter.getStageActivityTypes() ) ; -// this.bindPlanSelectorForRemoval().toProvider( builder ) ; -// } -// } ); - - overridingModules.add( new KaiAnalysisListener.Module() ); - - berlin.prepareControler( overridingModules.toArray( new AbstractModule[0] ) ); - - berlin.run() ; - } - -}