Skip to content

Commit

Permalink
Merge branch 'master' into senozon_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Kohl committed Jan 16, 2024
2 parents cc7f9bb + 6b2da3d commit bcfc290
Show file tree
Hide file tree
Showing 2,422 changed files with 65,236 additions and 61,687 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
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: 'maven'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: 'java'
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -41,9 +41,9 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:java"
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-pr-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-release-created.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/full-integration.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: full-integration

on:
workflow_dispatch:
schedule:
- cron: '30 0 * * *' # daily at 0:30 UTC

Expand All @@ -13,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Prepare git
Expand All @@ -24,7 +25,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
3 changes: 1 addition & 2 deletions .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 All @@ -85,7 +84,7 @@ jobs:
- name: Setup Java
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
8 changes: 6 additions & 2 deletions benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@
<version>16.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
</dependencies>

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
4 changes: 2 additions & 2 deletions contribs/accessibility/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>org.openstreetmap.osmosis</groupId>
<artifactId>osmosis-core</artifactId>
<version>0.48.3</version>
<version>${osmosis.version}</version>
<exclusions>
<!-- needed to compile in IntelliJ with Eclipse compiler -->
<!-- see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928 -->
Expand All @@ -65,7 +65,7 @@
<dependency>
<groupId>org.openstreetmap.osmosis</groupId>
<artifactId>osmosis-xml</artifactId>
<version>0.48.3</version>
<version>${osmosis.version}</version>
</dependency>
<dependency>
<groupId>org.matsim.contrib</groupId>
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 bcfc290

Please sign in to comment.