Skip to content

Commit

Permalink
Merge branch 'master' into drt-estimator
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow authored Oct 13, 2023
2 parents 71d350c + 3cd3946 commit 8a9eb29
Show file tree
Hide file tree
Showing 1,119 changed files with 13,028 additions and 25,708 deletions.
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ updates:
directory: "/"
schedule:
interval: "daily"
groups:
maven:
patterns: ["*"]

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/verify-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
- contribs/railsim
- contribs/roadpricing
- contribs/analysis
- contribs/eventsBasedPTRouter
- contribs/hybridsim
- contribs/informed-mode-choice
- contribs/otfvis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Benchmark {
public static void main(String[] args) throws IOException {
Config config = ConfigUtils.loadConfig(IOUtils.extendUrl(ExamplesUtils.getTestScenarioURL("benchmark"), "config.xml"));
Controler ctl = new Controler(config);
ctl.getConfig().controler().setCreateGraphs(false);
ctl.getConfig().controller().setCreateGraphs(false);
ctl.run();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,26 @@
*/
class AccessibilityComputationNairobiLandUseLocalCopy {
public static final Logger LOG = LogManager.getLogger(AccessibilityComputationNairobiLandUseLocalCopy.class);

public static void main(String[] args) {
int tileSize_m = 500;
boolean push2Geoserver = false; // Set true for run on server
boolean createQGisOutput = true; // Set false for run on server

final Config config = ConfigUtils.createConfig(new AccessibilityConfigGroup());

Envelope envelope = new Envelope(246000, 271000, 9853000, 9863000); // Central part of Nairobi
String scenarioCRS = "EPSG:21037"; // EPSG:21037 = Arc 1960 / UTM zone 37S, for Nairobi, Kenya

config.network().setInputFile("../nairobi/data/nairobi/input/2015-10-15_network.xml");
config.facilities().setInputFile("../nairobi/data/land_use/Nairobi_LU_2010/facilities.xml");
String runId = "ke_nairobi_landuse_hexagons_" + tileSize_m;
config.controler().setOutputDirectory("../nairobi/data/nairobi/output/" + runId + "_lcpt_par4_car_tr-7_500/");
config.controler().setRunId(runId);
config.controler().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists);
config.controler().setLastIteration(0);
config.controller().setOutputDirectory("../nairobi/data/nairobi/output/" + runId + "_lcpt_par4_car_tr-7_500/");
config.controller().setRunId(runId);

config.controller().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists);
config.controller().setLastIteration(0);

AccessibilityConfigGroup acg = ConfigUtils.addOrGetModule(config, AccessibilityConfigGroup.class);
acg.setAreaOfAccessibilityComputation(AreaOfAccesssibilityComputation.fromBoundingBoxHexagons);
acg.setEnvelope(envelope);
Expand All @@ -69,17 +69,17 @@ public static void main(String[] args) {
acg.setOutputCrs(scenarioCRS);

//acg.setUseParallelization(false);

ConfigUtils.setVspDefaults(config);

final Scenario scenario = ScenarioUtils.loadScenario(config);

// final List<String> activityTypes = Arrays.asList(new String[]{"educational", "commercial", "industrial", "recreational", "water_body"});
final List<String> activityTypes = Arrays.asList(new String[]{"educational"});
final ActivityFacilities densityFacilities = AccessibilityUtils.createFacilityForEachLink(Labels.DENSITIY, scenario.getNetwork());

final Controler controler = new Controler(scenario);

for (String activityType : activityTypes) {
AccessibilityModule module = new AccessibilityModule();
module.setConsideredActivityType(activityType);
Expand All @@ -88,17 +88,17 @@ public static void main(String[] args) {
module.setCreateQGisOutput(createQGisOutput);
controler.addOverridingModule(module);
}

controler.run();

if (createQGisOutput) {
final Integer range = 9; // In the current implementation, this must always be 9
final Double lowerBound = -3.5; // (upperBound - lowerBound) ideally nicely divisible by (range - 2)
final Double upperBound = 3.5;
final int populationThreshold = (int) (10 / (1000/tileSize_m * 1000/tileSize_m)); // People per km^2 or roads (?)

String osName = System.getProperty("os.name");
String workingDirectory = config.controler().getOutputDirectory();
String workingDirectory = config.controller().getOutputDirectory();
for (String actType : activityTypes) {
String actSpecificWorkingDirectory = workingDirectory + actType + "/";
for (Modes4Accessibility mode : acg.getIsComputingMode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.api.core.v01.network.Node;
import org.matsim.contrib.accessibility.utils.AggregationObject;
import org.matsim.contrib.accessibility.utils.ProgressBar;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.PlanCalcScoreConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup;
import org.matsim.core.controler.events.ShutdownEvent;
import org.matsim.core.controler.listener.ShutdownListener;
import org.matsim.core.gbl.Gbl;
Expand All @@ -58,9 +57,9 @@ final class AccessibilityComputationShutdownListener implements ShutdownListener
private final ArrayList<FacilityDataExchangeInterface> zoneDataExchangeListeners = new ArrayList<>();

private AccessibilityConfigGroup acg;
private final PlanCalcScoreConfigGroup cnScoringGroup;
private final ScoringConfigGroup cnScoringGroup;



public AccessibilityComputationShutdownListener(Scenario scenario, ActivityFacilities measuringPoints, ActivityFacilities opportunities,
String outputDirectory) {
this.measuringPoints = measuringPoints;
Expand All @@ -69,7 +68,7 @@ public AccessibilityComputationShutdownListener(Scenario scenario, ActivityFacil
this.outputDirectory = outputDirectory;

this.acg = ConfigUtils.addOrGetModule(scenario.getConfig(), AccessibilityConfigGroup.GROUP_NAME, AccessibilityConfigGroup.class);
this.cnScoringGroup = scenario.getConfig().planCalcScore();
this.cnScoringGroup = scenario.getConfig().scoring();

if (cnScoringGroup.getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfDistance() != 0.) {
LOG.error("Marginal utility of distance for car different from zero, but not used in accessibility computations");
Expand Down Expand Up @@ -241,10 +240,10 @@ private void writeCSVFile(String adaptedOutputDirectory) {
writer.writeField(facility.getCoord().getX());
writer.writeField(facility.getCoord().getY());
writer.writeField(tuple.getSecond());

for (String mode : getModes() ) {
final double value = accessibilitiesMap.get(tuple).get(mode);
if (!Double.isNaN(value)) {
if (!Double.isNaN(value)) {
writer.writeField(value) ;
} else {
writer.writeField(Double.NaN) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private AccessibilityFromEvents( Scenario scenario, String eventsFile, List<Faci
public void run() {
LinkedHashMap<String, TravelTime> map = new LinkedHashMap<>( ) ;
EventsManager events = EventsUtils.createEventsManager();
for( String mode : scenario.getConfig().plansCalcRoute().getNetworkModes() ){
for( String mode : scenario.getConfig().routing().getNetworkModes() ){
TravelTimeCalculator.Builder builder = new TravelTimeCalculator.Builder( scenario.getNetwork() );
builder.setCalculateLinkTravelTimes( true );
builder.setCalculateLinkToLinkTravelTimes( false );
Expand All @@ -74,7 +74,7 @@ public void run() {
install( new ScenarioByInstanceModule( scenario ) ) ;
install( new TripRouterModule() ) ;
install( new TimeInterpretationModule() );
for( String mode : getConfig().plansCalcRoute().getNetworkModes() ){
for( String mode : getConfig().routing().getNetworkModes() ){
addTravelTimeBinding( mode ).toInstance( map.get(mode) );
}
install( new TravelDisutilityModule() ) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public ControlerListener get() {
}
AccessibilityUtils.assignAdditionalFacilitiesDataToMeasurePoint(measuringPoints, measurePointGeometryMap, additionalFacs);

String outputDirectory = scenario.getConfig().controler().getOutputDirectory() + "/" + activityType;
String outputDirectory = scenario.getConfig().controller().getOutputDirectory() + "/" + activityType;
AccessibilityComputationShutdownListener accessibilityShutdownListener = new AccessibilityComputationShutdownListener(scenario, measuringPoints, opportunities, outputDirectory);

// for (Modes4Accessibility mode : acg.getIsComputingMode()) {
Expand All @@ -150,14 +150,14 @@ public ControlerListener get() {
final TravelDisutilityFactory travelDisutilityFactory = travelDisutilityFactories.get(TransportMode.car);
Gbl.assertNotNull(travelDisutilityFactory);
calculator = new NetworkModeAccessibilityExpContributionCalculator(mode, new FreeSpeedTravelTime(), travelDisutilityFactory, scenario);
} else if ( config.plansCalcRoute().getNetworkModes().contains( mode ) ) {
} else if ( config.routing().getNetworkModes().contains( mode ) ) {
final TravelTime nwModeTravelTime = travelTimes.get(mode);
Gbl.assertNotNull(nwModeTravelTime);
final TravelDisutilityFactory nwModeTravelDisutility = travelDisutilityFactories.get(mode);
Gbl.assertNotNull( nwModeTravelDisutility );
calculator = new NetworkModeAccessibilityExpContributionCalculator(mode, nwModeTravelTime, nwModeTravelDisutility, scenario);
} else if ( TransportMode.pt.equals( mode ) ){
calculator = new SwissRailRaptorAccessibilityContributionCalculator( mode, config.planCalcScore(), scenario );
calculator = new SwissRailRaptorAccessibilityContributionCalculator( mode, config.scoring(), scenario );
} else if ( Modes4Accessibility.matrixBasedPt.name().equals( mode ) ) {
throw new RuntimeException("currently not supported because implementation not consistent with guice grapher. kai, sep'19") ;
// calculator = new LeastCostPathCalculatorAccessibilityContributionCalculator(
Expand All @@ -175,7 +175,7 @@ public ControlerListener get() {
if ( travelDisutilityFactory==null ) {
throw new RuntimeException("mode=" + mode + "; travelDisutilityFactory is null!") ;
}
calculator = new TripRouterAccessibilityContributionCalculator(mode, tripRouter, config.planCalcScore(), scenario,
calculator = new TripRouterAccessibilityContributionCalculator(mode, tripRouter, config.scoring(), scenario,
travelTime, travelDisutilityFactory );
}

Expand All @@ -195,7 +195,7 @@ public ControlerListener get() {
}
Set <String> additionalFacInfo = additionalFacs.keySet();
accessibilityShutdownListener.addFacilityDataExchangeListener(new GeoserverUpdater(acg.getOutputCrs(),
config.controler().getRunId() + "_" + activityType, measurePointGeometryMap, additionalFacInfo,
config.controller().getRunId() + "_" + activityType, measurePointGeometryMap, additionalFacInfo,
outputDirectory, pushing2Geoserver, createQGisOutput));
}

Expand Down
Loading

0 comments on commit 8a9eb29

Please sign in to comment.